I am new to Arduino and I am looking for some help with my current project. I have an arduino uno, the spark fun can bus shield (https://www.sparkfun.com/products/10039) and a Motec M400 ECU powering a car. The ECU has a built in CAN bus which I would like to use to read messages from the ECU with the arduino and display them on an LCD display. I would like to display certain parameters such as speed, rpm, etc on the LCD readout. How should I go about doing this?
I have wired the CAN Bus of the ECU to the the can bus shield and I have connected the shield to my arduino but I don't have any code to test the setup.
I am going to need some code that will read the CAN messages from the ECU and then some code to display these messages on the LCD.
Where should I start, is there a sketch I could use to start reading CAN messages from my ECU?
The problem is that this seems to be for an OBD2 car. I am connecting to a third party ECU. Where could I get some code that would simply monitor the CAN bus to see what messages are being received?
I have a document from Motec that defines the message structure. You'll mostly need this once you have got you arduino code to read basic CAN messages etc.
On the M400 you need to define the data sets 1 & 2, then configure it to send the data set(s) to CAN device on address XXX. The format can be one of "CRC32", "compound", or "squential". The doc I have describes these three formats and also give hints as to the data scaling, injector time might be in units of micro seconds etc.
Also download the Motec SDL3 (or ADL etc) software as this has the "templates" for read the CAN data and will list the scaling such as data width (8 v16 bit) whether its signed etc etc.
If you think the motec doc is of interest, let me know where to email to...
I've tried almost exactly what you wanted, using a sparkfun canbus shield and an uno to read M800 msgs. I had the problem of missed can msgs. I'm guessing it's because the uno just isn't fast enough. Considering Uno runs at 16Mhz, SPI to the shield is at 4mhz and the can bus itself is 1mhz. This doesn't leave a lot of time for processing msgs. Then again, it might be because of my crappy code. I'm currently trying the Due which has a cpu clock of 84mhz and has a onboard can controller which eliminates the SPI bottleneck but it's slow progress...
Hi James
Since reading this thread, its renewed my interesting in using the M400 CANbus.
Im using the mbed NXP LPC1768 which running at 96Mhz seems to be able to keep up with the M400 as long as the "data set" is too large.
Using the Motec CRC32 format which basically send a seq of N + data items/4 CAN frames, you need a complete set of frames to be able to decode data set and validate the CRC.
Im going to investigate the other Motec formats (sequencial and compund) as with these each frame contains enough infomation to decode the application data, even if the odd frame is "lost". Its amazing to thing that this Motec ECU must be 10+ old technology, but still manage to pack a lot of fast (efficient processing in )
Im sure someone with better coding skills than me could easily make the mbed keep up with the Motec CAN stream, but for my projects I can get away with "sloppy" code running on a over the top fast processor...
Anyway, would be interested to hear how you get on with the faster model Arduino and maybe swap notes at some point.
Heres a brief list of what I have managed to do wrt M400 CAN so far:
Decode CRC32 data and write it to local flash (tested with Motec sending 12channels at 100Hz)
Send data in to the Motec M400 in Compound format (eg as per an ADL etc)
Just a tip for when youre testing this out, try sending the Motec Runtime channel. Its basically a timer running in units of 0.1seconds. If the Motec is sending a dataset at a rate of 100Hz, you should see every 10 datasets received have the same value for the Runtime data item. You can vary the dataset rate from 33-200Hz on the Motec.
I am glad I decided to check back to this post, nice to know others are trying the same type of project. Cat7 I could really use the document you are talking about, I will PM you my e-mail.
I will be trying my luck this weekend so I will report back with any findings.
Hi there, we are trying to build the telemetry of our electric car. We transmit the data (digital signal) using two inalambric Arduino. The second Arduino is connected to the computer using an USB. Our problem is that we don“t know how to separate the data we receive. We thought that this could be done with Motec, but we are new to this programme. If anyone knew the answer to our question, it would be great. THANK YOU VERY MUCH