Tag Archives: DC Motors

Arduino Tutorial 66: Controlling DC Motor, Speed and Direction with a Remote

IR Control DC Motor
Circuit for IR Remote Control of DC Motor

In this lesson we develop a project that allow Remote Control of the speed and direction of a DC Motor. We use an Arduino Nano, and components from the Elegoo Kit. Also, to facilitate a clean build, we use Straight Jumper Wires.

The motor is connected according to this schematic:

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

Also, the remote control receiver is connected as follows: R on Remote to 5V, G on Remote to Ground, and Y on the Remote to Arduino Digital Pin 9. Go back and check out Tutorial 65 if you need more details on the Remote Module Connections.

In this video we will take you step by step through the build and coding for the project.

The code below is the software we developed in the video.

 

Arduino Tutorial 39: Using a Joystick to Control DC Motor Speed and Direction

DC Motor JoyStick
This is a simple example of how to control speed and direction of a DC motor with a joystick.

Lesson 37 and 38 showed some preliminary concepts in controlling a DC motor using an arduino and the L293D motor controller. In the video above we show how to control the speed and direction of a simple DC motor using a joystick. In the neutral position, the motor is stationary. Then the speed smoothly increases as you move the joystick forward, until you reach maximum speed.

Lesson 37 and 38 showed some preliminary concepts in controlling a DC motor using an arduino and the L293D motor controller. In the video above we show how to control the speed and direction of a simple DC motor using a joystick. In the neutral position, the motor is stationary. Then the speed smoothly increases as you move the joystick forward, until you reach maximum speed. Similarly, in pulling the joystick back from the neutral position, the motor gradually increases speed in the reverse direction. The diagram below shows the basic motor control schematic we are working from.

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

In the circuit diagram above, we also add a wire to connect the arduino ground to the power supply ground. It is always good to have all components connected to a common ground rail. Of course, you also need to add the joystick controller as shown in the video.

This is the code we used in this

 

Arduino Tutorial 38: Using a Tilt Switch Cut Off With a DC Motor

Tilt Cut Off Switch
DC Motor circuit with a tilt switch cutoff

In this lesson we explore how to add a tilt cutoff to our DC motor project. In many cases, you may want to automatically turn your motors off in the case where your project or robot tips over. The tilt switch is a simple way to do this. The video below takes you through the process step-by-step.

 

If you need help hooking the circuit up, the diagram below shows you a schematic of what we are working with. All these components are part of our ELEGOO Super Starter Kit.

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

In addition, you will need to add the tilt switch, as shown in the video.

Below is the code we used, with the tilt switch connected to pin 2 on the arduino.