Tag Archives: Motor Controller

Arduino Tutorial 40: Controlling DC Motor Speed and Direction with Pushbuttons

In this lesson we explore how to control the speed and direction of a DC motor using two buttons. We are using the L293D motor controller and a small DC motor for demonstration purposes. We are using parts from our Elegoo Super Stater Kit, which you can get HERE. The basic circuit was explained in Lesson 37, and we are using that work as a starting point. The schematic below will get you started in connecting your circuit. Be sure and connect one of the Arduino ground pins to the ground rail in the second to the bottom row in the diagram below. It is good practice to connect all your grounds together.

DC Motor Controller
Connection Diagram for a DC Motor Controller using the L293 Control Chip

The code we developed in the video lesson is shown below for your convenience.


Arduino Tutorial 37: Understanding How to Control DC Motors in Projects

In this lesson we learn the ins and outs of controlling a DC Motor from an Arduino. A key aspect of this is to understand you must not connect a motor directly to an arduino. You need to either build a suitable transistor and diode circuit, or you need to utilize a motor controller, such as the L293D motor control chip.

DC Motor
DC Motor Controller Using the L293D control chip and an Arduino

The video below explains how to hook things up and how the code works.  You must always be mindful that you are using a motor with current requirements that are consistent with the motor controller and power supply you are working with. Failure to do so could result in damage to components or injury.

The circuit used in this video tutorial is shown below:

DC Motor Controller
Connection Diagram for a DC Motor Controller using the L293 Control Chip

It is a good practice to have all grounds connected in a circuit, so I would connect an arduino ground to the ground rail of the breadboard. The components used in this project are from the Elegoo starter kit, which you can pick up HERE. The code is described in the video, but if you need help, this is the code we used in the lesson.