ZLL – tl;dr

This page contains all relevant info on the custom, Hue compatible, Light Link firmware for the JN5168.

Currently up to 5 (monochrome) lights per JN5168 are supported, this is limited by the amount of PWM ports available. I am thinking about driving the leds through a separate PWM driver like this one. For this I need to figure out how to communicate with this driver. The use of an external driver would open up the possibility of multiple RGB, RGBW and Color Temperature lights. Theoretically the limit is 240 endpoints per JN5168, although available memory on the JN5168 will not allow this. With 5 lights I have seen no performance issues whatsoever, so there certainly is room to increase this number..

I will publish the sources once I figure out the external PWM.

I am in no way an expert on the matter so please do not take any of the information on this site for fact. Building your own lights is not something I would recommend, electricity is dangerous, and it gets people killed. So please, think and be careful!

For those still interested, these are the steps I took to build my own lights.

  1. Got me a JN5186 module
  2. Connected the hardware
  3. Downloaded a flash tool and a binary
  4. Flashed the JN5168 module
  5. Hue App -> Add lights -> Search
  6. Reset JN5168
  7. Enjoyed my lights 😉


JN5168

Any JN5168 module will probably do. My experience is with the JN5168-001-M00 module. All info on this page is based on this model.


 Connecting

  • Endpoint 1 => PWM : timer_00/PWM  – DIO10 – PIN 16
  • Endpoint 2 => PWM : timer_01/PWM1 – DIO11 – PIN 19
  • Endpoint 3 => PWM : timer_02/PWM2 – DIO12 – PIN 20
  • Endpoint 4 => PWM : timer_03/PWM3 – DIO13 – PIN 21
  • Endpoint 5 => PWM : timer_04/PWM4 – DIO17 – PIN 26


Downloads

Multi Endpoint Dimmable Lights

 

RGB (single) endpoint

This endpoint uses an inverted PWM signal, which means, it only works with a common anode LED, or a driver that requires an inverted signal.

Red : timer_01/PWM1 – DIO11 – PIN 19

Green : timer_02/PWM2 – DIO12 – PIN 20

Blue : timer_03/PWM3 – DIO13 – PIN 21


Programmers

Both will work, I use the command line tool.

  • Command line, registration required: here
  • Gui, no registration required: here


Erasing and Flashing

Put the JN5168 in programming mode by connecting SPIMISO (3) to ground while powering the module.

It’s a good idea to clear the eeprom before flashing it with a new binary.

Erase:

JN51xxProgrammer.exe -s COM3 --eraseeeprom=full

Flash binary:

JN51xxProgrammer.exe -s COM3 -f binary.bin

 

Comments

  1. thanks for your amazing work!

    i just installed your rgb firmware flawlessly on my MeshBees via UartsBee v5 – working out of the box!

    but one other question, are you able to also act as a switch/sensor for the hue network? i.E. make some extra buttons as light switches/dimmer/color changer and include sensors like brightness, humidity etc?

    If you are not able to read interrupts on the IO pins, maybe make it a simple router which gets commands via i2c or spi from an arduino and sends them as “switch” inputs to the hue bridge?

    thank you!

    best regards
    basti

    1. What you want is all possible, I’ve been experimenting with I2C and it works just fine. Check out the NXP demo project, this contains an example controller and should get you started.

  2. Do you know in theory what the maximum number of endpoints could be on a single JN5168?
    I have a bank for 16 relays currently enabling on/off control of most of the ceiling lighting across my home. Via raspberry PI as REST API
    I’m really interested in replacing the PI with a couple of JN5168s allowing me to control the ceiling lights via the Hue Hub and Google Assistant so I have a single place to control all the lighting.

    1. The theoretical (Zigbee) limit is 255, but the hardware configuration of a JN5168 (32kb memory) limits this to a way lower number. While working on the multi endpoint lights, the max number of endpoints seems be 5 for monochrome and 4 for RGB lights. Maybe a simple on/off light will allow for 6 endpoints. These numbers are based on my implementation and there may be room for some optimization, allowing a higher number of endpoints.

  3. Hi,

    I just tried your binaries, they work flawlessly. Thank you very much. Are you planning to add more “bulbs”. Maybe something like white ambience? I think a switch/scene selector would also be cool.

    I am planning to develop some devices myself. But on the NXP site the download for the SDK and IDE is missing. They are having some issues with their servers, bummer.

Leave a Reply

Your email address will not be published. Required fields are marked *