In this project we will control a DC motor with a smartphone via bluetooth. This project is great to learn more about:
- DC motors
- Interfacing Arduino with your smartphone
- L293D IC
If you don’t have the L293 IC you can make the same circuit using the H bridge, anyway I really recommend you to read more about that and the IC datasheet. There’s plenty of tutorials about that. So Let’s start…
- 1x Arduino Uno
- 1x Bluetooth Module (for example: HC-05)
- 1x Smartphone (any Android will work)
- BlueTerm application
- 1x L293D IC
- 1x DC motor
- 1x Breadboard
- Jumper Cables
You just need to follow this schematics (I recommend you to wire the TX and RX only in the last step) :
Two common mistakes:
- You need to remove the RX and TX cables when you’re uploading the sketch to your Arduino.
- Sometimes people connect the TX from the bluetooth module to the TX of the Arduino… that’s wrong and it won’t work. Make sure you connect it properly, the TX into RX and the RX into the TX.
If the HC-05 Bluetooth Module asks for a password, It’s ‘1234’.
The Arduino code can be download here. Upload this sketch! Make sure you remove the wires from RX and TX otherwise the code won’t upload properly!
For the android communication with our bluetooth module I’ve used the BlueTerm app, It’s completely free, so you just need to go to “Play store” and download it. Then you just need to connect your smarthphone with the bluetooth module. Remember to remove the TX and RX cables. (you can see in youtube video below how that’s done).
I’ve only set 3 commands to control the DC motor:
- ‘0’ – Turns off the DC motor
- ‘1’ – DC motor rotates to right
- ‘2’ – DC motor rotates to left
Check this video to see the circuit in action!
I hope this tutorial had helped you in anyway, you can apply this method to control anything through bluetooth! Thanks for reading, if you tried my code leave a comment or send me an email. If you like this project probably you might like my next ones, so please support me by subscribing my blog and my Facebook page (you can find everything right column )