Lately, I had looked into the topic of Electronic Logging Devices (ELD). An ELD is electronic hardware that is attached to a commercial motor vehicle engine to record driving hours. The driving hours of commercial drivers (truck and bus drivers) are regulated by a set of rules known as the hours of service (HOS).
An ELD monitors a vehicle’s engine to capture data on whether the engine is running, whether the vehicle is moving, miles were driven, and duration of engine operation.
In order to develop an ELD you need:
- An embedded system with a powerful processor (such as the Arduino Due) to process the information.
- A CAN Bus (OBD-II or SAE J1939) connection to read the required data (such as our Dual CAN Bus Interface for Arduino Due with extended power range).
- A GPS sensor to determine the vehicle's position.
- A Real-Time Clock (RTC) to mark certain events (such as duty status changes).
Note: For a list of SAE J1939 and SAE J1708/j1754 parameters needed for electronic logging devices, see my post Electronic Logging Devices (ELD) – SAE J1939 And SAE J1708/J1587 Parameters.
The idea behind this design is using the Arduino Due as a basic data gathering and processing device that ultimately transfers the information to an Android-based tablet per Bluetooth connection. The tablet, in turn, displays the information through a sophisticated GUI, and it also handles the transmission of reports per e-mail or text message (which is yet another ELD requirement).
I will address the CAN and Bluetooth connection as well as the Android tablet functionality in another post. Right now, my focus is on integrating a GPS sensor and a Real-Time clock into the Arduino Due.
The solution was more than just easy, since I found a very effective breakout module that combines both functions, GPS and RTC, in one board:
Our UART GPS Module With Real-Time Clock features the NEO-7M-C chip onboard, a high-gain active antenna, an IPX interface for connecting different active, external antennas, and a chargeable backup battery, which keeps the ephemeris data when power down and supports hot starts.
- TTL level, compatible with 3.3V/5V systems
- Baud rate 9600 only
- Operating voltage: 2.7V-5.0V (VCC input)
- Operating current: 35mA
- TXD/RXD impedance: 510Ω
Usage on the Arduino Due
- VCC: connects to 3.3V/5V
- GND: connects to GND
- TXD: connects to RX1
- RXD: connects to TX1
Arduino Due Sketch
Reading and displaying the GPS and Real-Time information is as easy as connecting the breakout board to the Arduino Due. In fact it's so simple that I won't even post the source code for download.
In this example, I am using the RX1/TX1 connection, which is accessed through the Serial1 class. And of course, any of the other serial ports will be as adequate. The result of reading the data is forwarded directly to the Serial Monitor, since the information is entirely in ASCII text:
This output, however, is where most of the work lies ahead, i.e. decoding the received the information. This is nevertheless fairly easy to accomplish with the following information, the so-called NMEA output sentences, at hand:
NMEA Output Sentences
GGA—Global Positioning System Fixed Data. Time, Position and fix related data
GSA—GNSS DOP and Active Satellites
GSV—GNSS Satellites in View
RMC—Recommended Minimum Navigation Information
I have not added code yet that converts the ASCII information into data processed by the Arduino Due. This will be, after all, highly application-specific.
First of all, my apologies for a "misleading" title that included the term "J1939 Shield." I picked the topic after noticing increased search traffic for the term. In all consequence, there is no real J1939 Shield but an Arduino CAN Bus Shield with supporting J1939 protocol stack software.As a matter of fact, there a several [...]
Basically, there are two scenarios where a CAN Bridge application is of use:1. Connecting two separate CAN Bus networks.2. Network length extension.While the first scenario is more or less self-explanatory, let's look a little closer into the network length extension: The physical CAN network length depends primarily on the CAN baud rate, i.e. the higher [...]
Just about everyone who is involved with serial communication will have his/her RS232 to USB converter. Today's PCs don't even bother to support RS232. Consequently, a USB converter is mandatory to monitor RS232 data traffic. All this appears to render the following project obsolete. However, when it comes to a protocol converter, i.e. the conversion [...]
When working on a CAN bus or SAE J1939 project, it can be extremely helpful when the expected CAN Bus data traffic can be simulated rather than connecting your system to a running vehicle or automation control. The following project does exactly that with little effort for designing CAN data frames and their frequency. As [...]
The Arduino Due is a microcontroller board based on the Atmel SAM3X8E ARM Cortex-M3 CPU. It is the first Arduino board based on a 32-bit ARM core microcontroller. It has 54 digital input/output pins (of which 12 can be used as PWM outputs), 12 analog inputs, 4 UARTs (hardware serial ports), a 84 MHz clock, [...]
First of all, let me point out that this post is merely about monitoring SAE J1708/J1587 data traffic, i.e. the mere reading of data frames. SAE J1708, the hardware layer, is based on RS485, however, with a small hardware modification that allows message collision detection and prevention. In the following, I am using an RS485 [...]
It seems to be an obvious statement, but there are many applications for the Arduino Due that require high-speed communication in a range that goes beyond regular UART baud rates, i.e. several Mbits/sec. Naturally, USB comes to mind, but surprisingly there are some obstacles when it comes to accessing the Arduino Due's USB ports. The [...]
To say it upfront, the choice between the Arduino platform and the Raspberry Pi is primarily a personal matter, depending on factors like knowledge of programming and programming languages, preferences for operating systems, and, after all, hardware knowledge. Both system architectures, while being very different from each other, provide vast software and hardware support for [...]
In a previous post ( Arduino Due: Dual CAN Port Test Sketch), I demonstrated how to read and write the two CAN ports on the Arduino Due. The post explains that the two CAN ports on the Arduino Due are practically useless without their respective CAN transceivers. CAN transceivers convert a regular TTL signal from the CAN controller [...]