Lab 5: Servo and DC Motor Output From Arduino
- Summer Thompson
- Nov 14, 2018
- 2 min read
Intro:
The following circuits and programs were created for the fifth lab assignment for the 2018 Object class at the Atlas institute at the University of Colorado, Boulder. The two objectives of this lab were to use Pulse Width Modulation to drive a servo motor, then to use an H-bridge to drive a DC Motor. All code was written in Arduino IDE.

Part 1: Servo Motor
Materials:
Procedure:
I began by assembling the circuit. I connected analog A0 pin to the potentiometer and digital pin 3 to the Servo motor. I then connected the pot to both power and ground, ad did the same for the servo motor. Bellow is the Schematic.

Once the circuit was assembled, I wrote this Code, to map the movement of the servo to the input from the potentiometer. Bellow is a video of the result.
Part 2: DC Motor
Materials:
Procedure:
The circuit for the DC motor was much more complicated than part 1 because of the use of an H Bridge to drive the motor in two directions. I initially tried connecting a 9V battery to the H bridge to provide extra power to the motor, but found it did not work. In my final circuit, I connected pin 8 of the H bridge to the Arduino 5V power supply which seemed to provide enough power to run the motor. I connected pin 1, 2, and 7 of the H bridge to digital pins 9, 2, and 3 respectively on the Arduino. I added my momentary switch and connected it to 5V and digital pin 2 on the Arduino with a pull down resistor to ground. I then connected the DC motor to pins 3 and 6 of the H bridge and connected pins 4,5, 12, and 13 to ground. Bellow is the schematic.

I used this Code to make the motor switch directions depending on the state of the momentary switch. Bellow is a video of the whole circuit working:
Conclusion:
This lab was a great introduction to working with simple motors. They seem much more accessible now and I'm excited to use them in my final projects to make things spin and go ding. Thanks for reading.
Commentaires