Working with Servo Motors

I am currently working on this week’s project for Physical Computing and I am running into some issues with servo motors. Specifically, how I can do other things while the servo motor is running.

First, I’ll go over what I’ve done so far to check that certain parts of my circuit and code are definitely working. I started by making a circuit to control the servo using a potentiometer. Before putting in a servo, I used an LED to make sure I wired the potentiometer correctly.

Next, I swapped out the LED for my servo and updated my code to use the servo library.



All of this was working great. So I know for this week’s project I want to have a servo that will go through its motion and then return to the original position after it completes its travel. I am able to get this working as shown below.

And then because I will have an option (via push buttons) to choose a slow or fast speed, I want the LED to blink either fast or slow accordingly. I added the LED blinking code using delays, but it slows down my servo’s motion to a crawl.


I know it’s going through the delays each time it loops to move my servo, so I am looking into ways to avoid using delays to get my LED to blink. Or is it only possible stop the slowing down by running one output at a time? I doubt it, so I’m going to keep looking into solutions.

Lighting Up An LED

This week, I worked on creating some simple circuits with an LED. First I started by setting up my breadboard, using my Arduino to provide 5V power to the board.

I first started by making a circuit with an LED. I knew I drew my circuit diagram first, so I could see how to lay out my components on the board. I used a 220Ω resistor because I knew it would lower the current to 22.7mA using Ohm’s Law. I grabbed the LED from the shop, so I’m not sure of what its specs are, but most LEDs seem to have a forward current of 20mA.

I translated this to my breadboard, and the LED lit up!

Next, I added a switch to my circuit diagram.

I used a button switch and it was a success!