Landing : Athabascau University
  • Blogs
  • SIK Guide 4.0a: Circuit 3A: Servo Motors

SIK Guide 4.0a: Circuit 3A: Servo Motors

Circuit 3A: Servo Motors (This is Circuit #8 in SIK guide v3.3)

This is my first time working with servor motors (or actually any type of motor). To reverse the direction that the servo would turn relative to how the potentiometer turned I had to swap two values that were read by A0 (potPosition) in the map function. Instead of:

servoPosition = map(potPosition, 0,1023,20,160);

I wrote:

servoPosition = map(potPosition, 1023,0,20,160); 

I also tried adding a photoresistor into the circuit in place of the potentiometer. This was pretty easy to do. I had to play around with the new potPosition range since the ambient lighting sensed by the photoresistor had a much narrower resistance range so the voltage read back was ranging from around 370 to 810 instead of 0 to 1023.

Servo Project:

Servo Project with photoresistor:


These comments are moderated. Your comment will not be visible unless accepted by the content owner.

Only simple HTML formatting is allowed and any hyperlinks will be stripped away. If you need to include a URL then please simply type it so that users can copy and paste it if needed.