Black box data logger for heavy vehicles/trucks

Black box for trucks. Log GPS position, speed, 3D accelerometer/gyro, temperature, wind speed/direction, CANBUS data to SD card. Radio COMS

Similar projects worth following
Black box for trucks. Log GPS position, speed, 3D accelerometer/gyro, temperature, wind speed/direction, CANBUS data to SD card. Radio COMS. Blackbox contains GPS, 32GB micro SD card, separate Bluetooth, ultrasonic wind speed/direction sensor, WiFi and 2.4Ghz radios, GSM/GPRS modem to send text messages. Uses low cost readily available breakout boards for various functions. PCB has small prototyping area to allow for future expansion/additions.

On power up the SiLabs C8051F380 main micro communicates over two lines with the ATMEGA micro which opens up a text file on the SD card which contains instructions as to how the data logger is to operate.

The file contains information on what phone number(s) to send text messages to, the rules about when to send text messages (truck speeding , battery needs charging, etc.) and a unique 64 character truck ID descriptor.

Data logged is GPS time, position, speed, bearing, date, raw 3D accelerometer and gyro data, outside air temperature, truck CAN bus data, wind speed/direction and spares for future update (humidity, barometric pressure, etc.).   A Bluetooth dongle is connected to the vehicle's OBDII connector and CAN bus data is extracted from the vehicle via Bluetooth.  On average one "record" of 256 bytes of data is save to the 64Mbit flash memory every 1.3 seconds in ASCII comma delimited CSV format.  This format allows for easy import to EXCEL or viewing with any text editor.    

A sample of one 256 byte record of data:                

021207,3542.3160,17417.7103,000.30,307.01,140817,-00415, 00151, 00089,-00056, 00050,-00007, 023.87,0000,00000,000,0000,011.23,070,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000     <--- (note - CAN bus data not being recorded yet, in progress)

When 512 records have been saved to the flash memory (approximately 11 minutes worth), the data is sent to the ATMEGA micro-controller which in turn saves it to a FAT32 format text file with a file name that specifies the date/time the file is created, vehicle ID and trip number.   Data is appended once every 11 minutes until the date changes and the file name changes.

Whenever the vehicle stops for more than the specified amount of time (specified in the instruction file - 30 seconds or so) the logger tries to contact the base station via the 2.4Ghz radio transceiver.  If it is able to connect all the data from the flash memory (a maximum of about 10 hours worth) is sent to the base station and the flash memory is erased.  The 32GB SD card files are never erased and can hold over 5 years of data.

To save power the main micro has the ability to switch ON or OFF most of the subsystems such as the GPS, 2.4Ghz radio transceiver, etc.  Power is applied to each individual subsystem only when required.

When the vehicle stops moving for more than a specified amount of time (30 minutes or so), the main micro shuts off power to all the subsystems except the real-time-clock chip and the 3D accelerometer/Gyro.  The main micro switches itself into a low power mode by using a lower clock frequency.  This saves battery power.   The main micro monitors the the 3D accelerometer/gyro to detect when the vehicle has started to move again and powers up the required subsystems (GPS, wind sensor,  etc.).

The code in the C8051F380 main micro controller is written in a mix of C and 8051 assembly using the Raisonance RIDE C compiler/assembler.  The program is flashed into the C8051F380 using the SiLabs Integrated Development Environment (IDE) software.


N3T Truck Black Box Data Logger PCB Documentation

Adobe Portable Document Format - 33.55 kB - 10/06/2017 at 18:29



N3T Truck Black Box Data Logger Schematic

Adobe Portable Document Format - 67.76 kB - 10/06/2017 at 18:22


  • 1 × GPS GTPA010 9600 baud serial output with built-in patch antenna
  • 1 × WiFi EXP8266 WiFi with TCP/IP
  • 1 × Bluetooth transceiver HC-05 bluetooth transceiver communicates with bluetooth OBDII dongle to capture CAN bus data
  • 1 × 3D Acellerometer, 3D Gyro GY-521 breakout board with I2C comms (Uses MPU6050 chip)
  • 1 × Real-time clock chip DS1337 RTC with I2C comms

View all 15 components

View all 19 project logs

  • 1
    Assembling the data logger PCB

    The N3T data logger PCB is assembled using both surface mount components and thru-hole parts.  The surface mount components are assembled using a solder paste stencil, Juki 740 surface mount placement machine and reflow oven.  The thru-hole parts are manually added/soldered afterwards.    A short video of the Juki 740 assembling (a different PCB) can be seen here:  

View all instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates