Difference between revisions of "Data Logger"

From PaparazziUAV
Jump to navigation Jump to search
 
(32 intermediate revisions by 10 users not shown)
Line 1: Line 1:
[[Image:sd_spi.jpg|thumb|µSD card connected to SPI]]
=Introduction=
This describes an external device that can be connected to the Paparazzi autopilot to store telemetry data to a mass storage medium on board the aircraft, e.g. an SD card (only non-SDHC cards). For now this is not done with the autopilot itself as the usage of a file system as well as possible lag you might get with a SD card (erase times) does not fit well with the real time nature of the used software scheduler.


== Mode of operation ==
This page describes various '''onboard''' external devices called a "Data logger", that can be connected to the Paparazzi autopilot.  
The logger is connected to the ap and stores all telemetry on a micro SD card when power is connected. At the end of the flight a button is pressed just before disconnecting the main battery to stop logging (other ways of stopping that are underway, e.g. by telemetry message from the gcs or a battery buffered voltage-drop detection). When logging is stopped and the USB is connected the logger acts as USB mass storage device and the micro SD card content can be read with any PC supporting FAT file system. The telemetry data is converted to the standard .data and .log file with a Paparazzi tool. Logging can be started again through a long press of the button if USB was not connected.


== Hardware ==
Such a Data Logger device can be used to store telemetry data to a storage medium on board the aircraft. Such a storage medium can be an SD card or a Flash chip.  Logging can eventually be done by the autopilot itself if it is using a (RT)OS and can eventually handle a file system without interfering with the control and navigation tasks.
We decided to use the well known LPC2148 to do the logging although it is probably bored most of the time. That allows to use the Paparazzi configuration/tool chain and have a standard USB connection for read out with any PC. Remember that micro SD cards do have a limited number of insertions and should not be plugged too often. There are some efforts to start a dedicated logging board (preferred color: orange) but for now a TWOG is used. The (micro) SD card is connected to the SPI1 of the Tiny following this scheme:


microSD        TinyV2 SPI J3
Note that not all loggers accept SD HighCapacity(SDHC) cards as storage
  8 nc
  7 DO            5 MISO
  6 GND          1 GND
  5 CLK          7 SCK
  4 Vcc          2 +3V3
  3 DI            4 MOSI
  2 CS            3 SSEL
  1 nc


Looking onto the gold plated connector side of the microSD card:
=Why Onboard=
  ###############
  I 8
  I 7
  I 6
  I 5
  I 4
  I 3
  I 2
  I 1
  ######    ##
        \  I  \
        ##    ##


The start/stop button is connected to the BUTTON (P0.7) pin of the USB connector (J9). It is activated by pulling it low. It has to be pressed to close the file and be ablöe to read the data! The USB should be connected after the logger is stopped to prevent going into download mode.
One would naturally first ask; why on on-board logger when we have data over the air?


LED3 on:        logging enabled, press button to stop
The answer to this is multi-fold; Sometimes it is not possible to log everything over the air because of speed, lag and volume limitations of data send wireless over the air. Or one needs to log when there is no telemetry at all in long distance flight. Or one want to log all the RAW IMU data to debug specific scenarios.
LED2 flashing:  writing message to SD
LED3 flashing:  logging stopped, connect USB to read out data or press button long to restart logging
LED1 on:        USB mass storage enabled


== UART Connection ==
To solve this issue, there are various loggers that can be connected to your Paparazzi Autopilot board.
The two serial inputs LPC_RXD0 (J7) and RXD1 (J2) are used to receive data. The received data is not forwarded to TX0/1 by software (the UART TX pins are deactivated). If the logger is put in between Tiny and the modem the connection should be done with a wire so that a logger failure does not cause any data link issue.


== I2C Connection ==
=Available Data logger options=
tbd


== Configuration ==
There are numerous logging solutions, both with their pro's and con's; here the options:
The logger is defined just like an aircraft. Take the  


conf/airframes/logger_sd.xml
==* [[SDLogger_SPI_Direct|SD Logger SPI Direct]]==
==* [[Micro_logger|Micro Logger]]==
==* [[file_logger|File Logger (Parrot Drones)]]==
==* [[Apogee/v1.00#On-board_Data_Logging|On-board data logger for Apogee autopilot]]==
==* [[Openlog|Openlog]]==
==* [[twoga-Logga|TWOGA-Logga]]==
==* [[twoglogdedicated|An dedicated TWOG board for logging]]==


as example. You can enable one or both UARTs and have to set the serial speed
=Storage format=


#set the speed
A more unified method of storing data on the logger, [[Messages_Format#Telemetry_storage_format_for_data_logger|info available here]]
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B9600 -DUSE_UART0_RX_ONLY
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B9600 -DUSE_UART1_RX_ONLY


The message type can be switched between the PPRZ and the XBEE format
[[Category:Hardware]] [[Category:Software]] [[Category:User_Documentation]]
 
#choose one
ap.CFLAGS += -DLOG_XBEE
#ap.CFLAGS += -DLOG_PPRZ
 
== Decoding ==
The telemetry is written in the Paparazzi .tlm [[Messages_Format|format]] that adds a timestamp to each message. The logger starts with 00000000.TLM in the main folder of the SD and increases the number with each log session. Already used numbers will not be overwritten. This data can be converted back to the Paparazzi .log and .data format using sd2log
 
me@home:~/media/usbstick$ ~/paparazzi3/sw/logalizer/sd2log 00000002.TLM
Renaming produced file ...
09_08_13__20_55_03_SD.data file produced
09_08_13__20_55_03_SD.log file produced
09_08_13__20_55_03_SD.tlm file saved
 
It creates timestamps from the .tlm and changes the filename to the take off time if a GPS message with correct time was available in the file or the current local PC time if no GPS was available. The original airframe/flight-plan definition files need to be there (md5sum based recovery: tbd).

Latest revision as of 03:48, 25 January 2018

Introduction

This page describes various onboard external devices called a "Data logger", that can be connected to the Paparazzi autopilot.

Such a Data Logger device can be used to store telemetry data to a storage medium on board the aircraft. Such a storage medium can be an SD card or a Flash chip. Logging can eventually be done by the autopilot itself if it is using a (RT)OS and can eventually handle a file system without interfering with the control and navigation tasks.

Note that not all loggers accept SD HighCapacity(SDHC) cards as storage

Why Onboard

One would naturally first ask; why on on-board logger when we have data over the air?

The answer to this is multi-fold; Sometimes it is not possible to log everything over the air because of speed, lag and volume limitations of data send wireless over the air. Or one needs to log when there is no telemetry at all in long distance flight. Or one want to log all the RAW IMU data to debug specific scenarios.

To solve this issue, there are various loggers that can be connected to your Paparazzi Autopilot board.

Available Data logger options

There are numerous logging solutions, both with their pro's and con's; here the options:

* SD Logger SPI Direct

* Micro Logger

* File Logger (Parrot Drones)

* On-board data logger for Apogee autopilot

* Openlog

* TWOGA-Logga

* An dedicated TWOG board for logging

Storage format

A more unified method of storing data on the logger, info available here