Part 1: Servo Motors

Servo motors were controlled with a flex sensor. The flex sensor was connected into analog input 0 and a pull-down resistor. The servo motor was controlled using the variable resistor’s resistance as an analog input. It rotated corresponding to the level of flex within the flex sensor. This was the simplest setup because it never required the H-Bridge to function. The H-Bridge brought a few complications.

In this video you can see the quick response from the servo to the flex sensor’s stimulation.

Part 2: DC Motors

DC Motors were controlled with a switch and an H-Bridge. The H-Bridge was initially very tedious to set up. The switch was acting as a digital input and was controlling the direction of the motor. The H-bridge acted as a way to switch voltage direction for the motor. It was a little finicky through the breadboard, though, and I had to push down all the connections a few times to get the motor to spin the way I wanted it to.

Part 3: Stepper Motors

Stepper Motors were controlled with the Arduino code. It was programmed to turn 360 degrees, or one full revolution then stop with a delay() function, and then turn counterclockwise 360 degrees. The stepper motor also utilized the H-Bridge to function the proper way. Unlike the DC Motor though, the stepper motor just utilized Arduino code to function. There was no need for a physical switch, as the motor was just put on a timer within the Arduino function.

This was the way I originally attempted to code the pause into the stepper motor, with a step counter and a if() statement to see if the steps being counted were divisible by the steps per revolution. It didn’t work as well as the following code because I couldn’t control the speed of rotation as well as I would have liked.


Leave a Comment