Additional Information

Site Information

 Loading... Please wait...

Blog

SAE J1939 Programming with Arduino - Arduino Code (Sketch)

Posted by Wilfried Voss on

This post is part of a series about SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino.

SAE J1939 ECU Programming & Vehicle Bus Simulation with Arduino

The Arduino code is quite simple and virtually self-explanatory. However, let me lose a few words on the program’s structure.

First of all, depending on the CAN Bus shield used for this programming sample, please make sure you set the proper CS (Chip Select) for the CAN Bus controller as described in module can.cpp (See also my remarks in the chapter about the CAN-BUS Shield by Seeed Studio).

In the main program module J1939_Data_Traffic_simulation I defined two messages, msgVehiclePosition and msgAmbientConditons, and filled them with random data.

In the main loop I use the delay function to create a one-second timer by means of the variable nCounter. The content of nCounter triggers the transmission of the corresponding messages.

The actual program code is fairly simple:

Note: This Arduino project is available through the download page at ARD1939 - SAE J1939 Protocol Stack for Aduino.


A Comprehensible Guide to J1939

SAE J1939 has become the accepted industry standard and the vehicle network technology of choice for off-highway machines in applications such as construction, material handling, and forestry machines. J1939 is a higher-layer protocol based on Controller Area Network (CAN). It provides serial data communications between microprocessor systems (also called Electronic Control Units - ECU) in any kind of heavy duty vehicles. The messages exchanged between these units can be data such as vehicle road speed, torque control message from the transmission to the engine, oil temperature, and many more.

A Comprehensible Guide to J1939 is the first work on J1939 besides the SAE J1939 standards collection. It provides profound information on the J1939 message format and network management combined with a high level of readability.

Read more...

Beginner-Friendly Collection Of Electronics Projects Using The Low-Cost Arduino Board

The Arduino Project Handbook is a beginner-friendly collection of electronics projects using the low-cost Arduino board. With only a handful of components, an Arduino, and a computer, you will learn to build and program everything from light shows to arcade games to an ultrasonic security system.First, you will get set up with an introduction to the Arduino [...]

Read More »


CAN Bus Prototyping With Arduino Uno - Extended CAN Bus Shield Test

This post is part of a series about Controller Area Network (CAN Bus) Prototyping With the Arduino Uno.In this next, extended example, we use the same program as shown in the previous chapter but add a CAN receiving routine to it. The result, i.e. the received messages, will be displayed through the Arduino serial monitor.// Simple CAN Shield Test#include [...]

Read More »


CAN Bus Prototyping With Arduino Uno - Simple CAN Bus Shield Test

This post is part of a series about Controller Area Network (CAN Bus) Prototyping With the Arduino Uno.The most exciting part about this project is when it comes to the point where two CAN nodes communicate with each other. I started off with writing a simple program that sent messages that were received by my USB-to-CAN gateway and its [...]

Read More »