MPU 6050 Absolute Orientation #371
Replies: 2 comments 1 reply
-
Tom, Thanks for sharing this! The Beta v1.3.2 hardware and the current v2 hardware all use the MPU6050, so this modification will work on these versions - basically any blue STEM Payload or Main PCB. Thanks for sharing the sample code - I'll give it a try next week hopefully. Your code looks like it would display the yaw, pitch, and roll in an APRS packet, but those values would be interpreted as gyro readings by FoxTelem and displayed incorrectly. However, we could treat this modification as if it were a new sensor, and follow the Adding New Sensors method. We would set the three gyro and three accelerometer readings to zero, but add three more sensor values to the end so that the sensor string might be like:
These three values would then show up in FoxTelem in Sensor1, Sensor2, and Sensor3 values under Experiments, and the max and min would also be displayed. We might need to change the code looping slightly. The Pi Zero only reads the sensor string from the Pico about once per second. I'm not sure how frequently your loop will occur with the interrupts. We might need to service the interrupt separately from the loop to print the sensor string to Serial1. If we can get it to integrate smoothly, I can add the Pico GP6 trace in the future so this could be implemented without soldering. Again, thanks for sharing this mod! Alan |
Beta Was this translation helpful? Give feedback.
-
Hi Tom, I've been trying this out, and I discovered that it works fine without wiring up the Interrupt pin. You still need to set up the interrupt as your sample code did, but if you just read the DMP data when you need it, it seems to work. Here's a UF2 file you can try to flash onto your Pico (https://github.com/alanbjohnston/CubeSatSim/wiki/2.-Software-Install#software-installation) which adds back the MPU gyro and accel data, with the yaw, pitch, and roll after the YPR string. at the end It is sent as Sensor 1, Sensor 2, and Sensor 3 so it displays in FoxTelem under Experiments. I changed the angles to 0 -360 degrees so that it can be a number 0-4096. https://cubesatsim.org/download/Payload_BME280_MPU6050_O.ino.rpipicow.uf2 Alan |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The CubeSatSim, at least 1.3beta uses an MPU6050 as an orientation sensor.
The current set up and code just gets the accelerometer and gyrometer data, however the MPU6050 is capable of sensor fusion to give absolute yaw, pitch, and roll. [1]
This simplifies certain operations but unfortunately it requires the INT (Interupt) pin to be wired to the Pi Pico. This pin is not currently routed on the board, but is a straightforward mod.
Pin 9 on Pico is unused and is on the correct side of the header to use.
With the correct library and some sample code you can read the sensor and output that from the Pico into the telemetry.
This may break FoxTelem decoding, but it should just work as a modification if you're using APRS output.
Beta Was this translation helpful? Give feedback.
All reactions