Recent Posts
Arduino J1939 Shield For Data Traffic Simulation And Vehicle Application Development
Posted by
onFirst 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 ways integrate an SAE J1939 protocol stack, depending on the type of Arduino board. On one side there are the Arduino Uno and Mega 2560, and on the other the Arduino Due with its ARM Cortex-M3 processor - Things are always different with the Due. Nevertheless, the Arduino Due is my preferred choice when it comes to ease of programming combined with great performance.
J1939 Development with the Arduino Uno and Mega 2560
We at Copperhill Technologies have created CAN Bus programming and development kit that includes the Arduino Uno CPU board with CAN Bus Shield, and it is complemented by a book "Controller Area Network Prototyping with Arduino" plus sample programs. And yes, there is also a J1939 protocol stack available, which I will reference in the following.
The book guides the reader through the process of acquiring all necessary hardware and software components, i.e. the jARDCAN system, the implementation of the CAN driver, and the implementation of programs (Arduino Sketches) to read, send, process, and display data from and to a CAN network.The collection of programming examples cumulates into a full-fledged USB-to-CAN Gateway communicating with a Windows/Linux PC.
The book, in combination with the Arduino CAN Bus kit, will enable you to achieve CAN functionality literally within only a few hours.
The topics include:
- Introduction to Controller Area Network
- Prototyping Hardware and its Variants
- Arduino CAN Shields
- CAN Driver Implementation and Library Functions
- Simple CAN Test Programs
- CAN Network Monitoring, Simulation, and Diagnostics Program
- CAN Data Display via Windows/Linux GUI
All sample programs are available as a free-of-charge download at the jARDCAN product page.
But coming back to the topic of J1939, the development of a J1939 protocol is actually not a big deal for an experienced programmer, the only obstacle being that you have to spend some good money on the official document, the SAE J1939 Standards Collection. I have been through the process, and I deem my code as good as any commercially available protocol stacks. And yes, I have successfully tested my code against a number of commercially available J1939 devices.
The (pre-compiled) code is also available as a free download at the product page of our book "SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino" - You don't need to buy the book to use the code, but it explains the functionality in detail.
For more information on the SAE J1939 protocol stack, see also our post "ARD1939 - SAE J1939 Protocol Stack for Aduino".
J1939 Development with the Arduino Due
The ARD1939 code, as described for the Arduino Uno and Mega 2560, itself is directly compatible with the Arduino Due, however, the Arduino Due CAN Bus driver software required some modifications. Basically, I needed to adjust the CAN Bus function calls to the same functionality as used for the Uno and Mega 2560. And yes, that code is also available as a free download at SAE J1939 Protocol Stack Sketch for Arduino Due.
However, let's also have a look at the hardware, because besides the Arduino Due you will also need a CAN Bus shield, and it's not the same as for the Arduino Uno or Mega 2560. The Due's ARM processor already comes with two integrated CAN controllers, which are, however, in need of CAN transceivers to be able to communicate with a CAN or J1939 vehicle network.
We have developed a few solutions and one of them might match your requirements:
- Arduino-Based ECU Development Board With Dual CAN Bus Interface
- Dual CAN Bus Interface For Arduino Due
- Dual CAN Bus Interface For Arduino Due With Extended Power Range
As I mentioned before, I recommend getting our book "SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino", which explains the functionality in detail.
Simulating J1939 Data Traffic
All solutions as explained here, may it be the Arduino Uno, Mega 2560, or Due, will provide you the means to monitor and even simulate SAE J1939 data traffic. However, in order to establish a communication in absence of a real-world diesel engine, you would need two such devices, one to simulate traffic, and the other receiving and processing the information.
For a more convenient method of programming a data traffic simulation, we have created our SAE J1939 ECU Simulator Board With USB Port. The board is supported by our jCOM1939 Monitor, an SAE J1939 Monitoring, Analyzer and ECU Simulation software under Windows.
The jCOM1939 Monitor Software is the perfect tool to monitor, analyze, and simulate SAE J1939 data traffic. The system combines our jCOM.J1939.USB that functions as an SAE J1939 to USB (or UART) gateway. A comprehensive and easy-to-use, easy-to-understand Windows software displays not only SAE J1939 data traffic; it also allows to scan the network, simulate an ECU (incl. full node address negotiation features), and respond to data request messages.