Worksheet 9
Worksheet 9
Worksheet 9
Experiment 09
Name: Drishti Solanki UID:20BCS1062
Branch: B.E-CSE Section/Group:712/B
Semester:6th Date of Performance:04/05/2023
Subject Name: IOT Lab Subject Code:20CSP-358
Components Required:
• Arduino
• HC-05 Bluetooth module
• Solder less breadboard
• 3 Led's • 3 220Ω resistors
• Wires
• Most importantly your phone and a downloaded Bluetooth app (Arduino
Bluetooth Controller, which offers many different features)
Step 2: Circuit
Led's connection
If the led on the Bluetooth Module is blinking quickly then it is ready to pair to your
phone, if not then check your connections
Code:
Let’s get started right away with the Arduino Bluetooth Tutorial, where I’ll provide all
you need to know about pairing Arduino with Bluetooth. Ranging from hardware
configurations to programming and using it with your iPhone or Android devices!
1. Arduino Bluetooth:
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Flexible and packed with high Bluetooth transmission speed, the Grove – Blueseeed LE
– Dual Model (HM13) uses a CSR dual-mode Bluetooth chip, with the ARM
architecture single chip that supports AT instructions.
2. Hardware configurations:
Step 1: Connect the Grove – Blueseeed – Dual model (HM13) to a Grove port on the
Grove – Base Shield via the Grove cable
Step 2: Plug Grove – Base Shield into your Arduino board Step
3: Connect your Arduino to PC via USB cable
Step 2: Send “AT” to Bluetooth with the serial terminal to check if you receive an “OK”
The Bluetooth only respond AT commands either when: No connection is set up All
commands were seen as string and sent out
*You can distinguish the above status in step 2 through LED indications.
We used two Bluetooth that were connected with the PC, with one set as central while
the other as Peripheral. Several seconds later, they find each other, and the LED stops
flashing connected!
Since the Grove – Blueseeed – Dual model (HM13) have two protocol: Bluetooth EDR
(Enhanced Data Rate) and Bluetooth Low Energy (BLE), it can communicate with
either Andriod or iPhones!
For this part of the tutorial, we’ll use an iPhone to demonstrate how you can interact
with Bluetooth!
*Note: The tutorial below is run on an older version of ios but it should still work the
same
Step 4: Touch on properties and hit “listen for notifications” to enable data receiving
There’s a “Hex” key on the top right under properties to change data format as well
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
Step 5: Hit “Write new value” and write some words to start sending data to the PC
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
With the serial terminal, you can transfer data from the PC to iPhone as well:
Now after all the above steps, are you ready to code? In this final section, we’ll use
two Arduino Uno and a pair of Bluetooth modules to get started!
Step 1: Set up the connection mentioned in the hardware configurations section
Step 2: Assign the Bluetooth to the Central role by modifying the text to “#define
MASTER 1”
The program of Central and Peripheral use the same code but there’s a difference
in the micro define at the beginning of the program
Step 3: Follow the flow chart below for initialization of the program
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
After the initialization, the Central and Peripheral will do different things; Central will
send a message to the Peripheral interval and print what’s received from the Peripheral
while the Peripheral only responds to the central
Step 4: Download the test code and open HM-13_SW.ino with Arduino IDE, compile
and download to Arduino Uno
Remember to configure the Bluetooth to the different role by modifying the macro at
the beginning
Step 5: After the program is downloaded, open two serial terminal windows and wait
for the Bluetooth connection
A connection is indicated by: LEDs on the Bluetooth modules will flash for a few
seconds, stop flashing, and kept on
According to the program written, the Central will now send a message to the
Peripheral continually and get feedback every time
As the first wireless product in the Seeed XIAO family, Seeed XIAO BLE & BLE
Sense has equipped a powerful Nordic nRF52840 MCU which is designed in a
Bluetooth 5.0 module, built around a 32-bit ARM® Cortex™-M4 CPU with
FloatingPoint Unit(FPU) operating at 64Mhz.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING