One of the cool things about the Megasquirt fuel injection system is its ability to broadcast data over a CAN bus. This is exactly how OEM automotive manufacturers connect all the different vehicle control systems in modern vehicles. CAN bus provides a very flexible platform for aftermarket connectivity as well.
1st let’s quickly go over, at a high level, what CAN bus is and how it operates. CAN is a multi-master serial bus standard for connecting vehicle subsystems (e.g. a vehicle’s ECU is a subsystem or node). There’s physical aspects and software aspects. Wiring (a physical aspect) is generally a twisted pair with a 120Ω resistor at each end of the bus. This is important to note as improperly located or missing resistors will cause issues. The CAN protocol is one of the software aspects. The Megasquirt firmware uses an 11-bit protocol for basic dash broadcasting and a proprietary 29bit protocol for more in-depth communication between Mega/Microsquirt devices. For example, a Megasquirt unit controlling the engine and a Microsquirt controlling the transmission.
After soaking this information in I wanted to make use of what I feel is a very robust and reliable way to transfer data out of the Megasquirt or Microsquirt controller and display that in a useful manner. There are plenty of tablet based projects running Raspberry Pi or simply a full-blown Windows or Linux, but I like the simple aspect of no operating system in between. It’s pretty much just data out of the controller and straight to the display. No waiting for the device to boot, no crashes, no patching, etc., etc.
Unfortunately, it’s not as simple as broadcasting the CAN data out and picking it up with the display. There’s a few more pieces you’ll need. 1st you will need a CAN transceiver, this converts the CAN data in to a serial stream. For this I used an inexpensive Waveshare CAN transceiver from Amazon. Then you’ll need something to manipulate the data so your display can show it in an understandable format. I used a Teensy 3.2 microcontroller. The Teensy is an awesome little microcontroller that works with Arduino programming software. Finally, you will need the display device itself. I ended up using the Nextion 3.2” touch screen display. I like the Nextion as it offloads a lot of the processing load of the display from the microcontroller and is very easy to program, plus it is a touchscreen.
As you can see there’s going to be a few items with learning curves if you’ve never touched this stuff before. But the Arduino IDE and Nextion software are very easy to learn. This was my very first project with all of it!
Project in action. This is a simple video showing some of the different aspects of the operation.
Visually still a work in progress, but this will help you get an idea of what you can do. You’ll find that the graphics are by far the item you’ll spend the most time on.
Here is the full parts list (Amazon links support our site, thank you!):
- Nextion 3.2″ TFT Display
- Waveshare CAN transceiver
- Teensy 3.2 Arduino compatible micro-controller
- Microsquirt v3 cased
- Nextion_CAN_Logger_Green <– Arduino IDE Code
Stay tuned for Part 2, 3 Nextion displays in a custom enclosure.