Bluetooth Low Energy (BLE) beacon with nRF24L01(+). Data is received and displayed by Android device (Android app source code is attached).
nRF24L01 as Bluetooth Low Energy (BLE) Broadcaster/Beacon
Temperature measured by a DS1820 sensor is broadcasted by a nRF24L01(+) module as Bluetooth Low Energy signal. Data is then received and displayed on an Android device (smartphone/tablet) with Bluetooth Low Energy (Bluetooth Smart) enabled. In order to have Bluetooth LE available your device should run Android 4.3 or more recent.
- mbed module
- nRF24L01 or nRF24L01+ module
- DS18B20 or DS18S20 sensor
- 4.7k Ohm resistor
- Android device with Bluetooth LE enabled (Android 4.3 or more recent)
Figure 1: The hookup and the Android app in action
It was Dmitry Grinberg who figured out how to use nRF24L01 for BLE.
Read his amazing "Bit-banging" Bluetooth Low Energy. Thank you Dmitry!
I ported the code to mbed from Lijun's repository. Read his very neat article on the topic. Thank you Lijun!
It takes just few steps to build a Temperature Beacon
- Connect the nRF24L01(+) module and the DS1820 sensor to the mbed board according to the pin assignment defined in main.cpp. Don't forget to connect a 4.7k Ohm resistor between the DS1820's data pin and the +3.3V pin.
Figure 2: nRF24L01(+) pinout
- Compile the project and save the binary file to your mbed module.
- Enable Bluetooth on the Android device.
- To view the raw data, install Nordic's nRF Master Control Panel (available at Google Play for free) to your Android device. Run the app and wait until a new nRF24L01 device is found. Do not tap the CONNECT button. This device is a broadcaster and enables only one way data flow (from the mbed to the Android). To see more details, tap the found nRF24L01 device on the left side of the screen and then the small RAW button which appears on the right side just below the CONNECT button. Now you should be able to see and check the raw bytes received from the mbed.
- Install the Android app:
- Download the TemperatureBeacon app to your computer's folder of choice.
- Open the folder and copy (send via Bluetooth or USB cable) the downloaded file to your Android device.
- To install the app, open the folder on the Android with the file downloaded in the previous step and tap it.
- Once the app is installed and running:
- After a while you should see the temperature displayed on Android (See in Figure 1).
- Data is periodically updated. To verify that, touch the DS1820 sensor and you should see some new values.
If you'd like to adapt the Android app to your taste
- Install Android Studio onto your computer (Window, Mac, Linux). It's a fantastic IDE from Google for free.
- Download the Android app project to your computer's folder of choice and unzip.
- Start Android Studio, open the project downloaded in the previous step and have fun.
I have learnt a lot about Android and Bluetooth Low Energy here:
The Android app is based on:
Thank you Dave!