Scada Report
Scada Report
BLUETOOTH PROTOCOL
Via
Arduino Bluetooth Car using HM10 Module
GROUP 10
Name Student’s ID Note
Pham Van Phuong 21070403 Leader
Tran Minh Duc
Nguyen Vu Quang Vinh
Nguyen Truong Nguyen
Hanoi, 5/11/2024
Contents
I. Introduction ......................................................................................................................................... 4
1. Objective ........................................................................................................................................... 4
2. Importance of Bluetooth in IoT ........................................................................................................ 4
II. System Overview ............................................................................................................................. 5
1. Components ...................................................................................................................................... 5
2. Architecture....................................................................................................................................... 6
III. Bluetooth Low Energy (BLE) and HM10 Module ....................................................................... 7
1. Overview of BLE .............................................................................................................................. 7
2. HM10 Module Specifications ........................................................................................................... 8
3. HM10 in Peripheral Mode ................................................................................................................ 8
IV. Bluetooth Connection Protocols .................................................................................................... 9
1. Overview of the Bluetooth Protocol Stack........................................................................................ 9
2. Connection Setup Process ............................................................................................................... 10
3. Data Transfer Protocol .................................................................................................................... 11
V. UART in Bluetooth Communication ............................................................................................... 12
1. Overview of UART Protocol .......................................................................................................... 12
2. Role of UART in HM10 and Arduino Communication.................................................................. 12
3. Advantages of Using UART in This Project................................................................................... 12
4. UART Configuration and Optimization for Bluetooth Control ...................................................... 13
VI. Implementing the Connection on Arduino and Smartphone .................................................... 14
1. Arduino and HM10 Code Setup...................................................................................................... 14
2. Smartphone Application ................................................................................................................. 17
VII. Protocol Handling and Communication Reliability................................................................... 18
1. Handling Connection and Disconnection Events ............................................................................ 18
2. Error Handling and Data Integrity .................................................................................................. 19
3. Optimizing for Latency and Stability.............................................................................................. 20
4. Security Considerations .................................................................................................................. 21
VIII. Comparison of Bluetooth with Other Communication Protocols ........................................ 21
1. Bluetooth (BLE).............................................................................................................................. 21
2. Wi-Fi ............................................................................................................................................... 22
3. Zigbee ............................................................................................................................................. 22
4. Radio Frequency (RF) Communication .......................................................................................... 23
IX. Testing and Results ....................................................................................................................... 23
1. Connection Testing ......................................................................................................................... 23
2. Performance Analysis ..................................................................................................................... 24
3. Limitations and Improvements ....................................................................................................... 24
X. Conclusion ......................................................................................................................................... 25
I. Introduction
1. Objective
The team's project goal is to design and implement a Bluetooth-based control system for
an Arduino Nano-powered vehicle. Using the HM10 Bluetooth Low Energy (BLE) module,
the system enables wireless communication between a smartphone and an Arduino
platform to control the vehicle's movements, using simple commands such as forward,
backward, left, and right. Additionally, the system integrates sensors to enhance the
vehicle's functionality, such as an automatic lighting system in the vehicle's cabin based on
the ambient light conditions of the environment and distance warning to prevent possible
collisions.
Bluetooth Module (HM10): HM10 receives control signals from the smartphone and
transmits them to the Arduino Nano via the UART (Serial Communication) protocol. Each
signal is sent from the smartphone as digital data for the Arduino to process, thereby
controlling the car according to the required command.
Ultrasonic Sensor (HC-SR04): The ultrasonic sensor measures the distance from the car to
the obstacle. When the Echo pin of the sensor receives a feedback signal from the sound
wave, the Arduino receives a digital signal from this pin and uses the response time to
calculate the distance, thereby triggering a warning if the car is too close to the obstacle.
- Digital Output:
Motor Driver (L298N): Based on the control signal from the smartphone (via HM10),
Arduino sends digital signals to the motor driver to adjust the direction and speed of two
DC motors, helping the car move in the directions: forward, backward, left, and right. This
control signal is implemented through the digital output pins connected to the motor driver.
LED Indicators: The LED indicator turns on when detecting a nearby obstacle (distance
below a certain threshold determined by the ultrasonic sensor). The digital output signal
from Arduino will control the LED to turn on or off, providing a visual warning to the user.
- Analog Input:
Light Sensor: The light sensor measures the light intensity around the car and transmits an
analog signal to the Arduino's analog input pin. Based on this value, Arduino checks the
light level (in the form of voltage) and decides to turn on the LED when the ambient light
is low, ensuring the car has enough light for safe operation.
- Analog Output:
PWM Control of Motors: The PWM (Pulse Width Modulation) signal is sent by the
Arduino to the motor driver's speed control pins (enable pins) to adjust the speed of the
motor. By changing the time ratio of the PWM (analog output) pulses to the motor, the
Arduino can increase or decrease the speed of the vehicle, creating smooth and efficient
speed control.
III. Bluetooth Low Energy (BLE) and HM10 Module
1. Overview of BLE
Bluetooth Low Energy (BLE) is a wireless technology designed for applications that
require short-range, low-power connectivity, especially popular in IoT devices. BLE
consumes less power than traditional Bluetooth, allowing for longer battery life in small,
battery-powered devices. BLE operates on a client-server model and uses characteristics
and services to transmit and receive data. With its low-power and efficient connectivity,
BLE is an ideal solution for wireless connectivity in IoT applications such as remote
vehicle control.
Connection Process: When the smartphone searches for a BLE device, the HM10 will
appear as a connectable Peripheral device. Once the connection is successful, the HM10
starts transferring commands from the smartphone to the Arduino via the UART protocol,
allowing the car to receive control commands.
Data Conversion: The HM10 converts the BLE data received from the smartphone into
UART signals that the Arduino can process. This creates a stable and efficient connection,
allowing real-time control of the car without delay or interruption.
Energy Consumption: Since BLE is more energy efficient than traditional Bluetooth, the
HM10 module can operate for a long time without consuming much power, making it
suitable for systems that use batteries or require high performance.
Using the HM10 in Peripheral mode not only optimizes power consumption, but also
facilitates simple and efficient connection and data transmission. This allows remote
control of the vehicle via Bluetooth while ensuring high reliability in signal transmission.
This Protocol Stack helps to ensure that data transmitted between the smartphone and the
HM10 module over BLE is arranged and transmitted efficiently and securely.
- Operating range: Wi-Fi has an operating range of 30–100 meters, depending on the type
of device and environment. It usually works well in home or office networks, but the range
is reduced in environments with many obstacles.
- Data transmission speed: Wi-Fi supports high data transmission speeds, which can reach
hundreds of Mbps to several Gbps, very suitable for large data transmission applications
such as video streaming or complex remote control.
- Power Consumption: Compared to BLE, Wi-Fi consumes more power, which may reduce
the battery life of the device if used continuously.
- Project Application: Although Wi-Fi has high transmission speed and wide range, its
higher power consumption makes it unsuitable for a simple and energy-saving vehicle
control system. Moreover, the requirement of an available Wi-Fi network may limit the
mobility of the system.
3. Zigbee
Zigbee is a low-power wireless communication protocol, specifically designed for IoT
applications and short-range communication with simple devices. Zigbee is mainly used in
automation systems such as smart homes and industry.
- Operating range: RF has a much longer transmission range than BLE, often up to several
hundred meters or even kilometers in an unobstructed environment, depending on the
transmit power and antenna type.
- Data transmission rate: RF transmission rates are usually quite low, around a few kbps to
100 kbps, but can meet applications that do not require high bandwidth.
- Energy consumption: RF usually consumes less power, especially when designed for
occasional communication applications. However, compared to BLE, RF is not optimal for
mobile devices that need real-time communication.
- Project application: Although RF has a wide range, it has a low transmission rate and does
not support real-time communication as well as BLE. Moreover, RF communication is
often not suitable for transmitting complex and synchronous control data, making BLE a
better choice for controlling vehicles via smartphone.
Data Power
Protocol Range Ideal Use Case
Rate Consumption
Bluetooth 10–100 Up to 1 Short-range, low-power IoT,
Very Low
BLE meters Mbps smartphone-controlled systems
Up to
30–100 High-data-rate applications, network-
Wi-Fi several High
meters based systems
Gbps
10–20 Up to
IoT, smart home automation, simple
Zigbee meters 250 Very Low
data transfer
(Mesh) kbps
Several
Up to
hundred Long-range, low-data-rate systems,
RF 100 Low
meters to basic communication
kbps
km
Table 8.1. Comparison of Bluetooth with Other Communication Protocols
IX. Testing and Results
1. Connection Testing
- Objective: Ensure that the system connects stably between Arduino and smartphone via
Bluetooth BLE, with the compatibility of HM10 module.
- Method: Perform connection tests by connecting and disconnecting between the phone and
HM10 module in various scenarios, including:
Connection at different distances, from 1 to 10 meters.
Test the stability of the connection in environments with interference (such as near
Wi-Fi devices).
Consider the delay when performing control operations from the phone.
Result: The BLE connection between HM10 module and smartphone works stably
at a distance of 1–8 meters. Outside this range, the connection may be disconnected
or delayed. Latency is low and the system responds immediately to control
commands (average 100–150 ms).
2. Performance Analysis
- Objective: Evaluate the performance of vehicle control functions, test the response time,
accuracy, and stability of the system.
- Method:
Test vehicle control operations through basic commands such as forward, reverse, turn left,
turn right, and stop.
Measure the response time of commands from pressing the button on the phone until the
vehicle performs the action.
Test the operation of the built-in sensors (light sensor, distance sensor) to ensure the vehicle
responds properly to the surrounding environment.
- Results: The system performed well in control tests, with a delay when the vehicle
responded to commands ranging from 100–200 ms, depending on the distance. The sensors
worked effectively; LED lights turn on/off according to the ambient light level, and the
accurate distance sensor warns with LED lights when obstacles are within 10 cm.
3. Limitations and Improvements
- Limited connection range: BLE connection via HM10 module is only stable within about
8–10 meters in environments with few obstacles. When used outdoors or in environments
with many obstacles, the connection range can be significantly reduced.
- Data transmission speed limit: With BLE's maximum data transmission speed of 1 Mbps,
the system sometimes has a small delay when sending complex control commands or when
requiring continuous transmission of sensor data from the vehicle to the phone.
Limited anti-interference ability: BLE can be affected by interference from other devices
using the same 2.4 GHz frequency, such as Wi-Fi and other Bluetooth devices, resulting in
unstable connections.
- Vehicle power consumption: Although BLE is energy efficient, other vehicle components
such as motors and sensors consume relatively large amounts of power, which can reduce
the operating time if using batteries.
- Improvements:
Extend the connection range: Upgrade the HM10 module to more modern BLE modules
(such as HM11) or use BLE mesh network solutions to improve the connection range and
stability when controlling at long distances.
Improve data transmission speed: To minimize latency when controlling the vehicle
remotely, you can experiment with other communication protocols such as Wi-Fi if the
power requirements are not too strict.
Optimize signal processing: Use signal filtering and connection management algorithms
to minimize the impact of interference from other devices, ensuring a more stable
connection in an environment with many electronic devices.
Power system improvements: Use high-capacity batteries or add solar charging solutions
to extend vehicle operating time in outdoor environments.
X. Conclusion
The project of remote control of the car using Bluetooth via Arduino and HM10 module
has achieved positive results in applying Bluetooth Low Energy (BLE) technology to
control IoT devices. Through the research and testing sections, we have evaluated the
performance and usability of the system, and drawn some valuable lessons and experiences.
Improve stability and anti-interference ability: In an environment with many devices using
the 2.4 GHz band, BLE connection may be unstable. Therefore, it is necessary to consider
anti-interference solutions, such as using signal filtering algorithms, to ensure a more stable
and reliable connection.
- Conclusion
The Bluetooth remote control project has demonstrated the feasibility of using BLE
technology in IoT applications with low-cost and energy-saving connectivity requirements.
Despite some limitations in connection range and anti-interference ability, the current
system has successfully completed the set goals, including stable connection, precise
control, and integration of basic automation features.
With the proposed improvements in connection range, signal stability, energy optimization,
and AI applications, the project has the potential to be widely developed and applied in
areas such as home automation, remote control of IoT devices, and smart mobile systems.
This not only brings high flexibility but also opens up great prospects for deploying BLE
and Arduino technology in future IoT projects.