This is very cool. I like!
This is very cool. I like!
Well I've done it. I've created software that simulates real life movement of the pointer needle based of a variable input. Its crude software, and leaves out many functions that will later be incorporated. However this proof-of-concept confirms that it can certainly be done.
In the video, it starts off at a random position, rotates completely counter-clockwise, has a 1 second pause, then jumps about 10º clockwise just to back off a little from the internal stop. After another 2 second delay, it reads the position of the potentiometer and moves the needle to that position. Subsequent moving of the POT then moves the needle in the corresponding direction. You'll notice a bit of jitter in the movement, best I can tell this is due to noise from the POT itself, its a pretty weak unit. The in-car sensors will provide much more fluid movement. Also, the motor is currently moving in 2º increments, while the final design will have it moving in 1/3º increments, so it will appear completely fluid.
Jim Reeve
DMC6960
Very cool. Now your getting pretty good writing code.![]()
Location: Maple Grove, MN (Minneapolis)
Posts: 1,432
My VIN: 05457
Nicely done!Great to see the steady progress you are making.
David Proehl
To stop the erratic fluctiations of the needle due to false readings of the pot you can always add a running average function to the input (or output). Say for example you take 10 readings a second, take the average of the last 10 readings using a circular buffer. The processor should have to problem doing that. No only does this dampen any off readings, it also provides for a smooth tweaning of the needle without any complex logic. For even smoother results you can use a larger buffer.
Thats been the plan for the fuel sender from the start (30-60 second average). Other gauges need quicker response time. Right now its about a 20-40ms delay between single readings. The lag with that is barely noticeable, I can only see it because I know its there. While experimenting, a 200ms smoothed it out nicely but there was a noticeable delay in the readings. Perhaps having 4 readings 5-10ms apart would provide good results.
Further logic will incorporate acceleration into the needle. So it if only needs to move a few degrees or so, it will do it mildly. If it need to move a full swing right away, it will accelerate to the stepper's full speed (which is still I think about twice as fast as seen here).
Jim Reeve
DMC6960
What kind of servo's are you using? I remember the servos from my RC car back in the days, those servo's made quite the bit of noise, probably because of the gears involved.
Wouldn't like anything like 8 of those noisemakers in my binnacle.
They are X25.168 stepper motors. They are designed specifically for automotive instrument clusters. When driven with a proper pulsetrain, they are not noisy at all.
It is a Lavet style stepper motor with two coils. Turns nominally in 1/3º (on the pointer shaft) partial steps. A full step is 3 partials, and the complete pulse cycle (2 steps) is 6 partial steps, which equates to 2º on the pointer (hens why right now its moving in 2º increments). Unit has internal stops, with a total of 315º available on the pointer shaft.
Jim Reeve
DMC6960