Driving mechanical speedo from CAN
-
- Posts: 1
- Joined: Mon May 20, 2024 6:43 am
Driving mechanical speedo from CAN
Is it possible to take the rpm CAN message from a motor controller, feed that to some device and then have that device spit out a 0-5v signal?
I want to use that output to control a little DC motor controller to turn a little motor connected to the speedometer cable in my truck.
I want to use that output to control a little DC motor controller to turn a little motor connected to the speedometer cable in my truck.
- johu
- Site Admin
- Posts: 6618
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 341 times
- Been thanked: 1484 times
- Contact:
Re: Driving mechanical speedo from CAN
Welcome
An arduino can hack it. You'd not use 0-5V but rather PWM as that is more common.
When creating new threads use a descriptive title. I've changed it for you

An arduino can hack it. You'd not use 0-5V but rather PWM as that is more common.
When creating new threads use a descriptive title. I've changed it for you
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
- muehlpower
- Posts: 679
- Joined: Fri Oct 11, 2019 10:51 am
- Location: Germany Fürstenfeldbruck
- Has thanked: 14 times
- Been thanked: 133 times
Re: Driving mechanical speedo from CAN
There are ready-made solutions for 400€ - 600€ from dakota digital or speedhut. An Arduino with a stepper motor should work. The speed could be a problem, as you need up to approx. 3000 rpm.
- Uppertown
- Posts: 69
- Joined: Wed Dec 09, 2020 10:57 pm
- Location: North East England
- Has thanked: 118 times
- Been thanked: 34 times
Re: Driving mechanical speedo from CAN
This place has a stepper motor that should do;muehlpower wrote: ↑Mon May 20, 2024 10:13 am An Arduino with a stepper motor should work. The speed could be a problem, as you need up to approx. 3000 rpm.
https://www.omc-stepperonline.com/12v-3 ... ch=42blr53
and a controller for it
https://www.omc-stepperonline.com/digit ... ch=bld-510
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Driving mechanical speedo from CAN
Why not use the speedo internal drive lines to drive the speedo from PWM directly. When you get CAN signal you process this to calculate vehicle speed. This depends on RPM and wheel size.ramiroflores wrote: ↑Mon May 20, 2024 6:57 am Is it possible to take the rpm CAN message from a motor controller, feed that to some device and then have that device spit out a 0-5v signal?
I want to use that output to control a little DC motor controller to turn a little motor connected to the speedometer cable in my truck.
Sample for my Teensy VCU code:
Code: Select all
void Speedo()
{
//if (timer100_4.check() == 1)
// {
calcspeed = (motorRPM / ratio) * tireD * 3.14 * 60 / 1000; // speed = wheelsRPM * tireD * PI * 60 / 1000 Km/h
calcHz = calcspeed * 1.4; // correction factor
if (calcHz >= 0) {
calcHzi = calcHz;
}
else { //the same in reverse
calcHzi = calcHz * (-1);
}
tone(OUT7, calcHzi); // function to move the dial
//analogWriteFrequency(OUT7, calcHzi);
// }
}
- Uppertown
- Posts: 69
- Joined: Wed Dec 09, 2020 10:57 pm
- Location: North East England
- Has thanked: 118 times
- Been thanked: 34 times
Re: Driving mechanical speedo from CAN
I'm guessing the OP has a cable driven mechanical speedo rather than an electronic one?
-
- Posts: 3554
- Joined: Mon Dec 24, 2018 1:37 pm
- Location: Slovenia
- Has thanked: 131 times
- Been thanked: 330 times
- Contact:
Re: Driving mechanical speedo from CAN
Sure!
Then you need one DC motor and halfh bridge for 12V. AND you need to test how much RPM you need from the motor for full dial.
I am thinking one simple DC motor https://www.aliexpress.com/item/3285606 ... ry_from%3A
Motor driver that responds to PWM
https://www.aliexpress.com/item/1005005 ... ry_from%3A
https://www.aliexpress.com/item/1005002 ... ry_from%3A
Or you could simply replace speedo and install new sensor to the driveshaft
https://www.aliexpress.com/item/1005006 ... ry_from%3A
Re: Driving mechanical speedo from CAN
Hmm, how accurate would that dc motor be over time? At least with a stepper (and possibly a gearbox) you can control the speed directly - and know that it's consistent.
- muehlpower
- Posts: 679
- Joined: Fri Oct 11, 2019 10:51 am
- Location: Germany Fürstenfeldbruck
- Has thanked: 14 times
- Been thanked: 133 times
Re: Driving mechanical speedo from CAN
There is a smaller driver for this motor. 5A is sufficient. It can also be controlled via RS485, then everything is digital and aging and temperature do not matter.Uppertown wrote: ↑Mon May 20, 2024 11:21 am This place has a stepper motor that should do;
https://www.omc-stepperonline.com/12v-3 ... ch=42blr53
https://www.omc-stepperonline.com/de/di ... w-bld-405s
- nubster
- Posts: 111
- Joined: Sat Oct 29, 2022 7:20 pm
- Location: Los Angeles
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: Driving mechanical speedo from CAN
How would one go about driving the Speedhut speedometer via Openinverter?muehlpower wrote: ↑Mon May 20, 2024 10:13 am There are ready-made solutions for 400€ - 600€ from dakota digital or speedhut. An Arduino with a stepper motor should work. The speed could be a problem, as you need up to approx. 3000 rpm.
The manual for the Orion MPH variant indicates it's expecting speed on PID 0x257 with an internal scaling of 0.1 and the units in MPH.
Is it just a matter of calculating the ratio of your motor RPM to your MPH, multiplying by 10 to account for the internal gauge scaling, and entering that as the gain in the CAN mapping?
For example:
A Tesla SDU has a 9.34:1 gear ratio and can rev to 18,000 RPM.
18,000 / 9.34 = ~1,927 Wheel speed
MPH = Wheel RPM × Tire diameter × π × 60 / 63360
So for me: 1,927 x 24" x π x 60 / 63360 = 137.59 MPH (top speed)
18,000/137.59 = 0.0076439:1 (RPM to MPH ratio)
So, would I enter 0.0764 as the gain in the "speed" spot value CAN mapping?
According to the wiki, floating point numbers are allowed as of FW v5.27, but how many decimal places are supported? How would/can you achieve this pre-v5.27? Am I way overthinking??

