Team3 imu

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search

WT901B | AHRS IMU Sensor[edit]

With the WT901B IMU sensor device one can detect acceleration, angle, angular velocity, magnetic filed and air pressure. The both robust and small product is perfectly suitable for smartwatches.


Product Features[edit]

Built-in sensors[edit]

Accelerometer Accelerometer: Acceleration X Y Z, 3-axis


Gyroscope Gyroscope: Angular Velocity X Y Z, 3-axis


Magnetometer Magnetometer: Magnetic Field X Y Z, 3-axis


Barometer Barometer: Air Pressure 1-Axis


Board Dimensions[edit]

WT901B Size Size: 15mm x 15mm x 2mm, Weight: 1g

Tolerance Size & Weight: +/- 0.1

Board Pin Definition[edit]

WT901B Pin Definition

  • VCC: 3.3-5V input supply
  • RX: Serial data input, TTL interface
  • TX: Serial data output, TTL interface
  • GND: Ground
  • DO: Analog input, digital input and output, PWM
  • D1: Analog input, digital input and output, PWM, connect GPS
  • D2: Analog input, digital input and output, PWM
  • D3: Analog input, digital input and output, PWM
  • SDA: I2C signal line
  • SCL: I2C clock line


How to get it to work[edit]

Connecting to an ESP32[edit]

We need to connect the four pins VCC, RX, TX and GND of the WT901B to the corresponding pins of the ESP32. Therefore, we need to connect WT901B …

  • ...VCC to the power supply (3-5V works) of our microcontroller’s 3.3V pin
  • ...GND to one of the GND pins on our microcontroller
  • ...TX to one of the corresponding pins on our microcontroller
  • ...RX to one of the corresponding pins on our microcontroller

Pin-Out Joy-it NodeMCU-ESP32

Required Library[edit]

  • Download and save JY901.h:
    • Go to: [1]
    • Download Sample Code zip folder
    • Unzip the folder and navigate to Arduino > Arduino > JY901SerialMega2560
    • Add folder with files to the library folder of your project
  • import library in your main file: #include <JY901.h>

Code Example[edit]

 1 #include <Arduino.h>
 2 #include <Wire.h>
 3 #include <JY901.h>
 4 
 5 void setup() {
 6   Serial.begin(115200);
 7   JY901.StartIIC();
 8 }
 9 void loop() {
10   
11   //print received data. Data was received in serialEvent;       
12   JY901.GetAcc();
13   Serial.print((float)JY901.stcAcc.a[0]/32768*16);
14   
15   JY901.GetGyro();  
16   Serial.print((float)JY901.stcGyro.w[0]/32768*2000);
17   
18   JY901.GetAngle();
19   Serial.print((float)JY901.stcAngle.Angle[0]/32768*180);
20   
21   JY901.GetMag();
22   Serial.print(JY901.stcMag.h[0]);
23 }

For more Code Examples, use the drive folder provided by WITMOTION: [2]


Instructional Video[edit]

Please insert video from uni2work

Additional links[edit]

Official GitHub Page Witmotion[edit]

https://github.com/WITMOTION/

Official GitHub Page Witmotion WT901B Sensor[edit]

https://github.com/WITMOTION/WT901B

Datasheet[edit]

https://raw.githubusercontent.com/WITMOTION/WT901B/master/WT901B%20Datasheet.pdf

Manual[edit]

https://raw.githubusercontent.com/WITMOTION/WT901B/master/WT901B%20Manual.pdf

Official Google Drive Folder[edit]

https://drive.google.com/drive/folders/1F2oTeQccvxNKxq6nW6isxhYecPMagr8M

Sources of the Pictures[edit]

All the pictures where taken from the official WT901B Datasheet by WITMOTION.