Bluetooth Low Energy (BLE) beacon with STM8 and nRF24L01+

Making a cheap BLE beacon with STM8 and nRF24L01+


Building cheap Bluetooth Low Energy beacon with STM8 and nRF24L01+

Few years ago BLE beacons were all the rage. Apple and Google supported them in their mobile OSes and pushed the technology for all imaginable applications. Apple had iBeacons and Google Eddystone beacons.

Then the hype went away. And Google removed the “Nearby Notifications” support from Android. But the technology is still usefull, and can be used with specific mobile applications.

Personally I have played with BLE during last couple of years, and experimented with Nordic NRF5 and Espressif ESP32 microcontrollers. They are of cause relatively cheap and perfectly capable platforms to build BLE beacons.

But there is another, hackier and even slightly cheaper way to implement a BLE beacon.

It uses low-cost nRF24L01-module for BLE compatible radio and STM8 development module as a microcontroller.


Nordic Semiconductor produces a venerable and rather inexpensive, 2.4GHz, proprietary radio module NRF24L01+. And it turns out that the protocol it uses is rather close to one used by Bluetooth Low Energy. Some years ago Dmitry at figured out how to use NRF24 to broadcast BLE advertising compatible transmissions. He included code how to do that.

Idea to use that for Eddystone URL-beacon, and some related code, I found from .

My implementation adds related STM8 code and also support for interleaved Eddystone telemetry (TLM) frames containing temperature data, which can be read from attached DS18B20 sensor.


I am using the cheapest Chinese STM8S103F3P6 based minimal development board available from Ebay/Aliexpress (“STM8 Minimum System Development Board Module”).

Connect NRF24L01 to that (see code for pins). Connect DS18B20 to pin B4 and a 4.7kΩ resistor between 3.3v and data pin.

Development environment

Linux, SDCC-compiler and stm8flash (



Flashing issue with some of the cheap STM8S103F3P6 minimal development boards

If your STM8 flashing fails with “Tries exceeded”, a problem may be about chip protection. User minibull has a solution at :

echo "00 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > factory_defaults.bin
stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w factory_defaults.bin

Program xxd seems to come with vim…

Incorrectly marked pins

It looks like some some STM8 boards I got have incorrect pin markers for at least for pins C3 and B4 (marked as “C8”, “D4”).


My code for STM8 with NRF24L01+ and DS18B20 temperature sensor, implementing Eddystone URL-beacon+TLM is available at

Git branch ‘temperature-beacon’ contains a version that broadcasts only temperature data without any Eddystone data.