Recent Posts
Arduino Or Raspberry Pi - Which System Is Better Suited For CAN Bus Projects?
Posted by
onTo 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 any kind of industrial, medical, avionic, or automotive application.
However, as a fair warning, both systems are not designed to operate beyond controlled environmental conditions, meaning they do not support an extended temperature range and they might fail when exposed to vibration (think automobiles, trucks, etc.) or high humidity. Nevertheless, both, the Arduino and the Raspberry Pi, are not just great for prototyping and hobby applications but also for projects operating under controlled conditions (e.g. home automation, office applications, Internet of Things, etc.).
In the following, I will focus on the support for Controller Area Network (CAN Bus) applications, but, first of all, let's have a look at the basic difference between the Arduino (with all its variations) and the Raspberry Pi:
- The Arduino, may it be the Uno, Due, Mega 2560, or any other variant, is a microcontroller system with no operating system. The programming is accomplished in C/C++ on your computer (PC or Mac) and then downloaded to the board. There is support through a vast number of software libraries. After all, programming the Arduino is a breeze (especially in combination with the right literature such as Programming Arduino - Getting Started With Sketches).
- The Raspberry Pi is a microprocessor-based single-board computer (SBC) that supports a variety of operating systems, the most popular being Linux. The existence of an operating system also allows the support of numerous programming languages such as Python, C, C++, Java, and some more. Most importantly, the RPi is a stand-alone system by utilizing keyboard, mouse, and an HDMI monitor.
Here are a few additional insights from a personal view:
- If you are a beginner when it comes to embedded applications, I would strongly recommend starting with the Arduino Uno. It takes literally only minutes to writing your first application.
- Working with the Raspberry Pi running Linux (Raspbian) requires working with the command line interface frequently, even though it comes with a very comfortable GUI. If you have no previous Linux/Unix experience, you will face a steep learning curve.
- If your application requires intensive data processing and display, the Raspberry Pi should be your choice. The Arduino, regardless of the variant, has limited memory resources, which are sufficient for control applications but not for data-intensive processes.
- When startup times are critical, your choice should be the Arduino. The Arduino starts up within fractions of a second, while the Raspberry Pi, depending on the RPi hardware version and the type of SD card, may take up to a minute to be ready for operation.
- Even though Linux officially supports real-time applications, be careful dedicating your real-time project to the Raspberry Pi. The internal needs of an operating system in combination with the slow SD card access might turn out to be too much of a disturbing factor.
Further Resources
Here is a list of online posts on the difference between Arduino and Raspberry Pi:
- What are the differences between Arduino and Raspberry Pi?
- What is the difference between arduino uno r3 and raspberry pi model B+?
- Which is better, Arduino or Raspberry Pi?
- What can the Arduino do that the Raspberry Pi can't and vice-versa?
CAN Bus / SAE J1939 Applications
In terms of CAN Bus or SAE J1939 applications, the choice between Arduino and Raspberry Pi requires some additional considerations:
- The Arduino is better suited for ECU applications such as reading and reporting sensor inputs. For instance, a CAN/J1939 ECU faces specific timing requirements regarding when the ECU should be operating after a vehicle power-up (we're talking in ranges of milliseconds). Nevertheless, the Raspberry Pi will do when the application's focus is merely on prototyping.
- The Raspberry Pi, due to its vast memory resources, has definitely an edge over the Arduino when it comes to CAN Bus data recording and display.
CAN Bus Interfaces for the Raspberry Pi
There is a variety of CAN Bus interfaces for the RPi, starting with support for a single CAN port up to two CAN ports, also including an extended power input range (6 VDC to 30 VDC):
- CAN Bus Interface for Raspberry Pi
- CAN Bus Interface for Raspberry Pi with SMPS (Switch Mode Power Supply)
- Dual CAN Bus Interface for Raspberry Pi
- Dual CAN Bus Interface for Raspberry Pi with SMPS (Switch Mode Power Supply)
- Dual Isolated CAN Bus Interface for Raspberry Pi
CAN Bus Interfaces for the Arduino
Here, as well, is a great number of CAN Bus interfaces for the Arduino, ranging from single to dual CAN bus interfaces for the Uno, Mega 2560 and Arduino Due. All interfaces are supported by a great amount of libraries and sample code.