This code is designed to run on a Nordic Semiconductor's nrf52840.
Actually it was designed to run on SparkFun Pro nRF52840 Mini.
I'm considering to extends it to another boards in the future.
Anyway, porting it to any other nrf52840 board should not be a big deal.
- Download and Install nrfutil (linux)
- Download Nordic nRF5 SDK
https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK-for-Thread-and-Zigbee - Patching Nordic nRF5 SDK to support sparkfun board
Inside this github project you will find a folder named "patch" with two files:
- The boards.h.patch is a patch to the original boards.h located at
<nRF SDK root>/components/boards
. - The sparkfun_nrf52840_mini.h file must be copied to the same folter.
- The boards.h.patch is a patch to the original boards.h located at
- Create a projects folder inside the SDK root dir, at the same level that the example folder is.
$ mkdir <nRF SDK root>/projects
- Clone this repo inside the projects folder we just created
$ cd <nRF SDK root>/projects
$ git clone https://github.com/otaviojr/zigbee_light_sensor.git .
$ cd zigbee_light_sensor/sparkfun/blank/armgcc
$ make
- To flash, click the reset button twice and than:
$ make bootload SERIAL_PORT=/dev/ttyACM0
Since SparkFun Pro nRF52840 Mini has only one LED I will try to use it for everything.
Initialy the blue LED will blink fast to indicate that the node is trying to join a network. After the node joins a network the blue LED will blink slowly.
Since SparkFun Pro nRF52840 Mini has only one button, again, I will need to use it for everything.
The number of clicks will define which action have to be executed.
- 2 clicks - Change light sensor sensitivity
The LED will blink 3 times faster, then it will blink 1, 2 or 3 times slow, this is the sensitivity level, then, it will blink more 3 times faster. - 3 clicks - Blink the LED to show the current light sensor sensitivity
The LED will blink 3 times faster, then it will blink 1, 2 or 3 times slow, this is the sensitivity level, then, it will blink more 3 times faster. - 10 clicks - Factory Reset. Allow the sensor to join on a new network
- Low Sensitivity
(1x/402ms) - Medium Sensitivity
Is not working the way I want it to work, use the high and low sensitivity for now
(16x/101ms) - High Sensitivity
(16x/402ms)