Accelerometer experiment prep:
I'm still reading about the sensor, and how poeple have already used it, their code, etc., and collecting links and code and info (largely collected here in this post) so I haven't actually powered the breadboard up and loaded anything yet. I'm still stressed and tired from the last couple of days of exploding world sounds, etc., so I'm having troulbe processing all the stuff in my head (more than usual). Think I am gonna have another nap (whether I want to or not) soon and maybe I'll be clearer after that and can try out some of the code I've found so far just to verify functionality. I'll probalby start with this one
since it's got an easy visualization method.
I've attached the datasheet and register sheet for the chip on the accelerometers; I have the MPU6050 version so it only uses I2C (the 6000 has SPI as well, and can talk faster to the system MCU). The actual boards being used are labelled HW-123.
they're actually 6-axis, not three, meaning they ahve a 3-axis accelerometer and a 3-axis gyro, which is one reason I picked these out of the varous cheap ones. They can be used for vibration and motion detection, and for position change detection, all of which I need. They also have an i2C input for a 3-axis compass but I don't need to know absolute direction, just relative. (it might be useful to have the compass to "calibrate" from but it's not required).
It also has a temperature sensor, which could be useful to know which sensor locations are "in contact with" the user, if they're snuggling with it (since this setup can only detect the change in motion, position, contacts, etc., not a continuing stable contact or touch).
It's likely that after I get done reading the dozens of pages of the spec sheet I will have some idea of what preprocessing the onboard MCU can do for me, as it already has tap detection, low-pass filters, gesture recognition, etc., so if all these things are really user programmable, then each sensor board can be told how it should respond for specific types of input, and provide specific outputs for some of the things that the first and second level MCUs then won't have to process (since those will still have to monitor the actual sensor data for relative positions, etc.)
It's mentioned in one of the sources below that there are issues in teh raw data of "yaw drift" but that the onboard MCU can use some built in processing to eliminate this problem. The same source also describes a problem I know nothing about yet called Gimbal Lock and the solution it already has built in called Quaternions that it calculates and outputs. Another source explains
The fritzing wiring diagram
and the adafruit arduino library for the chip,
as a github master code zip attached at end; it's dependencies are:
* [Adafruit BusIO](https://github.com/adafruit/Adafruit_BusIO)
* [Adafruit Unified Sensor Driver](https://github.com/adafruit/Adafruit_Sensor)
* [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library)
* [Adafruit SSD1306](https://github.com/adafruit/Adafruit_SSD1306)
and the electroniccats version
Another with tutorials
Other useful links.
This looks very useful, but I can't understand a bit of it (it's full of math)
I like the howtomechatronics because they actually show how to visualize the readings in a simple 3d live animation on the PC from data send over the serial.print command. That means taht code could probably be used to create a stick-figure wolf that could show the data from the entire skeleton (but if not, it still means it is not "that hard" to visualize what the sensors see.
the tutorial continues in a self-stabilizing platform / gimbal
that is probably also useful; it even uses the same servos I already have. (though I don't need to build such a device, the principles can be used for keeping the head steadier as the body moves, if the "wolf" is looking at something while moving. )
For those that ride with their cameras on their EVs, this device could be used to keep the image stabilized to at least some degree but as noted in the article, the servos aren't as smooth as hte motors normally used for this type of device.
Another useful article there is
is linked from the above article, and appears be a very useful site; I think most of the things I have to use are capable of i2C (the rest seem to be I2S but I'm not yet certain).
For anyone that wants to play around with these, aliexpress is the cheapest way to get a few (I think I put a link to where I got them early in the thread) but if you want them fast and buy from amazon already
Amazon.com these only cost about three times as much as AE; Iv'e bought a handful of things from HiLetGo store the last few years and had no problems with them yet. (couple of nanos, some microswitches, I forget what else).
General specs
5.1 Gyroscope Features
Digital-output X-, Y-, and Z-Axis angular rate sensors (gyroscopes) with a user-programmable fullscale range of ±250, ±500, ±1000, and ±2000°/sec
External sync signal connected to the FSYNC pin supports image, video and GPS synchronization
Integrated 16-bit ADCs enable simultaneous sampling of gyros
Enhanced bias and sensitivity temperature stability reduces the need for user calibration
Improved low-frequency noise performance
Digitally-programmable low-pass filter
Gyroscope operating current: 3.6mA
Standby current: 5µA
Factory calibrated sensitivity scale factor
User self-test
5.2 Accelerometer Features
Digital-output triple-axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and
±16g
Integrated 16-bit ADCs enable simultaneous sampling of accelerometers while requiring no external
multiplexer
Accelerometer normal operating current: 500µA
Low power accelerometer mode current: 10µA at 1.25Hz, 20µA at 5Hz, 60µA at 20Hz, 110µA at
40Hz
Orientation detection and signaling
Tap detection
User-programmable interrupts
High-G interrupt
User self-test
5.3 Additional Features
9-Axis MotionFusion by the on-chip Digital Motion Processor (DMP)
Auxiliary master I2C bus for reading data from external sensors (e.g., magnetometer)
3.9mA operating current when all 6 motion sensing axes and the DMP are enabled
VDD supply voltage range of 2.375V-3.46V
Flexible VLOGIC reference voltage supports multiple I
2C interface voltages (MPU-6050 only)
Smallest and thinnest QFN package for portable devices: 4x4x0.9mm
Minimal cross-axis sensitivity between the accelerometer and gyroscope axes
1024 byte FIFO buffer reduces power consumption by allowing host processor to read the data in
bursts and then go into a low-power mode as the MPU collects more data
Digital-output temperature sensor
User-programmable digital filters for gyroscope, accelerometer, and temp sensor
10,000 g shock tolerant
400kHz Fast Mode I2C for communicating with all registers
1MHz SPI serial interface for communicating with all registers (MPU-6000 only)
20MHz SPI serial interface for reading sensor and interrupt registers (MPU-6000 only)
5.4 MotionProcessing
Internal Digital Motion Processing™ (DMP™) engine supports 3D MotionProcessing and gesture
recognition algorithms
The MPU-60X0 collects gyroscope and accelerometer data while synchronizing data sampling at a
user defined rate. The total dataset obtained by the MPU-60X0 includes 3-Axis gyroscope data, 3-
Axis accelerometer data, and temperature data. The MPU’s calculated output to the system
processor can also include heading data from a digital 3-axis third party magnetometer.
The FIFO buffers the complete data set, reducing timing requirements on the system processor by
allowing the processor burst read the FIFO data. After burst reading the FIFO data, the system
processor can save power by entering a low-power sleep mode while the MPU collects more data.
Programmable interrupt supports features such as gesture recognition, panning, zooming, scrolling,
tap detection, and shake detection
Digitally-programmable low-pass filters
Low-power pedometer functionality allows the host processor to sleep while the DMP maintains the
step count.
5.5 Clocking
On-chip timing generator ±1% frequency variation over full temperature range
Optional external clock inputs of 32.768kHz or 19.2MHz
I'm still reading about the sensor, and how poeple have already used it, their code, etc., and collecting links and code and info (largely collected here in this post) so I haven't actually powered the breadboard up and loaded anything yet. I'm still stressed and tired from the last couple of days of exploding world sounds, etc., so I'm having troulbe processing all the stuff in my head (more than usual). Think I am gonna have another nap (whether I want to or not) soon and maybe I'll be clearer after that and can try out some of the code I've found so far just to verify functionality. I'll probalby start with this one
Arduino and MPU6050 Accelerometer and Gyroscope Tutorial
In this tutorial we will learn how to use the MPU6050 Accelerometer and Gyroscope sensor with the Arduino. I will explain how the MPU6050 works and...
howtomechatronics.com
I've attached the datasheet and register sheet for the chip on the accelerometers; I have the MPU6050 version so it only uses I2C (the 6000 has SPI as well, and can talk faster to the system MCU). The actual boards being used are labelled HW-123.
they're actually 6-axis, not three, meaning they ahve a 3-axis accelerometer and a 3-axis gyro, which is one reason I picked these out of the varous cheap ones. They can be used for vibration and motion detection, and for position change detection, all of which I need. They also have an i2C input for a 3-axis compass but I don't need to know absolute direction, just relative. (it might be useful to have the compass to "calibrate" from but it's not required).
It also has a temperature sensor, which could be useful to know which sensor locations are "in contact with" the user, if they're snuggling with it (since this setup can only detect the change in motion, position, contacts, etc., not a continuing stable contact or touch).
It's likely that after I get done reading the dozens of pages of the spec sheet I will have some idea of what preprocessing the onboard MCU can do for me, as it already has tap detection, low-pass filters, gesture recognition, etc., so if all these things are really user programmable, then each sensor board can be told how it should respond for specific types of input, and provide specific outputs for some of the things that the first and second level MCUs then won't have to process (since those will still have to monitor the actual sensor data for relative positions, etc.)
It's mentioned in one of the sources below that there are issues in teh raw data of "yaw drift" but that the onboard MCU can use some built in processing to eliminate this problem. The same source also describes a problem I know nothing about yet called Gimbal Lock and the solution it already has built in called Quaternions that it calculates and outputs. Another source explains
The MPU6050 system , because it has both an accelerometer and a gyroscope, allows the use of a Kalman filter , in other words a recursive algorithm. Since I'm not an outstanding mathematician, I don't dare to explain in detail how it works, but to put it simply, it uses gyroscope data to correct the data read from the accelerometer, thanks to which the whole thing works extremely stably. If you want, you can read about it here: Pitch & Roll Readings and the Kalman Filter
The fritzing wiring diagram
and the adafruit arduino library for the chip,
GitHub - adafruit/Adafruit_MPU6050: Arduino library for MPU6050
Arduino library for MPU6050. Contribute to adafruit/Adafruit_MPU6050 development by creating an account on GitHub.
github.com
* [Adafruit BusIO](https://github.com/adafruit/Adafruit_BusIO)
* [Adafruit Unified Sensor Driver](https://github.com/adafruit/Adafruit_Sensor)
* [Adafruit GFX Library](https://github.com/adafruit/Adafruit-GFX-Library)
* [Adafruit SSD1306](https://github.com/adafruit/Adafruit_SSD1306)
and the electroniccats version
GitHub - ElectronicCats/mpu6050: MPU6050 Arduino Library
MPU6050 Arduino Library. Contribute to ElectronicCats/mpu6050 development by creating an account on GitHub.
github.com
GitHub - jarzebski/Arduino-MPU6050: MPU6050 Triple Axis Gyroscope & Accelerometer Arduino Library
MPU6050 Triple Axis Gyroscope & Accelerometer Arduino Library - GitHub - jarzebski/Arduino-MPU6050: MPU6050 Triple Axis Gyroscope & Accelerometer Arduino Library
github.com
Other useful links.
AVR Atmega MPU6050 gyroscope and accelerometer lib + processing
Updated to version 05 The MPU-6050 has an embedded 3-axis MEMS gyroscope, a 3-axis MEMS accelerometer, and a Digital Motion Processor (DMP...
davidegironi.blogspot.com
This looks very useful, but I can't understand a bit of it (it's full of math)
SerialPort Quaternion Data Visualize
SIMPLE CODE FOR VISUALIZING QUATERNION DATA FROM IMU (Ex.MPU6050 DMP)
www.mathworks.com
Welcome to Processing!
Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…
processing.org
I like the howtomechatronics because they actually show how to visualize the readings in a simple 3d live animation on the PC from data send over the serial.print command. That means taht code could probably be used to create a stick-figure wolf that could show the data from the entire skeleton (but if not, it still means it is not "that hard" to visualize what the sensors see.
Arduino and MPU6050 Accelerometer and Gyroscope Tutorial
In this tutorial we will learn how to use the MPU6050 Accelerometer and Gyroscope sensor with the Arduino. I will explain how the MPU6050 works and...
howtomechatronics.com
the tutorial continues in a self-stabilizing platform / gimbal
DIY Arduino Gimbal | Self-Stabilizing Platform
In this tutorial we will learn how to build an Arduino Gimbal or a self-stabilizing platform with servo motors. This tutorial is actually an extension...
howtomechatronics.com
For those that ride with their cameras on their EVs, this device could be used to keep the image stabilized to at least some degree but as noted in the article, the servos aren't as smooth as hte motors normally used for this type of device.
Another useful article there is
How to Turn any DC Motor into a Servo Motor
In this tutorial we will learn how to turn any DC motor into a stand-alone custom servo motor with a lot of features.
howtomechatronics.com
is linked from the above article, and appears be a very useful site; I think most of the things I have to use are capable of i2C (the rest seem to be I2S but I'm not yet certain).
For anyone that wants to play around with these, aliexpress is the cheapest way to get a few (I think I put a link to where I got them early in the thread) but if you want them fast and buy from amazon already
Amazon.com these only cost about three times as much as AE; Iv'e bought a handful of things from HiLetGo store the last few years and had no problems with them yet. (couple of nanos, some microswitches, I forget what else).
General specs
5.1 Gyroscope Features
Digital-output X-, Y-, and Z-Axis angular rate sensors (gyroscopes) with a user-programmable fullscale range of ±250, ±500, ±1000, and ±2000°/sec
External sync signal connected to the FSYNC pin supports image, video and GPS synchronization
Integrated 16-bit ADCs enable simultaneous sampling of gyros
Enhanced bias and sensitivity temperature stability reduces the need for user calibration
Improved low-frequency noise performance
Digitally-programmable low-pass filter
Gyroscope operating current: 3.6mA
Standby current: 5µA
Factory calibrated sensitivity scale factor
User self-test
5.2 Accelerometer Features
Digital-output triple-axis accelerometer with a programmable full scale range of ±2g, ±4g, ±8g and
±16g
Integrated 16-bit ADCs enable simultaneous sampling of accelerometers while requiring no external
multiplexer
Accelerometer normal operating current: 500µA
Low power accelerometer mode current: 10µA at 1.25Hz, 20µA at 5Hz, 60µA at 20Hz, 110µA at
40Hz
Orientation detection and signaling
Tap detection
User-programmable interrupts
High-G interrupt
User self-test
5.3 Additional Features
9-Axis MotionFusion by the on-chip Digital Motion Processor (DMP)
Auxiliary master I2C bus for reading data from external sensors (e.g., magnetometer)
3.9mA operating current when all 6 motion sensing axes and the DMP are enabled
VDD supply voltage range of 2.375V-3.46V
Flexible VLOGIC reference voltage supports multiple I
2C interface voltages (MPU-6050 only)
Smallest and thinnest QFN package for portable devices: 4x4x0.9mm
Minimal cross-axis sensitivity between the accelerometer and gyroscope axes
1024 byte FIFO buffer reduces power consumption by allowing host processor to read the data in
bursts and then go into a low-power mode as the MPU collects more data
Digital-output temperature sensor
User-programmable digital filters for gyroscope, accelerometer, and temp sensor
10,000 g shock tolerant
400kHz Fast Mode I2C for communicating with all registers
1MHz SPI serial interface for communicating with all registers (MPU-6000 only)
20MHz SPI serial interface for reading sensor and interrupt registers (MPU-6000 only)
5.4 MotionProcessing
Internal Digital Motion Processing™ (DMP™) engine supports 3D MotionProcessing and gesture
recognition algorithms
The MPU-60X0 collects gyroscope and accelerometer data while synchronizing data sampling at a
user defined rate. The total dataset obtained by the MPU-60X0 includes 3-Axis gyroscope data, 3-
Axis accelerometer data, and temperature data. The MPU’s calculated output to the system
processor can also include heading data from a digital 3-axis third party magnetometer.
The FIFO buffers the complete data set, reducing timing requirements on the system processor by
allowing the processor burst read the FIFO data. After burst reading the FIFO data, the system
processor can save power by entering a low-power sleep mode while the MPU collects more data.
Programmable interrupt supports features such as gesture recognition, panning, zooming, scrolling,
tap detection, and shake detection
Digitally-programmable low-pass filters
Low-power pedometer functionality allows the host processor to sleep while the DMP maintains the
step count.
5.5 Clocking
On-chip timing generator ±1% frequency variation over full temperature range
Optional external clock inputs of 32.768kHz or 19.2MHz