- What is a CAN bus?
- How a CAN bus works
- CANopen vs. J1939 and OBD2
- The main benefits of CAN bus
- How to use CAN bus for machinery management
- Problems with CAN data decoding
- CAN bus advantages for agriculture
Smart devices and processes using the Internet of Things (IoT) technology have disrupted many industries including the agricultural industry. The connected agriculture market amounted to $1.8 billion in 2018 and is already at $3.35 billion in 2019. It is expected to register a compound annual growth rate (CAGR) of 17.08% from 2020 - 2025, and the market forecast is $6.99 billion by 2025.
The population is rapidly expanding and so is the need for food. Forecasts call for the global population to reach 9.6 billion by 2050 and with that, the demand for food will increase. The modern agricultural industry has to cope with numerous challenges from both nature and man that cause inefficient agricultural production.
Smart farming uses various IoT devices to increase agricultural production at a lower cost and allow farmers to cope with challenges such as climate change, extreme weather conditions, and environmental impact. Livestock and inventory monitoring, field observation, and vehicle tracking are just a few examples of what you can do with IoT farming. Smart agriculture systems also help farmers use water and other resources efficiently and optimize inputs.
In the late 20th century, tractors, harvesters, and other mechanical innovations were introduced in every corner of the earth. Those machines are getting smart too, which creates a problem of communication. Lack of a constant and reliable communication network infrastructure in remote or less-developed regions makes it difficult to implement IoT solutions or get timely updates or repairs. However, satellite connectivity and expending cellular networks can help.
One of the ways to optimize costs for agricultural machinery and processes is to use data provided by the agricultural machines. And one effective and tech-savvy solution is to get that data with the help of Controller Area Network (CAN) bus IoT technology.
What is a CAN bus?
All about Circuits defines a Controller Area Network (CAN) as “a serial communication bus designed for robust and flexible performance in harsh environments, and particularly for industrial and automotive applications.”
Originally it was invented by Bosch and later it was codified into the ISO 11898-1 standard. CAN was adopted in 1993 (ISO 11898) as an international standard. In the Open Systems Interconnection (OSI) model, CAN defines the data link and physical layer of high-speed in-vehicle communications between separate electronic control units (ECUs) inside a vehicle using only a single pair of wires.
Today CAN is widely used in trucks, buses, industrial vehicles, industry automation, ships, and planes. CAN system will be relevant for a long time and is already actively used with Internet of Things technologies and in autonomous vehicles.
One of the main goals of a CAN bus in cars is to allow any ECU to interact with the entire system of the vehicle without causing overload to the controlling computer.
How a CAN bus works
Using a simple analogy, a CAN bus functions like the spinal cord in a human body It receives and transmits signals from vehicle body parts to its brain. It connects electronic control units (in a modern car there can be up to 70 such units) with the entire system of a vehicle and its controlling computer.
What do CAN messages look like? Standard CAN uses an 11-bit identifier for different messages, which comes to a total of 211, i.e. 2048, different message IDs. Later CAN was modified to use the identifier expanded to 29 bits, so the extended CAN has 229 identifiers. A CAN system uses a multi-master bus where all messages are broadcast on the entire vehicle network. The priority of a message is provided by identifiers.
The signal used in CAN is a differential one with two logic states – recessive and dominant. A recessive state shows that the differential voltage is less than a minimum threshold voltage. Accordingly, the dominant state means the differential voltage is greater than this minimum threshold. The dominant state is achieved by driving a logic '0' onto the bus, while the recessive state is achieved by a logic '1.' Thus CAN logic is inverted from the traditional high and low setup used in most systems.
CAN bus protocol allows for four different message types:
- Data frame
- Remote frame
- Overload frame
- Error frame
The messages sent over the network can be broken down as shown in the figure below.
There are 8 key parts of a CAN message:
- SOF (Start of Frame) is a “dominant 0” which represents the start of a CAN message and tells the other ECUs that a message is coming.
- CAN ID contains the message priority and functional address (e.g. wheel speed, RPM, etc.). The smaller the identifier, the higher the priority of the message.
- RTR (Remote Transition Request) allows ECUs to “request” messages from other ECUs. Normally this bit is dominant, but it goes recessive when one node (ECU) is requesting data from another.
- Control part informs the length of the data in bytes (0 to 8 bytes).
- Data part contains the actual data values, which need to be converted to be readable and useful for analysis.
- CRC (Cyclic Redundancy Check) is necessary for checking data integrity. It is a 16-bit checksum for detecting errors in the transmitted data.
- ACK (acknowledge bit) slot indicates if the CRC process is OK, that is if the message is properly received, the receiving node overwrites the recessive acknowledge bit (ACK) with a dominant bit. To keep things synchronized the ACK also contains a delimiter bit.
- EOF (End of Frame) marks the end of a CAN message.
But only 3 fields are interesting for us: the CAN ID, the Control and the Data. And typically CAN bus decoders and various CAN bus decoder software show them only in CAN bus data output. The CAN standard does not specify how to handle messages larger than 8 bytes or how to decode raw data. To define further how data is communicated between ECU and a given network there exists a set of higher-level standard protocols. The most widely-known standards are SAE J1939, OBD-II, and CANopen.
CANopen vs. J1939 and OBD2
CANopen protocol is widely used in industrial automation applications. It is the internationally standardized (EN 50325-4) CAN-based higher-layer protocol for embedded control systems.
CANopen networks are used in a very broad range of application fields, such as machine control, medical devices, off-road and rail vehicles, maritime electronics, building automation, power generation, etc.
The CANopen protocol defines basically two aspects of the communication protocol:
how the communication should be formatted (CANopen frame), and what objects are defined in common. Those objects may be used to configure or arbitrate the communication, or simply to exchange application data.
Communication objects are available to:
CANopen protocol is based on CAN frames and uses one CAN frame for each CANopen message. There are two important parts of the frame that the user needs to modify: the arbitration field and the data field. The rest of the fields of the frame are automatically configured by the CAN hardware.
J1939 is a higher-layer protocol using the Controller Area Network (CAN) as a physical layer, which provides serial data communications between microprocessor systems (ECUs) in any kind of heavy-duty vehicles. It is a standard in-vehicle network developed by the Society of Automotive Engineers (SAE) for buses, trucks and other heavy-duty vehicles.
J1939 data parameters (vehicle speed, rpm, etc.) are identified by Suspect Parameter Number (SPN) further grouped into parameter group numbers (PGN) containing 1+SPNs. Thus CAN messages from vehicles can be scaled and decoded into readable data using parameter tables from the J1939 standards.
Onboard diagnostics (OBD) is a vehicle's diagnostic and reporting system that allows it to troubleshoot problems via diagnostic trouble codes (DTCs). At the lowest level, the system uses a signaling protocol, which in most cases is CAN.
OBD-II standard specifies the number of DTCs, which can be retrieved by CAN logger or other diagnostic tools from any vehicle.
OBD-II supports data on many real-time parameters (e.g. fuel consumption, vehicle speed, etc.) and can be used for real-time vehicle telematics or post-analysis using CAN data loggers. To obtain OBD-II data the CAN logger must “request” data by submitting pre-specified CAN frames with specific parameter IDs to the CAN bus.
The OBD-II standard specifies the type of diagnostic connector and its pinout, the electrical signaling protocols available, and the messaging format. It also provides a candidate list of vehicle parameters to monitor along with how to encode the data for each.
The main benefits of CAN bus
There are obvious reasons why a CAN bus network is popular with automakers and IoT solutions providers:
- Low cost. ECUs communicate via a single CAN interface – there are no analog signal lines, and this reduces errors during communication and weight of vehicle units thus making the cost lower.
- Centralized communication. CAN communication protocol allows for central error diagnostics and configuration of all vehicle ECUs.
- Robust communication. CAN bus communications are electromagnetic interference proof and are not sensitive to subsystem failures, which is very important for vehicles used in harsh conditions, for example, harvesting in very hot weather.
- Efficient code management. CAN messages are prioritized based on IDs – the highest priority IDs are non-interrupted. This is extremely important for timely vehicle maintenance or repair.
- Flexibility. In every ECU there is a chip that enables the unit to receive transmitted messages, decide its relevance, and act in accordance with the message. This makes the system customizable and allows adding extra nodes, such as CAN bus data loggers
How to use CAN bus for machinery management
All current vehicles, including agricultural vehicles and field equipment, are equipped with CAN bus. Tractors, combines, and other powered vehicles use it to connect multiple individual electronic control units and exchange sensor and control big data. Electronics make equipment “smarter” and state-of-the-art IoT solutions for the agricultural industry open a wide range of possibilities to make farming more efficient and productive.
The CAN bus is a source of data that can help to save resources and use equipment more effectively and effectively. CAN bus based solutions can provide high-precision machinery performance and logistics and are useful both for equipment manufacturers and users.
What problems can be solved with the help of CAN bus based solutions? There are lots of them. For example, using the data from a CAN bus. you can get information about a problem in a certain node of your equipment or get a reminder about imminent maintenance, thus you can get spare parts in advance and decrease interference time as sometimes waiting for specialized service can be time-consuming.
You can get the data on the amount of grain your harvester has collected and the amount it unloaded, or know what amount of seed was used by seeding-machine and average seed flow rate to prevent losses and ensure optimal use of resources. You can get vehicle fuel consumption data and be able to adjust in a more economical way.
In other words, such solutions can:
- track operational parameters
- analyze obtained data
- provide notifications and tips for effective equipment use.
The main benefits are cost optimization, optimization of field efficiency (partly owing to decreased dead time), and fuel consumption optimization, to name a few.
Problems with CAN data decoding
Decoding CAN bus messages can present a certain challenge for IT solution developers as OEM usually do not reveal their proprietary codes. The team of developers must include a specialist who knows how to read CAN bus data and is experienced in data decoding. The data obtained from the data bus must be processed carefully. Otherwise, there is a risk of creating erroneous results. However, it is a feasible problem for a team of pros provided they have access to the equipment and vehicles the solution is intended for.
CAN bus advantages for agriculture
There is a great reason to adopt IoT agriculture if you haven’t done it yet. The source of valuable data – the CAN bus – is already in your vehicles, so you can take a chance to get even more of your equipment making it really “smart”. CAN bus technology enables advanced machinery management – data ingested by obtaining and importing information from the multiple sensors allow efficient use of vehicles and resources, ensure swift action, and lower costs. Seamless end-to-end intelligent operations and improved operational processes allow you to produce more and leverage the equipment you already have.
Write to us at firstname.lastname@example.org if you seek innovation and opportunities to make your farming business smart, and we can find a solution together.