DC Motor Control With Bluetooth





Introduction: DC Motor Control With Bluetooth

The purpose of this proyect consist on control a DC motor with a Smartphone. The speedo of the DC motor will change. The communication between the DC motor and the Smartphone will be done using a Bluetooth module attached to an Arduino UNO module

Step 1: The Design of the Circuit

First, according to specifications (what we want to do) a sketch of the circuit will be developed. This first drawing of the circuit, can be also done using a circuit design programm. For this proyect, the circuit will be designed with a free to use design online software called 123D circuits. The needed materials are:

- Arduino UNO development board

- Bluetooth HC-05 module

- NPN Transistor, TIP 31C

- DC motor (5 Volts)

- Two source powers (4 AA battery case)

- fan blade

- Cables and connector for battery case

Step 2: Circuit Simulation

After the design of the circuit, a test will be performed in order to know if the designed circuit will properly work. In the past, was necesary to build the circuit in order to test it. Now it its possible to simulate a circuit in order to know with more precision, how will it works. The online free tool 123D circuits will be used for the simulation. The component in red is the Bluetooth module

Step 3: Bluetooth Module (HC-05)

A commonly used Bluetooth module is the HC-05. Since the communication between the PC and the Arduino UNO is serial, the wireless communication is achieved using a device (HC-05) that emulates the serial communication. Two pins from the Arduino are needed, by default are the pins 0 and 1 (RX ==> receive, TX ==> transmit). Also there is a library that can emulate the function of these 2 pins using other different pins. The HC-05 has 6 pins, for this proyect only four will be used, the pins STATE and EN will be disconected.

Step 4: ‚ÄčAssembly of the Circuit

The picture shows all the needed componets. Two power sources will be needed, one for the Arduino UNO board and other for the componets outside the Arduino UNO board (Bluetooth module, transistor, DC motor), this two power sources must have a common earth (the two 0 Volts wires must be connected each other).

The control of the DC motor will be defined using number in the programm:

0 ==> off

1 ==> speed 1 (12.5%)

2 ==> speed 2 (25%)

3 ==> speed 3 (37.5%)

4 ==> speed 4 (50%)

5 ==> speed 5 (62.5%)

6 ==> speed 6 (75%)

7 ==> speed 7 (87.5%)

8 ==> speed 8 (100%)

Step 5: Smartphone Connection and Programm

In this step, will be posted the programm. The connection in the smartphone will be done using an app for Bluetooth connection with an Arduion board. Many apps are in Google Play. After installing the app, the connection between the HC-05 and the smartphone must be established. First the smartphone must search, find and connect with the HC-05. Then the installed app should be oppened and in this app, the connection with the HC-05 must be again established.

Here is the used programm with comments.

// The program is designed to perform the next tasks:

// 1. A Bluetooth module (HC-05) will be configured

// and attachet to an Arduino UNO module

// 2. A DC motor will be attached to one output of the Arduino board

// 3. The DC motor will be remotely controlled using a smartphone

// 4. Different speeds will be programmed

// Written by Alberto Morales San Juan

#include // serial communication library

SoftwareSerial ConfigurePorts (8, 9); // Port_8 ==> RX, Port_9 ==> TX

int ReceiveInfo; // for the received information

int MotorPort=11; // Port 13 for the dc motor

void setup()


ConfigurePorts.begin(9600); // Baud rate

ConfigurePorts.println("0=off, 1=speed 1, 2=speed 2 ...");

pinMode(MotorPort, OUTPUT);


void loop()





switch (ReceiveInfo)


case '0': // off




case '1': // speed 1




case '2': // speed 2




case '3': // speed 3




case '4': // speed 4




case '5': // speed 5




case '6': // speed 6




case '7': // speed 7




case '8': // speed 8







Step 6: Test

The proyect will be tested using the smartphone.



  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest
  • Clocks Contest

    Clocks Contest

16 Discussions

you use #include the file you're wanting to attach isn't listed. Did I miss something?

1 reply

Nm. Using the SoftwareSerial.h makes this code unnecessarily complicated. Additionally, pointing out that the pins 3, 5, 9-11 have PWM (i.e. are the only ones that can support this throttling) would seriously be advisable for those that are new to this.

However, this is a decent tutorial using an NPN transistor (I'm using an L293D, but that doesn't make much difference, as I've discovered).

I am trying to upload this arduino program onto the board, I am using the Arduino1.8.2 to do it, but the sketch won't verify for some reason. How were you able to upload this sketch as a software to the board?

what programm should we use to configure arduino

what would you need to do to make the motor go forward or reverse?

hii sir... i made the connections as per the instructions...and also programmed the arduino uno...i can connect the bluetooth to my android ...but i can't control the speed...
when i connect the circuit the motor starts working ... if i give instruction in mobile like 0 it gives result as off... but no change in speed of motor . help me to fix it..


2 years ago

is the code downloaded to the phone ? it didn't look like you were connected to a computer.

1 reply

the code is not downloaded to the phone. There is a communication between the phone and the Arduino. The phone sends the instructions to the Arduino

Why don't you use the RX and TX on the arduino board??

1 reply

Hello, the RX and TX pins can be used also. A second posibility is to use the software serial command to work with other pins

I used two independent Voltage source. One source for the electronics and the second one for the dc motor


I used the "Bluetooth Terminal" and the "ArduinoRC" apps. Theoretically all apps that are included in the search term "android bluetooth" should work.

Also remember to pair first your smartphone with the HC-05 module.