Hi - I am building a model train controller and have most of it prototyped now but I'm having issues with the PWM output. I am testign with a Teensy++ 2.0 before moving to a Teensy 3.6 which I am yet to purchase. I am using a Pololu MC33926 Motor Driver Carrier which is working perfectly to drive trains around the track.
The issue is the amount the potentiometer (10k linear) has to be turned before the trains start moving. When I look at the 10-bit PWM value when they start it is about 750 (out of 1023). This corresponds with about 75% of the pot movement which is understandable.
I have got the code written to look up the current PWM value in a 1024 long array to then set the PWM duty cycle to a non-linear value but I am struggling with generating the 1024 non-linear values. I don't know how to get the list of numbers from either an S-curve, logarithmic, exponential function. I need 0 - 1023 input and a range of numbers output 0 - 1023 in a non-linear fashion if that makes sense.
I have been scouring the internet for this but but sure where to go next.
The issue is the amount the potentiometer (10k linear) has to be turned before the trains start moving. When I look at the 10-bit PWM value when they start it is about 750 (out of 1023). This corresponds with about 75% of the pot movement which is understandable.
I have got the code written to look up the current PWM value in a 1024 long array to then set the PWM duty cycle to a non-linear value but I am struggling with generating the 1024 non-linear values. I don't know how to get the list of numbers from either an S-curve, logarithmic, exponential function. I need 0 - 1023 input and a range of numbers output 0 - 1023 in a non-linear fashion if that makes sense.
I have been scouring the internet for this but but sure where to go next.