Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Truck Speedometer algorythm
#1
Hi, I need to create a speedometer programming on Python so I can work it on a raspberry to an LCD display.

I have:

1.- Vehicle speed sensor and circuit to convert the ppms into voltage.
2.- voltage chart (Vo)

I need:
1.- Give each Vo value in Volts, a numeric value to print to an LCD (1 km/h, 2 km/h...n km/h) can this be done by the software?
Reply
#2
(Mar-17-2020, 12:43 AM)Roger454 Wrote: 1.- Give each Vo value in Volts, a numeric value to print to an LCD (1 km/h, 2 km/h...n km/h) can this be done by the software?
yes, you can use mapping (like dict) and have key:value pairs, where key is V0 and value is respective speed.

of course better would be to have a function that calculates speed from voltage value.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
(Mar-17-2020, 07:54 AM)buran Wrote:
(Mar-17-2020, 12:43 AM)Roger454 Wrote: 1.- Give each Vo value in Volts, a numeric value to print to an LCD (1 km/h, 2 km/h...n km/h) can this be done by the software?
yes, you can use mapping (like dict) and have key:value pairs, where key is V0 and value is respective speed.

of course better would be to have a function that calculates speed from voltage value.

Thank you Buran, how can I generate the function? I have the table of voltages I need to "assign each voltage, it would be selective, as from a range from 0 to 28 V from the chip I will select 220 values each to be converted to a numeric km/h value.

Thank you Buran, how can I generate the function? I have the table of voltages I need to "assign each voltage, it would be selective, as from a range from 0 to 28 V from the chip I will select 220 values each to be converted to a numeric km/h value.
Reply
#4
Usually a analog voltage signal has a valid minimum and a valid maximum, which represents a range of a unit e.g. m/s or km/h.

I'm working in the industrial automation area. So if we have for example a Sensor for distance measurement, we need to calculate the real units in the plc. The output goes from 0V to 10V which could represent a distance of 0cm to 100cm.

100 cm / 10 V = 10cm/V
Then 5V is: 5V * 10cm/V = 50cm

Usually signals have a resolution. If the resolution is 8 bit (2 ** 8), then you have 256 different possible values.
More common is a resolution of 12 bit = 4096 possible Values. So your 220 don't fit into this schema.
Maybe you mean 220 km/h == 28 V?

If this is the case, then you've 7.857 km/h/V

1V == 7.857 km/h
2V == 15.714 km/h
3V == 23.571 km/h

Or you mean 256 different Values which is 8 bit?
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#5
Dead_Eye: Yes actually my 28V value would be 222Km/h here is part of my voltage table
a bit different but right in the ball park as for a slightly modified pickup truck I will never get to 220km/h so max Vo coming out from the LM22907 chip which will convert my VSS pulse signal into voltage values in the range of 0-28V

1V is 8.026km/h
2V is 16.51 km/h and so on so my gradient would be 8.026km/h/V
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help with a checkerboard algorythm giladal 2 1,999 Sep-27-2020, 10:41 AM
Last Post: giladal

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020