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
cd <SKETCHBOOK>
, where<SKETCHBOOK>
is your Arduino Sketch folder:
- OS X:
~/Documents/Arduino
- Linux:
~/Arduino
- Windows:
~/Documents/Arduino
- Create the following directories:
tools/nRF5FlashSoftDevice/tool/
- Download nRF5FlashSoftDevice.jar to
<SKETCHBOOK>/tools/nRF5FlashSoftDevice/tool/
- Restart the Arduino IDE
- Select your nRF board from the Tools -> Board menu
- Select a SoftDevice from the Tools -> "SoftDevice: " menu
- Select a Programmer (J-Link, ST-Link V2, or CMSIS-DAP) from the Tools -> "Programmer: " menu
- Select Tools -> nRF5 Flash SoftDevice
- Read license agreement
- Click "Accept" to accept license and continue, or "Decline" to decline and abort
- 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)
No comments:
Post a Comment