Driving mechanical speedo from CAN

Introduction and miscellaneous that we haven't created categories for, yet
Post Reply
ramiroflores
Posts: 1
Joined: Mon May 20, 2024 6:43 am

Driving mechanical speedo from CAN

Post by ramiroflores »

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.
User avatar
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

Post by johu »

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
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
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

Post by muehlpower »

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.
User avatar
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

Post by Uppertown »

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.
This place has a stepper motor that should do;

https://www.omc-stepperonline.com/12v-3 ... ch=42blr53

and a controller for it

https://www.omc-stepperonline.com/digit ... ch=bld-510
arber333
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

Post by arber333 »

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.
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.
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);
// }
}
I then create another function which will drive transistor to move the needle. My dash speedo will move in response to variable frequency. This is harder to reach than simply command variable PWM at fixed frequency like RPM dials.
User avatar
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

Post by Uppertown »

arber333 wrote: Mon May 20, 2024 11:49 am Why not use the speedo internal drive lines to drive the speedo from PWM directly.
I'm guessing the OP has a cable driven mechanical speedo rather than an electronic one?
arber333
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

Post by arber333 »

Uppertown wrote: Mon May 20, 2024 12:19 pm I'm guessing the OP has a cable driven mechanical speedo rather than an electronic one?
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
Zieg
Posts: 339
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 142 times
Been thanked: 138 times

Re: Driving mechanical speedo from CAN

Post by Zieg »

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.
User avatar
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

Post by muehlpower »

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
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.
https://www.omc-stepperonline.com/de/di ... w-bld-405s
User avatar
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

Post by nubster »

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.
How would one go about driving the Speedhut speedometer via Openinverter?

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
User avatar
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

Post by muehlpower »

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.
User avatar
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

Post by nubster »

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.
Are you using the Motor RPM/SPEED CAN message from the Openinverter board to determine your road speed on the Arduino?
Car/EV enthusiast, maker, builder, engineer, and lifelong student.

Owner | Founder: Westside EV
YouTube Channel
espriev
Posts: 57
Joined: Mon Jan 02, 2023 5:32 pm

Re: Driving mechanical speedo from CAN

Post by espriev »

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)
leftcoast
Posts: 5
Joined: Wed Oct 26, 2022 5:15 pm
Been thanked: 1 time

Re: Driving mechanical speedo from CAN

Post by leftcoast »

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.
Post Reply