Controlling DC Motor via Bluetooth using Arduino UNO and Smartphone

Arduino 05-07-26
15 0

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- Arduino program

5- The mobile app for controlling the motor

 

Objective of the project

The objective of this project is to control a DC motor wirelessly using a smartphone via a Bluetooth connection. An Arduino UNO receives the commands sent from the smartphone through the HC-06 Bluetooth module and controls the motor's operating state (start/stop), rotation direction, and speed using the L298N motor driver module.

Operation

The system operates as follows:

1- The user launches the mobile application and connects the smartphone to the HC-06 Bluetooth module via Bluetooth.

2- The user controls the motor using the application's buttons or slider.

3- The smartphone sends Bluetooth commands to the HC-06 module.

4- The HC-06 module receives the commands and forwards them to the Arduino UNO through serial communication (UART).

5- The Arduino UNO interprets the received commands and generates the appropriate control signals.

6- The L298N motor driver receives these signals and supplies the required power to the DC motor.

7- According to the received commands, the motor can:

- Start or stop,

- Rotate clockwise or counterclockwise,

- Change its speed using PWM (Pulse Width Modulation).

This wireless control system enables convenient and real-time operation of the DC motor without requiring a physical connection between the smartphone and the Arduino-based control unit.

 

Required Components

1. Arduino UNO

Arduino Uno

The Arduino UNO is the main controller of the system. It receives Bluetooth commands from the HC-06 module, processes them, and generates the control signals required to operate the DC motor.

2. L298N Motor Driver Module :

The L298N is a dual H-bridge motor driver that allows the Arduino UNO to control the DC motor. It receives control signals from the Arduino and supplies the required current and voltage to the motor. It controls the motor's start/stop state, rotation direction, and speed using PWM signals.

3. HC-06 Bluetooth module

module HC-06

The HC-06 module provides wireless Bluetooth communication between the smartphone and the Arduino UNO. It receives commands from the mobile application and transmits them to the Arduino through serial (UART) communication.

4. DC Motor (5 V)

The DC motor converts electrical energy into mechanical rotational motion. Its speed and direction are controlled by the Arduino UNO through the L298N motor driver.

5. Jumper Wires

Jumper wires

Jumper wires are used to establish electrical connections between the Arduino UNO, the HC-06 Bluetooth module, the L298N motor driver, the power supplies, and the DC motor. They ensure reliable transmission of power and control signals throughout the system.

6. External Power Supply (9V battery )

The 9 V battery supplies power to the Arduino UNO, allowing it to execute the control program, process the Bluetooth commands received from the HC-06 module, and generate the control signals for the L298N motor driver. It provides a stable and independent power source for the control circuit.

 

Circuit Connections of system

1- L298N to Motor Connections:

OUT1 and OUT2: Connect to the two terminals of Motor.

2- Power Connections:

12V: Connects to the motor power supply (9v battery).

GND: Common ground connection for the motor, Arduino UNO, and power supply.

3- L298N module to Arduino UNO Connections:

ENA is connected to a PWM-enabled digital pin of the Arduino UNO (such as pin D9) to allow speed control of the motor.

IN1 and IN2 are connected to the Arduino Uno digital pins D10 and D11, respectively.

4- HC-06 module to Arduino UNO Connections:

Connect the VCC pin to the Arduino's 5V pin.

Connect the GND pin to the Arduino's GND pin.

Connect the TXD pin to the Arduino's D2 pin.

Connect the TRD pin to the Arduino's D3 pin.

 

Arduino program

This program is designed to control the speed and direction of a DC motor wirelessly using Bluetooth communication. It enables an Arduino UNO to receive commands sent from a smartphone via the HC-06 Bluetooth module, then process those commands to control a DC motor through the L298N motor driver.

 

 

More specifically, the program performs the following tasks:

1- Establishes a Bluetooth serial communication link between the smartphone and the Arduino UNO.

2- Receives data (commands) sent from a mobile application.

3- Builds and interprets the received message until a termination character (#) is detected.

4- Converts the received value into a numerical speed (PWM value from 0 to 255).

5- Controls the motor rotation direction using digital signals (IN1 and IN2).

6- Controls the motor speed using PWM on the ENA pin.

7- Continuously listens for new commands to update the motor behavior in real time.

 

The mobile app for controlling the motor

Download application

 

This mobile application is designed to act as a Bluetooth remote control interface for a DC motor system controlled by an Arduino UNO.

Its main role is to allow the user to send control commands wirelessly to the Arduino via the HC-06 Bluetooth module.

How it works:

1- The user first selects and connects to the HC-06 Bluetooth module using the “Choose HC-06” button.

2- The application establishes a Bluetooth communication link with the Arduino system.

3- The user can control the motor using the interface elements:

4- Clockwise / Anticlockwise checkboxes → send direction commands to the motor.

5- Slider (Speed control) → adjusts the motor speed value (0 to 255).

6- The application sends these commands as text data via Bluetooth to the HC-06 module.

7- The Arduino receives the commands and uses them to control:

- Motor direction (via L298N IN1 and IN2 pins)

- Motor speed (via PWM signal on ENA pin)

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

Pictures of the articles

Robotic site created by Mohamed Ali Haj Salah - Teacher info