Arduino BLE
for BLE novice
First BLE Arduino
The first BLE product I got was DFRobot Bluno nano 5 years ago. I didn’t have much knowledge about BLE at that time. Bluno uses same TX/RX Serial with USB serial. The example code looks like simple Serial communication.
void loop() {
if(Serial.available()) {
byte data = Serial.read();
Serial.write(data); //send what has been received
}
}
Wow!!! BLE is very easy. It’s time to code it. Most of the BLE Arduino provides sample Arduino code and Android/iOS App.
Finally analyzing Android client software I found BLE is totally different from BT SPP (Serial Port Profile). so… study BLE.
BLE is not BT
BT and BLE chip is connected to UART interface, so easily access through Arduino Serial. Some product does not interface hardware UART interface, Arduino Software Serial library may be necessary.
BT Programming with Arduino is simple. You can receive/send data by read/write standard serial device file such as /dev/tty.HC-05-SPPDev.
BLE has Master (Central) and Slave (Peripheral) devices. Master scans and Slave responses, Master discovers needed characteristics of the Slave. After this kind of pre-work happens communication can be started. Connection is lost after defined timeout period. BLE is designed to communicate with sensors : “Connect, get (or set) data and disconnect” works in a short period of time, that makes BLE device low power.
Here is the model of a peripheral device (e.g. temperature sensor) and three master devices who want to get sensor information (temperature).
Nice!!! We understand peripheral and central devices.
Recent Arduino Nano 33 IoT, 33 BLE needs Arduino BLE Library, because the library helps the Arduino config Service and Characteristic. However Bluno does not need this kind of library, that is, you can not config BLE peripheral device service and characteristics. Modifying firmware may be needed to do this kind of configuration change.
Keywish BLE Nano : Cheap Arudino BLE
Keywish released new cheap BLE Nano which is almost same as Bluno based on ATmega 328p. This board is from China. The price is less than $5. The price of new Arduino Nano 33 BLE is $19, Bluno is $24.
If you are friendly to previous Uno Nano product, BLE Nano is a good product for starting BLE. If you are going to service with your own or GATT-define UUID, there are several choices : Arduino Nano 33 BLE, ESP32, or Intel Curio.