Saturday 2 July 2022

NRF 51822 BLE module sensor with Arduino IDE

Radioland  BLE beacon module datasheet:


can be reprogrammed with Arduino IDE and ST Link V2  to special remote button  application.

SWDIO     ->   SWDIO
SWCLK    ->   SWCLK
3.3V         ->   BAT+
GND        ->   BAT-














3D printed cover for BLE module:






 Arduino IDE libraries for NRF51822  and instructions can be found from:

https://github.com/sandeepmistry/arduino-nRF5


Nrf51822 Bluetooth low energy stack (Softdevice)  version S130 is required to download and flash to device before BLE application software can be programmed :

Selecting a SoftDevice

SoftDevices contain the BLE stack and housekeeping, and must be downloaded once before a sketch using BLE can be loaded. The SD consumes ~5k of Ram + some extra based on actual BLE configuration.

  • SoftDevice S130 v2.0.1 supports Revision 3 of nRF51 in peripheral and central role. It is 108k in size.

Flashing a SoftDevice

  1. cd <SKETCHBOOK>, where <SKETCHBOOK> is your Arduino Sketch folder:
  • OS X: ~/Documents/Arduino
  • Linux: ~/Arduino
  • Windows: ~/Documents/Arduino
  1. Create the following directories: tools/nRF5FlashSoftDevice/tool/
  2. Download nRF5FlashSoftDevice.jar to <SKETCHBOOK>/tools/nRF5FlashSoftDevice/tool/
  3. Restart the Arduino IDE
  4. Select your nRF board from the Tools -> Board menu
  5. Select a SoftDevice from the Tools -> "SoftDevice: " menu
  6. Select a Programmer (J-Link, ST-Link V2, or CMSIS-DAP) from the Tools -> "Programmer: " menu
  7. Select Tools -> nRF5 Flash SoftDevice
  8. Read license agreement
  9. Click "Accept" to accept license and continue, or "Decline" to decline and abort
  10. If accepted, SoftDevice binary will be flashed to the board

There are some examples in

Arduino BLEPeripheral library:





My own Arduino projects for NRF51822 can be downloaded from:



The project real time clock button is nrf51822_sensor_rtc   and it requires to modify delay.h and delay.c in Sandeep Mistry's nRF51 library, because it is using nRF51822 device RTC1  counter, that is also used in Sandeep's library ( millis() and delay() ).


With nRF Connect  Android application nrf51822_sensor_rtc  project features can verified:




Services and Characteristics defined in Arduino code:


BLEService mainBleService("c83e0fa6-f5b7-473a-a2a2-3957117a2f58");
BLEUnsignedIntCharacteristic sensorCharacteristic("8afc0cf0-19bf-4bd2-9413-6e7259765edf", BLERead | BLEWrite | BLENotify); BLEService batteryService("180F"); BLEUnsignedCharCharacteristic batteryLevelCharacteristic("2A19", BLERead);



Can be verified on nRF Connect application:     - battery level is actually 20x mV instead %     - sensorCharacteristic when button pressed shows 32 bit (4 bytes) data including:         - seconds,minutes,hours and button counter value(byte)











Tuesday 8 March 2022

Simple digital wireless BLE oscilloscope


Cheap and simple DIY bluetooth low energy digital oscilloscope made with JDY-08 BLE module and STM8S103 module and Li ION battery.
Android application is developed to display oscilloscope data. 


STM8S103 is 8-bit microcontroller with 1024 bytes RAM and 8 kbytes Flash memory. It stores 300 samples of 10 bit ADC data to RAM memory. Minimum sampling period is 5 us (200 kSamples/s).  ADC data is sent trough BLE link to Android smartphone application. 

Circuit diagram