RC car steering solution?

One solution came in mind for RC car steering.
Control servo (planned or RC car steering) with potentiometer.


Testing setup is very simple.
Servo setup: +, – and control pin. Same as here:
Simple servo setup


Potentiometer will work as voltage divider.
Here is more info about it: Voltage divider.



Connection to arduino would be also pretty much simple:
Resistive_divider

Potentiometer is like this whole divider system.
So when potentiometer is with big enough resistivity (I think mine is 10Kohms) – One end goes to 5v, other to ground, and the one in the middle, goes to analog read.
In this setup voltage output goes from 0V (when top resistor is 0ohms) to 5V (when bottom resistor is 0ohms).


Code:

Should be pretty much clear, as most part of code was reviewed in post about servo here.


New thing here – map command.
Map command takes variable, and maps new value.
So in my case 0-1023 (values that analog input may read) translate in to values between 45 and 135 (we don’t need all 180 degree values on steering, don’t we ?).


This setup in action:

Leave a Reply