No description
  • C 93.7%
  • Makefile 5.5%
  • Linker Script 0.8%
Find a file
2021-05-25 12:01:23 -03:00
config adjustments 2021-05-25 11:41:21 -03:00
patch patch board.h and sparkfun header file 2021-05-25 11:48:29 -03:00
sparkfun/blank adjustments 2021-05-25 11:41:21 -03:00
.gitignore initial 2019-07-24 23:55:59 -03:00
main.c adjustments 2021-05-25 11:41:21 -03:00
README.md instructions adjustments 2021-05-25 12:01:23 -03:00
tsl2561.c readme 2019-08-12 14:22:33 -03:00
tsl2561.h Light sensor medium level sensibility. Using led to show the current sensibility. 2019-08-11 22:19:03 -03:00
tsl2561_lux.c working on light sensor 2019-08-09 17:20:00 -03:00
tsl2561_lux.h working on light sensor 2019-08-09 17:20:00 -03:00
twi_config.h working on the i2c communication with tsl2561 digital light sensor 2019-08-02 17:31:39 -03:00
zb_light_sensor.h Router + Ajustes + Testes Hubitat 2020-12-18 17:26:32 -03:00

Zigbee Light Sensor

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.

Materials

  1. SparkFun Pro nRF52840 mini
  2. SeeedStudio Digital Light Sensor
  3. Qwiic Grove Cable Adapter

Preparing

  1. Download and Install nrfutil (linux)

Compiling and Flashing

  1. Download Nordic nRF5 SDK
    https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK-for-Thread-and-Zigbee
  2. Patching Nordic nRF5 SDK to support sparkfun board
    Inside this github project you will find a folder named "patch" with two files:
    1. The boards.h.patch is a patch to the original boards.h located at <nRF SDK root>/components/boards.
    2. The sparkfun_nrf52840_mini.h file must be copied to the same folter.
  3. Create a projects folder inside the SDK root dir, at the same level that the example folder is.
$ mkdir <nRF SDK root>/projects
  1. 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
  1. To flash, click the reset button twice and than:
$ make bootload SERIAL_PORT=/dev/ttyACM0

LEDs

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.

Buttons

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

Light Sensor Sensitivity Level

  1. Low Sensitivity
    (1x/402ms)
  2. Medium Sensitivity
    Is not working the way I want it to work, use the high and low sensitivity for now
    (16x/101ms)
  3. High Sensitivity
    (16x/402ms)