DC Motor Featuring 4Duino-24
by 4D Makers in Circuits > Arduino
1813 Views, 22 Favorites, 0 Comments
DC Motor Featuring 4Duino-24
![DC Motor featuring 4Duino-24](/proxy/?url=https://content.instructables.com/FEX/5CCG/IU0UYR9U/FEX5CCGIU0UYR9U.jpg&filename=DC Motor featuring 4Duino-24)
![1.png](/proxy/?url=https://content.instructables.com/FYX/C2LF/IU0UYR9Y/FYXC2LFIU0UYR9Y.png&filename=1.png)
In this project, we will learn how to control the speed and direction of a DC motor via I/O ports with PWM output capability, a L293D quad half-h drivers IC and 4D Workshop widgets.
In its simplest form, a DC motor has two wires which is connected to a power supply. Depend on whichever way current flows in the DC motor, this will determine the direction in which the motor will spin. Motors are often used in conjunction with a motor driver to allow speed and direction control via a microcontroller. To fully explain the functionality of the motor driver, we will have a look at a screenshot of the datasheet below. (From Texas Instruments).
There are four input and output channels in the IC itself (1A, 1Y makes one channel). To drive a motor in forward and reverse we would require the use of two channels. You would use the #A pins to input signals from your microcontroller to the driver, while the #Y pins will output an amplified signal. The EN pins are used to open and close two channels at one time, and their main purpose is to stop any currents going to the motor completely. The EN pin in this project will be connected to a PWM enabled pin on the 4Duino to control the speed of the motor.
How It Works
![2.PNG](/proxy/?url=https://content.instructables.com/FDI/Y2UM/IU0UYR9Z/FDIY2UMIU0UYR9Z.png&filename=2.PNG)
Build
![3.PNG](/proxy/?url=https://content.instructables.com/FTJ/8YM6/IU0UYRA0/FTJ8YM6IU0UYRA0.png&filename=3.PNG)
Components
- 4Duino
- DC motor rated between 4.5V – 12V (N20 Micro Metal Gear Motor used in this project)
- L293D ICJumper cables
- AA batteries (about 4 – 6 will be sufficient)
- Battery holder
- Micro USB cable
- µSD card
Build the circuit as shown in the diagram.
Program
![6.PNG](/proxy/?url=https://content.instructables.com/FAV/05PB/IU0UYRA2/FAV05PBIU0UYRA2.png&filename=6.PNG)
Workshop 4 – 4Duino Basic Graphics environment is used to program this project. This project requires the Arduino IDE to be installed, as Workshop calls the Arduino IDE for compiling the Arduino sketches. The Arduino IDE, however is not required to be opened or modified to program the 4Duino.
- Download the program here. Open this file using Workshop 4.
- Connect the 4Duino to the PC using µUSB cable. Then navigate to the Comms tab and select the Comms port to which the 4Duino connected.
- Compile and Upload Finally, go back to “Home” tab and now click on the “Comp’nLoad” button.
- The Workshop 4 IDE will prompt you to insert a micro SD card to the PC in order to save the widget images. Insert micro SD card, select the appropriate drive and press button “OK”. If the SD card has the widget images you can click button “No Thanks” Step 5: Insert micro SD card After uploading the program in to the 4Duino, it will try to mount the µSD card. If the µSD card is not present it will prints an error message. Once µSD card is mounted, you will see the screen displayed in the image on the right.
- All you need to do is insert the micro SD card you saved the image files into the 4Duino.
![8.jpg](/proxy/?url=https://content.instructables.com/FSI/M5YN/IU0UYRA9/FSIM5YNIU0UYRA9.jpg&filename=8.jpg)
![7.jpg](/proxy/?url=https://content.instructables.com/FDI/P6KC/IU0UYRA5/FDIP6KCIU0UYRA5.jpg&filename=7.jpg)
Now using the touch sliders on the 4Duino Display, you can control the speed and direction of the motor.
For more creative stuff visit 4Duino Projects.Enjoy !!!