top of page

LAB 5-Motors

fernanda villalobos

Updated: Nov 12, 2019



"In this lab you will explore motors and building circuits using DC and stepper motors driven with an H-Bridge. "



Part 1: DC Motor Control


For part 1 of this lab we learned how to drive a DC motor and reverse the direction of the motor using an H-Bridge circuit. The schematic for the circuit is below. The H Bridge has 8 pins on each side. Two pins from the H Bridge connect to the DC motor and others connect to the Arduino. The circuit also shows a switch, I used my breakout board from a previous lab and connected it to digital input 2 on the Arduino. The breakout board has a button and 10K resistor,




Below our pictures of the DC motor circuit



Since the DC motor is rotating fast, its a little difficult to see that it changes direction when the button is pressed.





Below is the code for the DC motor. At the bottom, the code that is commented out modifies the speed of the DC motor using PWM. The maximum PWM is 255; I didn't play around with that many values so in the future I want to experiment more with the DC motor's speed. Motor2pin needs to be set to an analog pin in order to use analogWrite.






Part 2: Stepper Motor Control


For part 2 of this lab we learned how to set up a unipolar stepper motor using an H-Bridge. A stepper motor moves in small steps which offers more control. The schematic for the circuit is below. The H Bridge has 8 pins on each side. Some of the pins from the H Bridge connect to different colors on the motor and others connect to the Arduino. We needed to make the stepper move one whole revolution at a time, pause, then rotate again. I found the number of steps per revolution on the stepper product page. The description said that per revolution there was 513 steps.





Below are pictures of the stepper motor circuit



Below is a video of the working circuit, the stepper makes a full revolution, pauses, then makes another full revolution.


Below is the code for the stepper motor, on the Arduino website there is a stepper revolution example which was very helpful. I changed the stepsPerRevolution to 513 and deleted the code that rotates the stepper counterclockwise.






©2018 by Fern.Vi11. Proudly created with Wix.com

    bottom of page