Car/EV enthusiast, maker, builder, engineer, and lifelong student.
Owner | Founder: Westside EV
YouTube Channel
Owner | Founder: Westside EV
YouTube Channel
- muehlpower
- Posts: 679
- Joined: Fri Oct 11, 2019 10:51 am
- Location: Germany Fürstenfeldbruck
- Has thanked: 14 times
- Been thanked: 133 times
Re: Driving mechanical speedo from CAN
I have an Arduino in my CAN system. This makes it easy to convert any speed information from CAN or anywhere else and output it at the correct address with the correct scaling.
- nubster
- Posts: 111
- Joined: Sat Oct 29, 2022 7:20 pm
- Location: Los Angeles
- Has thanked: 56 times
- Been thanked: 16 times
- Contact:
Re: Driving mechanical speedo from CAN
Are you using the Motor RPM/SPEED CAN message from the Openinverter board to determine your road speed on the Arduino?muehlpower wrote: ↑Thu Jun 27, 2024 10:24 am I have an Arduino in my CAN system. This makes it easy to convert any speed information from CAN or anywhere else and output it at the correct address with the correct scaling.
Car/EV enthusiast, maker, builder, engineer, and lifelong student.
Owner | Founder: Westside EV
YouTube Channel
Owner | Founder: Westside EV
YouTube Channel
Re: Driving mechanical speedo from CAN
An off the shelf GPS module puts out a 0-5VDC signal in direct proportion to actual vehicle speed.
I am using the one in the ANT P/S steering control module to also drive the electronic speedometer, using the formula speed = voltage x 50.
You would likely need a simple current amplifier to run a motor that will run the mechanical speedo, but you would retain the odometer function (I loose it it my set-up)
I am using the one in the ANT P/S steering control module to also drive the electronic speedometer, using the formula speed = voltage x 50.
You would likely need a simple current amplifier to run a motor that will run the mechanical speedo, but you would retain the odometer function (I loose it it my set-up)
Re: Driving mechanical speedo from CAN
I think we're getting close to the same result but in different ways.
I take the inches per mile and divide it by the tire circumference . That gives me the number of rotations per mile which I multiply by the gear ratio of 9.34 which gives me the number of motor rotations per mile. In my case:
63,360 / 80 = 792 rotations per mile
792 * 9.34 =7397.28 Which I round up to three significant digits getting 7400 rotations per MPH.
Which at 60 miles an hour seems about right.. 1 mile per minute.
nubster the number you show in your calc is the MPH to RPM ratio..
so the question is which number goes in the scaling? the RPM to MPH or the MPH to RPM?
I presume its the former..
I'm still trying to get the gauges to communicate. Anyone know if they need a termination resistor? There's nothing else in the system but the drive unit and the gauges.
UPDATE yes a termination resistor fixed it.
I take the inches per mile and divide it by the tire circumference . That gives me the number of rotations per mile which I multiply by the gear ratio of 9.34 which gives me the number of motor rotations per mile. In my case:
63,360 / 80 = 792 rotations per mile
792 * 9.34 =7397.28 Which I round up to three significant digits getting 7400 rotations per MPH.
Which at 60 miles an hour seems about right.. 1 mile per minute.
nubster the number you show in your calc is the MPH to RPM ratio..
so the question is which number goes in the scaling? the RPM to MPH or the MPH to RPM?
I presume its the former..
I'm still trying to get the gauges to communicate. Anyone know if they need a termination resistor? There's nothing else in the system but the drive unit and the gauges.
UPDATE yes a termination resistor fixed it.