WEEK 11 / INPUT DEVICES
This week we learned about different sensors.
Weekly assignments
TASK: Probe an input device(s)'s analog levels and digital signals Document your work on the group work page and reflect on your individual page what you learned.
You can find the group assignment in our group page.
Measure something: add a sensor to a microcontroller board that you have designed and read it.
For this week's assignment I started working with the sensors for my final project. I'll likely use an accelerometer, gyroscope, and some pressure sensors.
To start, I'm using Adafruit's BNO085. Below is a description I copied from Adafruit's website about what this IMU can do:
Acceleration Vector / Accelerometer: Three axes of acceleration (gravity + linear motion) in m/s^2
Angular Velocity Vector / Gyro: Three axes of 'rotation speed' in rad/s
Magnetic Field Strength Vector / Magnetometer: Three axes of magnetic field sensing in micro Tesla (uT)
Linear Acceleration Vector: Three axes of linear acceleration data (acceleration minus gravity) in m/s^2
Gravity Vector: Three axes of gravitational acceleration (minus any movement) in m/s^2
Absolute Orientation/ Rotation Vector: Four point quaternion output for accurate data manipulation
Thanks to the sensor fusion and signal processing wizards from CEVA, with the BNO085 you also get:
Application Optimized Rotation Vectors: For AR/VR, low latency, and low power consumption
Additional Base Sensor Reports: Separate and simultaneous outputs of Calibrated, Uncalibrated + Correction, and Raw ADC outputs for the Accelerometer, Gyro, and Magnetometer
Detection and Classification reports:
Stability Detection and Classification
Significant Motion Detector
Tap, Step, and Shake Detectors
Activity Classification
As if the above wasn't enough, the BNO085 also provides an impressive suite of detection and classification products by further analyzing the measured motion:
Stability Detection and Classification
Tap Detector
Step Detector
Step Counter
Activity Classification
Significant Motion Detector
Shake Detector
Some reference links:
BNO08X Python and Circuit Python guide
BNO08X Sensor Calibration Procedure
Adafruit's CircuitPython code examples:
Electronic setup
I'm using the board I designed and made during Electronics Design Week.
First step, wiring:
board's 3V to BNO085 Vin (red wire)
board's GND to BNO085 GND (black wire)
board's IO8 to BNO085 SDA (light blue wire)
board's IO9 to BNO085 SCL (dark blue wire)
All the codes were generated with the help from ChatGPT.
My first step was to test the connectivity with the sensor. And this is the sort of output I'm getting.
Went through the BNO08X datasheet to understand more about the output I was getting. Basically, the raw data being displayed were all the bytes the sensor was providing. I learned in the Reading/Writing chapter, that the information I needed were in bytes 13 to 18 - which were the 2 values of each axis. So on the next code, I filtered these bytes and finally read X, Y, and Z acceleration values.
The output was in its raw value form (not in our m/s units) and out of scale. The datasheet didn't specify the scale factor, but it says the sensor range is 8g. This means the accelerometer data will span from -8g to +8g. Meaning a 16-bit signed integer can represent values from -32768 to 32767 and therefore, the scale factor would be the range (16g) divided by the number of units (65536 for the range of 16-bit signed integers, since it spans from -32768 to 32767). The next code generates an output in the proper unit and scale! Wooo!!!
FILES:
+ PY Code: check if I2C are connected
+ PY Code: get raw data from BNO
+ PY Code: get axis data from accelerometer
+ PY Code: get axis data from accelerometer, converting scale and units
WEEK 14 UPDATE
Adafruit's library for the BNO08x on Arduino IDE provides a way quicker and more complete reading of the sensor than what I had in MicroPython. The "more_reports" example is a full list of the basic readings you can get from the embedded sensors in the BNO085, with all the appropriate conversions and units.