Items used in this project
Bluetooth is one of the main connectivity technique used for short range connectivity in many devices. After the evolution of Bluetooth Low Energy it becomes more attractive to engineers and DIY hackers because of its low energy consumption. Many modules are available in the market which are easily interfaceable with ‘Hackers toys’ like Arduino, Particle, Raspberry Pi, etc. Because of this high demand Arduino release their Arduino 101/Genuino 101 with inbuilt BLE module and Raspberry Pi3 has also got the inbuilt BLE.
This is the era of smartphones. People's daily life is highly depends on their smartphones. Almost all wearables are communicating with smartphones Via Bluetooth. There are many application of BLE in healthcare devices also which senses body sensor values like heartbeat and transmit into smartphones and then to cloud.Part 2
I have worked on classic Bluetooth module HC05 as well as Adafruit Bluefruit BLE module. Many BLE modules are available in the market. In my research most of these BLE modules are working in peripheral mode. In this mode modules only can advertise their payload. It can not scan any other BLE modules in range. For scanning you will have to use BLE modules which supports Central mode. Usually the BLE modules in laptops and smartphones are coming with central mode. There are some DIY friendly central mode supported Bluetooth modules also available in the market. None of them are tested by me. HM10, BLE mini RedBear and BLE Nano RedBear are such modules which can be used in central mode.
Adafruit Bluefruit LE UART Friend is One of the coolest and easily interfaceable BLE modules available in the market. Since it is developed by Adafruit there are many documentation and tutorials are available in the internet. Adafruit also giving an Arduino support library.
The examples are written to communicate with adafruits bluefruit LE app. There are codes available for BLE as beacons, uribeacons, eddystones, etc. Now I would like to explain how to modify this codes to our way. Ie how to control things using your smartphone and BLE.Example for Arduino BLE to Android Communication
You can find the Fritzing file here.List of components
- Arduino Pro Mini
- Resistor 330 ohm
- bluefruit LE app or any other custom designed android app
- Arduino pin 9 ----Bluefruit RX
- Arduino pin 10---Bluefruit TX
- Arduino pin 11---Bluefruit CTS
- Arduino pin 12---Bluefruit Mode pin
- Arduino GND---Bluefruit GND
- Arduino Vcc---Bluefruit Vcc
- Arduino pin 3---led
- Arduino pin 6---Buzzer
This example demonstrates how a device can be controlled using your smartphone. Here I am controlling an LED and buzzer using an Android app. This device will read incoming data from any other BLE device (which is working in central mode) and do actions.
Incoming data Actions
- character 1(ASCII49) ---------- LED ON
- character 2(ASCII50) ---------- LED OFF
- character 3(ASCII51) ---------- will reply "Thank you for reading wiring it my way"
- character 4(ASCII52) ---------- BUZZER ON
- character 5(ASCII53) ---------- BUZZER OFF
You can use your own BLE app. Here I am using Bluefruit LE app from Adafruit. In that after pairing your device to your phone open UART mode in your app and send different characters like 1, 2, 3, 4, 5 and test your BLE. As you know this is only the basic intro off BLE. Now try your own devices like BLE controlled toys, sensor data apps etc. Please commend your BLE experiences.