Bluetooth configuration | MindPlus Coding Kit for Arduino Started Tutorial E20
userhead
AshG Oct 21.2021
projectImage

Arduino Bluetooth communication

Chapter 9 Getting to Know Bluetooth

Bluetooth is closely related to our lives as a wireless communication technology. Bluetooth headsets and sound systems are all based on this technology. Bluetooth is a radio technology that supports short-range (usually within 10m) device communication. Its biggest advantage is that it transmits data highly efficiently with very low power consumption.

projectImage

In this lesson, we will learn how to use the Bluetooth module to achieve data communication between the mobile phone and the Arduino main control board.

 

Project 1 Bluetooth configuration

First, we need to configure the Bluetooth module. It mainly needs to configure the Bluetooth master and slave mode and naming of Bluetooth devices. This step will guide us to understand how to configure Bluetooth modules, and check if Bluetooth module is working properly.

 

projectImage

Task Navigation 

1. Understanding Bluetooth AT commands

2. Configure the Bluetooth module

Knowledge point analysis 

1. What is an AT instruction?

AT is the abbreviation of Attention. AT instruction is an instruction for connections and communications between Bluetooth devices. In this section we use AT commands to change the working status of Bluetooth. The list of commands can be referred to from BLE Bluetooth module AT command list.

In this section we mainly use the AT command to control the Bluetooth module to modify the name, set master-slave mode, restart, etc.

projectImage

2. What is the master-slave mode of Bluetooth ?

projectImage

Master device mode: working as the master and can connect to a slave device. In this mode, you can search for surrounding devices and select devices that you want to connect to. In this section our master device is a mobile phone.


Slave device mode: The Bluetooth module working in slave mode can only be searched by the host, and cannot start a search. When connected to master device, slave device can send to and receive data from master device. In this section, we need to set the Bluetooth module to slave mode to be searched from master device.

3. What is the difference between master mode and slave mode?

The master device is capable of searching other devices and initializing connection, while slave device cannot initialize a connection and has to wait for other devices to connect to it.

Hands-On 

Hardware connection

First connect the Bluetooth module to the IO sensor extension board, and then connect the extension board to the Arduino UNO, as shown in the figure.

projectImage

Programming

1. Reference program

The naming of the Bluetooth module: it is recommended to define a name for yourself. When multiple people use the BLE Bluetooth module at the same time, it is recommended that everyone set a unique name for Bluetooth so that it is easy to distinguish which module is yours. Keep the name in your mind after defining it, because it will be used in later cases.

When you upload the program, the dial on the extension board needs to be on PROG (upload mode). After uploading, switch it back to RUN to run the program.

projectImage

 

2. Program results

1. Connect Bluetooth with your phone

After completing the above configurations, we can use the provided debugging app (note that currently the Bluetooth control app can only be used on Android system phones) and search for the Bluetooth named “BLE001”.

(This lesson is Getting to Know Bluetooth. We’ll use a simple app to let everyone connect via Bluetooth. Here is a read-made phone app. > Click here to download <, download it to your Android phone, and install the BLEtest.apk app on your phone)

 

projectImage

Use the mobile app to connect the BLE Bluetooth module. After the connection is successful, the LINK indicator light will be on.

projectImage
FILE
Program 9-1 E20.rar 165KB Download 0
License
1
All Rights
Reserved
[[i.text]]
licensBg
0
0
COMMENTS ([[commentTotla]])
[[c.user_name]] [[c.publish_time]]
[[c.parent_comment.count]]