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:

SIK v4.0A - Project 3A Servo Motor

Servo Project with photoresistor:

SIK v4.0a - Project 3A Servo Motor (photoresistor)