What
This project is a wireless “heading reference system” that tracks alignment, and a Processing sketch that visualizes it. My particular version of this gets the volume too and changes the visualization based on that. It’s based on an Arduino Nano, a Pololu IMU (the AltIMU-10), a cheap serial bluetooth module, and an electret mic breakout, with Processing doing the visualisation.
Parts
- SparkFun Electret Microphone Breakout (gives 0v-5v DC-offset signal readable straight from Arduino analogue in) ~$8
- Pololu AltIMU-10 (Gyro, Accelerometer, Compass, and Altimeter module) ~$20
- HC-06 Serial Bluetooth module ~$7
- Arduino Nano (or clone) ~$10
Hardware
Software
All Arduino code and Processing code is available on GitHub at https://github.com/neonascent/3d_sound_tracking
Arduino
The code I used for filtering and sending the heading data is based on Pololu_Open_IMU by mikeshub modified to send at the slower 9600 baud supported by the bluetooth, and with the volume reading code added. I originally tried to use Camel Software’s Quaternion-based AHRS using AltIMU-10 & Arduino, but found – like others – that it crashed the nano when trying to read EEPROM (although Camel Software says this has now been fixed).
With my code:
- Install the LPS, L3G, and LSM303 Arduino libraries included Arduino/Libraries folder (or on GitHub for L3G Arduino library, LSM303 Arduino library, and LPS Arduino library)
- Run calibrate_mag Arduino sketch, open serial monitor, move the device around and take note of final min and max values.
- Open Pololu_Open_IMU sketch, and modify all the compass min and max values (e.g. “#define compassXMax …”) according to what you got from calibrate_mag.
- Upload, run, open serial monitor and make sure you are getting output such as “!ANGLE:0.1,1.52,0.4,125”
Processing
- Install the Toxiclibs Processing library included in Processing/Libraries folder (used for handling quaternions)
- Pair to your bluetooth module on your computer, and take not of the address. On a Mac this will be something like “/dev/tty.HC-06-DevB” and on a windows machine it will look like “COM42”.
- Update the line with the correct bluetooth port name, and run.
Questions or suggestions?
Please comment below with questions or thoughts. How did your implementation go? Maybe you have some improvements.
Camel
Sep 1, 2014 -
Hello,
Just thought I’d mention the Quaternion based AHRS has been fixed now.
Cheers!
Josh Harle
Jan 22, 2015 -
Camel: Good to hear, thanks!
Hackaday Links: September 7, 2014 | Hackaday
Nov 12, 2014 -
[…] [Josh] built a 3D tracking display for an IMU. It takes data off an IMU, sends it over Bluetooth, and displays the orientation of the device on a […]