Team3 imu
Contents
WT901B | AHRS IMU Sensor
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
Built-in sensors
Accelerometer: Acceleration X Y Z, 3-axis
Gyroscope: Angular Velocity X Y Z, 3-axis
Magnetometer: Magnetic Field X Y Z, 3-axis
Barometer: Air Pressure 1-Axis
Board Dimensions
Size: 15mm x 15mm x 2mm, Weight: 1g
Tolerance Size & Weight: +/- 0.1
Board 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
Connecting to an ESP32
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
Required Library
- 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
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
Please insert video from uni2work
Additional links
Official GitHub Page Witmotion
Official GitHub Page Witmotion WT901B Sensor
https://github.com/WITMOTION/WT901B
Datasheet
https://raw.githubusercontent.com/WITMOTION/WT901B/master/WT901B%20Datasheet.pdf
Manual
https://raw.githubusercontent.com/WITMOTION/WT901B/master/WT901B%20Manual.pdf
Official Google Drive Folder
https://drive.google.com/drive/folders/1F2oTeQccvxNKxq6nW6isxhYecPMagr8M
Sources of the Pictures
All the pictures where taken from the official WT901B Datasheet by WITMOTION.