Advanced Arduino Programming for
Communications
Course Title: Embedded Systems & IoT
Course Code: CSE233
Dept. of CSE, DIU
CSE233@DIU, SPRING 2025 1
Table of contents
▶ HC-05 Bluetooth Module Interfacing with Arduino
▶ SIM800L GSM/GPRS Module Interfacing with
Arduino
▶ LoRa RF Module Interfacing with Arduino
▶ Generic RF Module Interfacing with Arduino
▶ nRF24L01 RF Module Interfacing with Arduino
2
HC-05 Bluetooth
Module
A Bluetooth module is a device that allows wireless communication between electronic
devices over short distances using Bluetooth technology. It is commonly used in IoT,
robotics, and home automation applications to enable wireless data transfer between
devices like smartphones, computers, and microcontrollers.
Key Features:
⮚ Wireless Communication: Operates over short distances (typically 10m - 100m
depending on the module).
⮚ Low Power Consumption: Suitable for battery-operated devices.
⮚ Data Transfer: Supports serial communication (UART), allowing data transfer
between a microcontroller (e.g., Arduino) and other Bluetooth-enabled devices.
⮚ Bluetooth Versions: Common modules use Bluetooth 2.0, 3.0, 4.0 (Low Energy), or
5.0 (latest version with increased range and speed).
3
HC-05 Bluetooth Module
✔ Supports Master & Slave modes
✔ UART (Serial Communication) → Default Baud Rate:
9600
✔ Range: ~10 meters
✔ Power: 3.3V (Tolerates 5V on RX)
⮚ Easy-to-use wireless module
⮚ Compatible with Arduino, Raspberry Pi, Microcontrollers
⮚ Ideal for IoT & Embedded Projects
4
HC-05 Working
• Pairing & Connection: The module discovers nearby devices and establishes a
Principle
connection.
• Data Transfer: Uses serial communication (UART) to send/receive data via TX and RX
pins.
• Bluetooth Profiles: Utilizes protocols like SPP (Serial Port Profile) for wireless serial
communication.
• Wireless Range: Typically works within a range of up to 10 meters.
• Bidirectional Communication: Enables two-way data transfer between devices.
5
HC-05 Bluetooth Module Pin
Configuration
6
HC-05 Interfacing with Arduino Circuit
Diagram
7
HC-05 Interfacing with Arduino
Microcontroller Code
#include <SoftwareSerial.h>
void loop() {
// Create software serial object to communicate with HC-05 // If data is received from Serial Monitor, send it to Bluetoo
SoftwareSerial mySerial(10, 11); // HC-05 Tx -> Arduino 10, HC-05 Rx -> if (Serial.available()) {
Arduino 11 mySerial.write(Serial.read());
}
void setup() {
// Begin serial communication with Arduino IDE (Serial Monitor) // If data is received from Bluetooth, send it to Serial Monit
Serial.begin(9600); if (mySerial.available()) {
// Begin serial communication with HC-05 Serial.write(mySerial.read());
mySerial.begin(9600); }
Serial.println("Initializing..."); delay(20); // Small delay to improve stability
Serial.println("The device started, now you can pair it with Bluetooth!"); }
}
8
HC-05 Bluetooth Module Applications
⮚ Industrial Automation: Enables remote monitoring and control of machines,
improving efficiency and reducing manual intervention.
⮚ IoT & Home Automation: Facilitates wireless control of smart home devices,
allowing automation of appliances via mobile apps.
⮚ Robotics & Remote Control: Supports wireless communication for robot
navigation, making remote operation and data exchange seamless.
⮚ Healthcare & Wearable Devices: Used in smart healthcare systems for wireless
patient monitoring and health tracking through Bluetooth-enabled devices.
⮚ Wireless Data Transfer: Replaces wired UART communication, enabling secure
and efficient data exchange between microcontrollers and smart devices.
9
SIM800L GSM Module
The SIM800L is a GSM/GPRS module that allows your Arduino to connect to cellular
networks for communication, making it suitable for sending SMS, making calls, and
connecting to the internet via GPRS. Here’s an overview and a simple code example to
get you started.
Key Features:
•GSM/GPRS Communication: Send SMS, make calls, and use data.
•Voltage: 3.4V to 4.4V (often powered with 4V).
•Communication Interface: Serial (UART).
•Functions: SMS, voice calls, data (GPRS), and more.
10
SIM800L Pin
Configuration
⮚ Power Supply: The SIM800L requires stable voltage (3.4V to 4.4V) and a separate
power source (as Arduino’s 5V pin may not supply enough current).
⮚ Antennas: Ensure connect the antenna for better reception.
⮚ GSM Signal: Make sure SIM card is active and has a good signal.
11
SIM800L Working
Principle
How it works:
1. AT Commands: Sends basic AT commands to the SIM800L for SMS functionality.
2. Serial Communication: Uses SoftwareSerial to communicate with the SIM800L,
forwarding data between the Arduino and SIM800L, and the Arduino and the Serial
Monitor.
3. SMS: The code sends the "Hello World!" SMS message to a phone number
(+ZZxxxxxxxxxx). Make sure to replace it with an actual phone number with country
code.
12
SIM800L with Arduino
13
Connection Diagram of SIM800L with Arduino
To interface the SIM800L GSM module with Arduino:
✅ Power:
● SIM800L requires 3.7V–4.2V stable supply (Li-ion battery with LM2596 step-down
voltage regulator set to 4V).
● SIM800L GND and LM2596 GND connects to Arduino GND to maintain a
common ground.
✅ Communication:
● SIM800L TX (e.g., Pin D10) → Arduino RX (direct connection).
● Arduino TX → SIM800L RX (e.g., Pin D11) via voltage divider to reduce 5V to
~3.3V for safe operation.
14
Connection Diagram of SIM800L with Arduino
✅ Voltage Divider for Arduino TX → SIM800L RX:
● Use 10kΩ resistor (Arduino TX to SIM800L RX) and
● 20kΩ resistor (SIM800L RX to GND).
✅ Optional:
● Connect an antenna to SIM800L for better signal.
● Add a 1000µF capacitor across SIM800L VCC-GND to prevent resets during
transmission.
15
SIM800L with Arduino
Code
#include <SoftwareSerial.h>
void loop() {
SoftwareSerial sim800l(3, 2); // RX, TX pins connected to // You can add code to listen for incoming messages or calls
SIM800L }
void setup() { // Function to send SMS
// Begin serial communication with Serial Monitor and void sendSMS(String phoneNumber, String message)
SIM800L {
Serial.begin(9600); sim800l.print("AT+CMGF=1\r"); // Set SMS format to text mode
sim800l.begin(9600); delay(500);
sim800l.print("AT+CMGS=\""+phoneNumber+"\"\r"); //Set the recipient
// Wait for the SIM800L module to initialize phone number
delay(1000); delay(500);
sim800l.print(message); // Send message
// Send SMS delay(500);
sendSMS("1234567890", "Hello from SIM800L!"); sim800l.write(26); // ASCII code for sending the SMS
delay(500);
Serial.println("SMS sent!"); }
}
16
SIM800L Applications
The SIM800L module has several applications, including:
✔ SMS-based Communication: Send SMS alerts, control devices remotely, or create
alert systems for emergencies.
✔ Voice Communication: Enable voice calls or intercom systems.
✔ GPRS Data Communication: Provide internet access, send data from sensors, or
enable GPS tracking.
✔ IoT Projects: Used in remote IoT devices for monitoring and automation, such as in
agriculture or smart home systems.
✔ Home Automation & Security: Control appliances via SMS or phone calls and send
alerts for
17
LoRa Module
LoRa (Long Range) Module is a wireless communication technology designed for
long-distance, low-power data transmission.
⮚ It operates on unlicensed ISM bands (e.g., 433MHz, 868MHz, 915MHz) and is
widely used in IoT applications.
❑ How LoRa Works
•Uses Chirp Spread Spectrum (CSS) modulation for robust, interference-resistant
communication.
•Supports Point-to-Point (direct node communication) and LoRaWAN (network-based)
communication.
•Can transmit data up to 10-15 km in open areas with low power consumption.
18
Pin Diagram of LoRa
Module
19
Pin Diagram of LoRa
Module
20
Pin Diagram of LoRa Module with
Arduino
LoRa Module Pin Arduino Pin
● MISO Pin 12
● MOSI Pin 11
● SCK Pin 13
● NSS (CS) Pin 10
● RESET Pin 9
● DIO0 Pin 2
● GND GND
● VCC (3.3V) 3.3V (Important!)
Note: The LoRa module operates at 3.3V, so ensure you’re using the 3.3V pin for
power. Also, the logic level is 3.3V, so if you are using a 5V Arduino, it’s safer to
use level shifters for the SPI pins (although many users get by without them). 21
LoRa Module with
Arduino
22
LoRa Module with Arduino
Code Transmitter Code: Receiver Code:
23
Applications of LoRa
Module
✔ Smart Agriculture: Remote monitoring of soil, weather, and irrigation.
✔ Industrial Automation: Wireless sensor networks for equipment
monitoring.
✔ Smart Cities: Parking systems, waste management, and streetlights.
✔ Environmental Monitoring: Air pollution, water quality, and weather
stations.
24
Generic RF Module
A Generic RF (Radio Frequency) Module is a wireless communication device that transmits
and receives data over radio waves.
It consists of:
1. RF Transmitter (TX): Sends encoded signals.
2. RF Receiver (RX): Captures and decodes signals.
Common Frequencies: 315MHz, 433MHz, 868MHz, 915MHz.
Used for: Low-power, short-range communication in IoT, remote controls, and
automation.
25
Generic RF Module
Signal Transmission:
✔ The transmitter converts digital data into an RF signal and sends it via an antenna.
✔ The receiver detects and decodes the signal into usable data.
Modulation Techniques:
•ASK (Amplitude Shift Keying): Simple, low-cost, but prone to interference.
•FSK (Frequency Shift Keying): More reliable and resistant to noise.
Microcontroller Interface:
⮚ Can be easily connected to Arduino, Raspberry Pi, or any microcontroller using simple
digital I/O pins.
26
Generic RF Module
27
Generic RF Module
28
Applications of Generic RF Module
1. Remote Control Systems – Used in wireless remotes for TVs, gates, and car
locking systems.
2. Home Automation – Enables smart home devices like wireless switches and
alarms.
3. Wireless Sensor Networks – Transfers data from remote sensors for monitoring.
4. Industrial Automation – Provides machine-to-machine (M2M) communication.
5. Security Systems – Used in RFID-based access control and burglar alarms.
29
nRF24L01 RF Module
The nRF24L01 is a low-power, highly integrated 2.4 GHz transceiver module designed
for wireless communication.
Key Features:
•Frequency Range: 2.4 GHz ISM band
•Communication Distance: Up to 100 meters (line of sight)
•Data Rate: 250 kbps, 1 Mbps, 2 Mbps
•Low Power Consumption: 12.3 µA in power-down mode
•Supports Point-to-Point & Multi-Point Communication
30
nRF24L01 RF Module
Advantages
❑ Low Power: Perfect for battery-operated devices.
❑ High Communication Range: Ideal for IoT applications.
❑ Easy to Integrate: Supports SPI for simple communication with
microcontrollers like Arduino and Raspberry Pi.
❑ Reliable: Uses Frequency Hopping Spread Spectrum (FHSS) to reduce
interference.
31
nRF24L01 RF Module
32
nRF24L01 RF Module Receiver Code:
Transmitter // Include Libraries
#include <SPI.h>
// Include LibrariesCode:
#include <nRF24L01.h>
#include <SPI.h>
#include <RF24.h>
#include <nRF24L01.h>
#include <RF24.h> // Create an RF24 object
RF24 radio(9, 8); // CE, CSN
// Create an RF24 object
RF24 radio(9, 8); // CE, CSN // Address through which two modules communicate
const byte address[6] = "00001";
// Address through which two modules communicate void setup() {
const byte address[6] = "00001"; while (!Serial);
Serial.begin(9600);
void setup() {
radio.begin(); radio.begin();
// Set the address // Set the address
radio.openWritingPipe(address); radio.openReadingPipe(0, address);
// Set module as transmitter // Set module as receiver
radio.stopListening(); radio.startListening();
} }
void loop() {
void loop() { // Read the data if available in buffer
// Send message to receiver if (radio.available()) {
const char text[] = "Hello World"; char text[32] = {0};
radio.write(&text, sizeof(text)); radio.read(&text, sizeof(text));
delay(1000); Serial.println(text);
} }
}
33
⮚ Wireless Sensor Networks – Remote data collection from environmental or industri
nRF24L01 RF Module
Applications
sensors.
⮚ Home Automation – Wireless control of smart devices like lights, fans, and door locks.
⮚ IoT Applications – Seamless communication between IoT devices for real-time monitorin
and control.
⮚ Robotics and Automation – Wireless control and coordination of robots and automate
systems.
⮚ Remote Control Systems – Stable, long-range control for RC cars, drones, and robot
projects.
34
THANK
YOU
35