Kinetis Drone: Sensor Fusion Toolbox
The drone building project continues by adding sensors and a microcontroller
Join the DZone community and get the full member experience.Join For Free
Flying a quadrocopter without some sensor and microcontroller intelligence will be a challenge. Definitely I will need some intelligent sensor data to help me out :-). Luckily, there is a Freescale ‘Sensor Fusion Toolbox’ and Library which gives me a nice start and visibility into the sensors I plan to use:
Sensor Fusion Data
The Freescale FRDM-K22F board already has the Freescale FXOS8700CQ on it which is a combined magnetometer+accelerometer. There is the FRDM-STBC-AGM01 which has the same FXOS8700CQ on it, plus the FXAS21002 gyroscope:
FRDM-K22F with FRDM-STBC-AGM01
There is as well a smaller board available, just what is inside the ‘white’ box of the FRDM-STBC-AGM01 board. Basically the same board, smaller, and without the Arduino headers.
Freescale has that really cool ‘Sensor Toolbox’ to explore these sensors:
- Go to the Sensor Fusion Webpage (www.freescale.com/sensorfusion) and download the Sensor Fusion Fusion Toolbox.
- Install the Sensor Fusion Toolbox.
- Have the ‘mbed’ OpenSDA v2.1 (not P&E or Segger) firmware running on the FRDM-K22F board, so the board shows up as MBED disk drive and shows up with an ‘mbed Serial Port’: mbed Serial Port
- Run the Sensor Fusion software
- Select the file I want to load to the board: Flash to Board
- Browse to the MBED disk drive and save the file there: Saving to MBED disk drive
- It should confirm that everything was going well. Follow the steps to unplug and re-plug the board: Success programming the board
- Select the mbed serial port or use ‘Auto Detect’ button: Sensor Fusion Toolbox Port Detection
- The Board RGB LED should be blinking in Green, and the COM port detected/set, with showing the board: COM Port Detected
- Rotate the sensor/board to calibrate the magnetometer: Calibrated Magnetometer
- Now I can move the board, and it will follow/show this on the screen: Board Moving
Sometimes I had a problem that the wrong board was shown or it was stuck. Unplugging the board and restarting the toolbox helped.
Same thing works in combination with the FRDM-STBC-AGM01 board:
Sensor Fusion with FRDM-STBC-AGM01
The toolbox shows Sensors, Dynamics, Magnetics and Kalman information:
Sensor Fusion Data
The web page on www.freescale.com/sensorfusion hosts a library with Kinetis Design Studio projects (Sensor Fusion Library for Kinetis MCUs). I was able to use the V5 or the library with the Kinetis Design Studio V3.0.0. The projects emit over the UART-2-USB OpenSDA bridge data to the sensor toolbox. So that way I can build and debug the demo applications which come as binary files with the Sensor Toolbox, and can use the projects as a starting or inspiration point for my sensor data processing.
Some of the demos in the Library have an issue described in “Eclipse Project ‘Refresh Policy’: Broken Incremental Build with External Make?“. Additionally, I have found that some debug/launch configurations are either missing or incorrect, so it is necessary to fix this before the projects can be used.
What makes the demos and application outstanding is that they are using Processor Expert: that way they are easy to use, configure and build.
Sensor Fusion Project for KL25Z
The Freescale Sensor Toolbox gives me a great start and feeling for the sensors. Now the challenge will be to have the quadrocopter using it. The Sensor Fusion library has some out-of-the box challenges, but for anyone familiar with Eclipse ;-) that’s not a blocking point. So in my next steps I plan to join the drivers in to my application.
Happy Sensing :-)
- Freescale Sensor Fusion: www.freescale.com/sensorfusion
- Sensor Fusion Library: Sensor Fusion Library for Kinetis MCUs
- Freescale FRDM-K22F Board: http://www.freescale.com/products/arm-processors/kinetis-cortex-m/k-series/k2x-usb-mcus/freescale-freedom-development-platform-for-kinetis-k22-mcus:FRDM-K22F
- Freescale FRDM-STBC-AGM01 Board: http://www.freescale.com/tools/embedded-software-and-tools/hardware-development-tools/freedom-development-boards/frdm-stbc-agm01-9-axis-inertial-measurement-sensor-board:FRDM-STBC-AGM01
- Link to the project on GitHub:https://github.com/ErichStyger/mcuoneclipse/tree/master/Examples/KDS/FRDM-K22F/FRDM-K22F_Drone
- mbed for FRDM-K22F: https://developer.mbed.org/platforms/FRDM-K22F/
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.