Introduction: DC Motor and Tail Light

I'm making this project as my final assignment for my computer engineering class. Throughout this semester, the hardest assignment I've worked on was my DC motor assignment so I want to try and work with those to try and improve my ability to work with that component. I also wanted to incorperate the Arduino into this project because that is a component that I've enjoyed working with. When I tried to look up Arduino projects that involved DC motors, a lot of the ones I've found were reminiscent of cars so that inspired me to design my project after a car too. I got the idea to program the Arduino so that while the DC motor rotates in the positive direction a light would turn on but as the wheel moves the opposite direction the light turns on, similarly to a headlight. Like before I created this circuit in Tinkercad


  • One Arduino Uno
  • One Breadboard
  • One H-Bridge
  • One 100Ω Resistor
  • One Sideswitch
  • One Red LED
  • Fourteen wires

Step 1: Wiring

Gather your materials and connect wires from the Arduino's ground to the negative rail on the breadboard and 5 volts to the positive rail. Make sure both of the rails you connect it to are next to column J. Then, connect a wire from the positive rail to spot (30,e) and connect a wire from (30,e) to (30,a) and then connect a wire from there to (26,a). Next place the H-Brige so that Power 1 is on space (26,e) and Power 2 is on space (19,f). Connect a wire from the positive rail to space (19,j) so that the H-Brige now has enough power to do its job and connect two wires from the negative rail spaces (22,j) and (23,j). From there place the Slideswitch so that Terminal 1 is on space (21,g) and Terminal 2 is on space (23,g). Afterwards connect a wire from space (21,i) to Terminal 1 of the DC Motor and another wire from space (24,i) to Terminal 2 (24,i) so that the wires are able to take power from the Output terminal of the H-Bridge to the DC Motor. What you want to do from there is put the resistor so that Terminal 1 is on on space (17,j) and Terminal 2 is on space (21,j). Then place the LED so that Anode is on space (13,g) and the Cathode is on space (12,g). Then connect a wire from space (12,h) to the negative rail so that the circuit needed for the LED to activate is complete. Next comes the Wiring from the Arduino so that our code works with the circuit. Connect Digital pin 13 to space (26,j), Digital pin ~11 to space (25,j) and Digital pin ~9 to space (20,j).

Step 2: Coding

Like my last project, the coding takes a lot less steps than the wiring. What you want to do is add functionality for the pins, so for void setup make Digital pins 13, 11 and 9 read as output and digitalwrite pin 13 as high so that it will constantly output a signal, making it so that the H-Bridge terminal it connects to (enable 1&2) is always on. For void loop put digitalwrite 11 as high and digitalwrite 9 as low. Follow that up with digitalwrite 11 low and digitalwrite 9 as high. By doing this we can control whether or not the DC motor was turning in one direction or another with a flip of the switch. And with that we're pretty much done.