Our BerryIMU GIT repository has been updated with code for the Teensy, specifically Teensy 3.6.
Now you can have access to an accelerometer, gyroscope, compass, temperature and pressure sensor on your Teensy.
Here you can see the angles displayed using the Serial Plotter in the Arduino IDE which is connected to a Teensy 3.6.
Teensy 3.6 Hookup
Connect SCL on the BerryIMU to PIN 19
Connect SDA on the BerryIMU to PIN 18
Use 3.3v pin on the Teensy to power the BerryIMU.
We use the Arduino IDE to program the Teensy. You will need to install Teensduino so that your Arduino IDE supports Teensy.
You can download it from this link;
Arduino Serial plotter
The latest version of Arduino IDE includes a Serial Plotter. This is great to show angles in a sliding graph.
The below image shows how to access the Serial Plotter.
The Serial Monitor will have to be closed as both cannot be opened at the same time.
The Serial Plotter expects the values to be separated with a space. To show the X and Y angles on the plotter, comment out the print statements in the existing code and insert the code below.
Serial.print(AccXangle); Serial.print("\t"); Serial.print(AccYangle);
Detailed Guides and Tutorials
The below guides are specific to the Raspberry Pi, however there is only a minor difference between the code in the guides below and the code for a Teensy. The math and principles are still the same.
In this order;
Guide to interfacing a Gyro and Accelerometer with a Raspberry Pi
Guide to interfacing a Gyro and Accelerometer with a Raspberry Pi - Kalman Filter
Create a Digital Compass with the Raspberry Pi – Part 1 – “The Basics”
Create a Digital Compass with the Raspberry Pi – Part 2 – “Tilt Compensation”
Create a Digital Compass with the Raspberry Pi – Part 3 – “Calibration”