Can I use spot value "TURNS" for km trip counter?

Post Reply
User avatar
joromy
Posts: 371
Joined: Fri Jun 28, 2019 12:56 pm
Has thanked: 1 time
Been thanked: 3 times

Can I use spot value "TURNS" for km trip counter?

Post by joromy »

Now I use the RPM received from CAN, for kmh and km trip counter, with the display unit (Teensy 4)

But It's not accurate.
Could I use the TURNS value?
How high does it count, before rollover?

I would need it to go to about 300.0km (one decimal would be nice)
Thomas A. Edison “I have not failed. I've just found 10,000 ways that won't work"
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Can I use spot value "TURNS" for km trip counter?

Post by Peter »

Hello joromy. I use 'TURNS' for trip. So far no issues but only done a few miles as yet. To see if the max value of 'TURNS' was feasible I used number of 'TURNS' over a fully charged battery range (50 miles) based on my gear ratios and tyre revs per mile. Save trip value to EEPROM at power down or when value changes after maths to keep 'saves' down. Recall EEPROM value at power up and add to that to continue. Hope that helps. Peter
User avatar
joromy
Posts: 371
Joined: Fri Jun 28, 2019 12:56 pm
Has thanked: 1 time
Been thanked: 3 times

Re: Can I use spot value "TURNS" for km trip counter?

Post by joromy »

Thanks for the info.
If I understand it correct, this would be the way to calculate it?

Wheel is 218cm (0,00218km) for one rotation
Gear ratio is 12.518:1

Code for km travel would be TURNS * ‭1.741492251158332e-4‬
Or for m travel TURNS * 0.174
Thomas A. Edison “I have not failed. I've just found 10,000 ways that won't work"
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Can I use spot value "TURNS" for km trip counter?

Post by Peter »

Hi joromy Suggest you run motor at fixed rpm for a minute and check TURNS to see value first. In my setup TURNS were exactly half the rpm per minute. i.e. 1000rpm for 1 minute gave me a TURNS value of 500.
Isaac96
Posts: 656
Joined: Sat Oct 05, 2019 6:50 pm
Location: Northern California, USA
Been thanked: 1 time
Contact:

Re: Can I use spot value "TURNS" for km trip counter?

Post by Isaac96 »

Peter wrote: Sun Jun 28, 2020 4:56 pm Hi joromy Suggest you run motor at fixed rpm for a minute and check TURNS to see value first. In my setup TURNS were exactly half the rpm per minute. i.e. 1000rpm for 1 minute gave me a TURNS value of 500.

That sounds strange... Is your 'numimp' for the encoder set correctly? I will do the same test (tomorrow) and see what I get...

-Isaac
User avatar
johu
Site Admin
Posts: 5769
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1010 times
Contact:

Re: Can I use spot value "TURNS" for km trip counter?

Post by johu »

Just checked, it takes "respolepairs" into account, even when using encoder. Set respolepairs to 1 and the weirdness will be gone.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Peter
Posts: 310
Joined: Fri Dec 14, 2018 9:07 pm
Location: North West Lancs, UK
Been thanked: 8 times

Re: Can I use spot value "TURNS" for km trip counter?

Post by Peter »

Hi Johannes. Thank you for your input with the weirdness. If we increase the respolepairs value higher to reduce the value of TURNS for our purpose will it affect anything else? Thanks in advance. Peter
User avatar
johu
Site Admin
Posts: 5769
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1010 times
Contact:

Re: Can I use spot value "TURNS" for km trip counter?

Post by johu »

Well there are. In fact respolepairs MUST be set to 1 in order to work with an encoder in firmware 4.85.R. Just realized that now! Good thing is, it defaults to 1
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply