Lesson 8 - Motors

Introduction

In this experiment, you will learn how to control the direction and speed of a small-sized direct current (DC) motor) by using the driver chip L293D and the SunFounder Uno board. In order to make it easier for beginners, we will let the DC motor rotate left and right, accelerate and decelerate automatically.


Components

- 1 * Small-sized DC motor

- 1 * L293D

- 1 * SunFounder Uno board

- 1 * Breadboard

- 1 * USB cable

- Jumper wires


Principle

L293D       

This is a very practical chip that can independently control two DC motors. In this experiment, just half of the chip is used. Since most pins on the right side of the chip are used to control the second motor, they will not be used here.

L293D has two pins (Vcc1 and Vcc2) for power supply. Vcc2 is used to supply power for the motor, while Vcc1 to supply for the chip. Since a small-sized DC motor is used here, connect both pins to +5V. If you use a high power motor, connect Vcc2 to an external power supply. At the same time, the GND of L293D should be connected to that of the SunFounder Uno board.

DC Motor Specifications

Voltage: 3-6V

Main Size: length 25mm, thickness 15mm, width 20mm

Motor Shaft Length: 9mm, Shaft Diameter 2mm

Rated Voltage: 3v

Reference Current: 0.35-0.4A

3v Rotating Speed: 13000 RPM


Experimental Procedures

Step 1: Build the circuit

Step 2: Program.

Use the code in the document below and copy/paste it into the Arduino Program on your computer:

Arduino Code Lesson 8

Step 3: Compile the code

Step 4: Upload the sketch to the SunFounder Uno board


The blade of the DC motor will begin rotating left and right, in a speed that varies accordingly.