We often get user requests for a way to datalog movement as well as GPS position, but did not have a proper DIY solution other than saying that they need to implement a few sensors and define a protocol to get all the information stored to a storage solution. Then we looked around since we knew our
Lynxmotion Quadrino Nano UAV & Drone Flight Controller features all the needed sensors to achieve just that and found renes and his multiwiDataLogger project on GitHub. His project fits the need to perfection and it does not require any special MultiWii configuration and therefore can also be used for people who use the Quadrino Nano as a flight controller.
To understand this tutorial you need to be familiar with the Arduino IDE and be comfortable with basic hardware manipulations such as connecting things together. This portion will not be covered in this blog.
Items needed:
|
|
|
|
|
|
Lynxmotion Quadrino Nano |
SparkFun OpenLogger |
Arduino Serial Adapter |
Noob SD Card |
Jumper Wires |
Right Angle Header |
1 - Soldering the OpenLogger
The OpenLogger arrives without any pins and/or wires attached to it. In order to connect it to something, you will need to get pins or wires soldered to the PCB. Since this is not a tutorial about how to solder we will only show you how we made the connection on our unit. All six pins need to be populated as we need to upload a new firmware to the board. We decided to make the pins face inward to have a more compact final module but this partially hides the pins silkscreen. It is therefore up to you to choose the way you want it.
|
|
OpenLogger Pins Front |
OpenLogger Pins Back |
2 - Connecting OpenLogger to the Serial Adapter
The OpenLogger already comes with a firmware which will log anything sent on its serial ports, however, the MultiWii firmware will not send any information unless it is requested by a device. This is why we need to load a new firmware to the OpenLogger that will request the information and log it.
This device is made to connect directly to any FTDI Port on an Arduino so the TX/RX pins are already exchanged. In order to reprogram it, you have to connect the FTDI / Serial adapter the right way by inverting the connection for proper TX / RX connection.
|
|
|
OpenLogger Side |
OpenLogger All |
OpenLogger Serial Adapter |
Note: If using the Arduino USB2SERIAL adapter, make sure to install the drivers manually as the manufacturer recommendation listed under
Drivers & Setup.
3 - Loading the OpenLogger with the Firmware
To load the firmware you will need the
multiwiiDataLogger project files as well as the latest
Arduino IDE.
- Unzip the project (complete as it is in the zip file)
- Open the "datalogger.ino" file (all other files should open as "tabs" in Arduino IDE)
- If you use the original multiwiiDataLogger files, you need to set the chipSelect pin to 10 in "cardlogger.ccp"
- Connect your OpenLogger / Serial Adapter to the computer
- Select the Arduino UNO board
- Select your own COM Port
- Click on the "Upload" button
|
|
|
|
|
|
|
Unzip Files |
Open Project |
Set chipSelect |
USB Connection |
UNO Board |
COM Port |
Upload |
4 - OpenLogger Connection to the Quadrino Nano
To connect the OpenLogger to the Lynxmotion Quadrino Nano you will need one of the
UART / Serial cables (provided with the Quadrino Nano). It doesn't matter which of the two ports you choose on the controller as the MultiWii software is made to use any of them which will use the right protocol.
|
|
|
|
Quadrino Nano UART |
SparkFun OpenLogger |
OpenLogger Side |
Quadrino Nano Side |
5 - Setup and Insert the SD Card
Make sure the SD card is formatted (usually in FAT32) and insert it in your OpenLogger.
|
|
OpenLogger SD Out |
OpenLogger SD in |
6 - Acquire some Data
That's the easy part, if you have everything connected only powering the Quadrino Nano by USB or standard with the ESC port the OpenLogger should start writing data on the SD card.
7 - Open and Read Data
The files are created in CSV files and five individual files will be in the log folder.
rc.csv
- logs the input from the remote control
- Format: millis;roll;pitch;yaw;throttle
- values from 1000 to 2000 according to a normal RC receiver, e.g. 1500 = stick centered,
imu.csv
- logs the raw data from the sensors.
- Format: millis;accX;accY;accZ;gyroX;gyroY;gyroZ
angle.csv
- logs the calculated angle.
- Format: millis;X;Y;heading
- values for X and Y are -1800 to 1800 in 1/10 degrees, heading is from -180 to 180 in degree
gps.csv
- logs gps data.
- Format: millis;hasGPSFix;nunberOFSats;lat;lng;altitude;groundSpeed
- hasGPSFix: 0 = no, 1 = yes, lat,lng: in 1 / 10 000 000 deg, altitude: meter, groundSpeed: cm/s
We started development of the fifth log which can get the GPS Time and Date but this is not yet implemented. It requires some changes in the MultiWii code to first retrieve the information from the GPS which is not the case at the moment and then include this information in the standard MultiWii protocol. The current code is requesting the info to MultiWii but MultiWii discards it as it's not part of the default protocol.
GPS_TIME.CSV
- log gps date and time.
- Format: millis;raw week;time of week
8 - Using multiwiiDataLogger
The multiwiiDataLogger will create a new folder at each power-up (LOG_X)
Our current version is a slightly modified version which includes some LED behavior for troubleshooting. This was not present in the original code.
Blue Status LED
- 3 Blinks - Initialization
- Fast Blink - SD Card Error (no card)
- Slow Blink - Communication with MultiWii
Green LED
Open the CVS's
There are many ways to open CVS files one of which is to simply import them from a Google Spreadsheet with the divider " ; " and you will be able to see the data. The use of OpenOffice or
Microsoft Excel is also a good option.
|
|
|
|
RC.CSV |
IMU.CSV |
ANGLE.CSV |
GPS.CSV |
Now that you have all these logs, you can use your own application to graph them. If you do implement them into a custom application we would like to see the end results and also feel free to use the code as you wish to improve and add more functionality.
Special thanks to Sebastian Charette for improving the MultiWii and multiwiiDataLogger code.