Can bus gps speedometer

Hello. Newbie with arduino. So woundring if someone can help me. I got an old 1980 Mazda 626 that I have put a Mazda RX8 engine and cluster in. Everything in the cluster is working from can bus to the engine ecu, so rpm, water and oil pressure works. But the Speedometer is not working because this is getting info from the abs ecu. The one thing that I don't have. So my question is, is it possible to use a arduino with a can bus shield and gps module to broadcast the speed over can bus?

Thanks Joakim

But the Speedometer is not working because this is getting info from the abs ecu.... is it possible to use a arduino with a can bus shield and gps module to broadcast the speed over can bus?

It is technically possible to get speed from a GPS module, but it's not very accurate, especially at low speeds. (I wrote NeoGPS, a GPS library that is faster and smaller than other libraries, and can be configured to parse just the speed field, saving even more RAM and program space.)

You can perform filtering in the software to smooth out the speed values. You could also increase the accuracy by using an IMU to sense vehicle motion. Sensing wheel rotation would be most accurate, but I assume there is a drive shaft rotation tick that you are supposed to use. Is there?

I'm sure it is technically possible to broadcast that speed over a CAN bus, but you would have to figure out if the listener (speedometer display?) will accept the "injected" speed values.

Cheers, /dev

Thanks for reply. So you think it's better to use a hall sensor and a trigger at the rear axle? I got a Volvo 240 rear axle, and they got a 48 tooth trigger at the rear axle. Is it possible to use this insted for the gps? Then it will work as long the triggerwheel is rotating.

Original the speed is broadcast over can bus from the abs ecu.

This guy have done a great job finding the adress the speed is broadcasted at the can bus. http://www.madox.net/blog/projects/mazda-can-bus/

Best regards Joakim

Although quite familiar with CAN Bus, I'm not very good with cars - I prefer bikes ;). Saying that, have you verified if you can read the speed from the ODB-2 bus? Many cars would have multiple CAN Buses and if you can get the speed from the ODB-2, you might be able to have a node "listening" for it on this Bus and Re-broadcasting it back into the Bus where the cluster is connected to.

You just going to need a dual CAN Bus setup and a MCU to read, probably convert the message, and re-send it. The speed in the ODB2 protocol is very likely to be a different format from the one on the other bus (https://en.wikipedia.org/wiki/OBD-II_PIDs).

In case you car has a single Bus, shared with the ODB2, you should be able to do all of it with a single CAN Bus setup, which waits for the ODB2 speed message, converts it and re-inject into the Bus.

Another option is to create the "speedometer" node from scratch. As you suggested, just build a node capable of reading speed - normally a hall sensor on a rotating axel (like a bike sensor). First make sure you can get the speed right, and print it on a serial monitor - rear wheels might be better. After you have this first part working just need to "encode" the speed back to the format the Mazda cluster is expecting and broadcast it into the Bus.

Whatever you do, just make sure you don't flood the bus with "speed" information, which is probably less important than other ECU messages. Find the minimum rate needed for the Cluster to display the speed and keep like that ;)

Does all of that makes sense?

One more thing, I would suggest to build everything using a micro-controller, but for debugging and building phase, a RPI with a CAN Bus HAT is very handy, capable of easier read and injecting messages on the Bus.

Cheers!

Thanks, so which Micro-controller should I use? And is it not possible to use the RPI with the can bus as permanent setup?

I think I'm going to use the hall sensor on the rear axle then. I can connect that to the can bus shield analog input then, and program so it reads the correct speed as it reads the triggerwheel?

Thanks for answers.

Joakim

Hi @malach,

The RPI + CAN Bus Hat is good for debugging in my opinion because it offers some nice CAN Bus commands to see and send messages, but at the same time there are too many things which could go wrong there... the OS, start-up time, flash corruption, full disk, etc. Using an MCU instead, is much more stable - the right tool for the job I would say.

Regarding the MCU, you could use an Arduino with a CAN Bus shield... or if you prefer, and are familiar with, you could use an SMT32 Nucleo Board (like this one http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-nucleo/nucleo-f103rb.html). Many ARM MCUs already have one or two CAN controllers built-in, you just need the transceiver.

For reading the speed, you could use a digital input, not analog... maybe using interrupt so every time the magnet aligns with the HAL sensor, you have a "pulse"... Measuring time and counting the pulses would give you the RPMs, and with that it's easy to calculate speed (wheel radius, PI, etc).

Cheers

Thank you for answers. I have now ordered a Arduino and a can bus shield.

Somebody know if I can use a regular abs sensor with 2 wire to use as a pickup for the trigger?

Joakim