0

I'm doing a research for RGB LED chips that MCU can control with one pin. I found this LED chip and it seems controlling LEDs is not as I've tought. I understand hardware part, software side is a problem.

In chip's datasheet, on page 6, you can find chapter four Data Transfer Format.

My questions are: Why D2 has only second 24 bit, third 24 bit while D3 has only third 24 bit and why D4 has no bits? What should I do when I'm done with "updating LEDs"?

I thought controlling LEDs can be done like this:

  • Lets say I have five LEDs to control. Every LED has Red, Green and Blue and every color is 8-bit. Five times three is 15 bytes array.
  • First three bytes in array are for last LED chip. While sending the data, highest bit(bit 7) will go first.
  • After first three bytes, MCU will stop for X microseconds. After delay, new three bytes will push old three bytes to second LED chip.
  • After MCU is done with sending data, it will leave data pin low.

Thanks!

3
  • 1
    first 24 bits are for the first LED chip .... each LED chip does the same thing ... after reset, it takes ownership of the first 24 bits of data arriving at its input pin and passes the rest of the bits to its output pin
    – jsotola
    Jan 23, 2021 at 18:15
  • 1
    This protocol looks an awful lot like the protocol of the WS2812 chips. There are libraries for driving those. Search for “Neopixel”. Jan 23, 2021 at 20:55
  • @EdgarBonet Yes, but I want to make own lib for that since Neopixel and FastLED are too heavy for my needs.
    – Pararera
    Jan 23, 2021 at 21:09

1 Answer 1

1

You need to send the 5x24 bits out without a pause. If you then keep the line low for over 80us, that is interpreted by all LED drivers as the reset signal. It is not stated explicitly in the datasheet (at least I haven't found it), but I guess the reset signal means, that at that time all drivers will output the received values on the LEDs. That way you can light up all LEDs at the same time with their respective data.

The picture, that you refer to, explains the automatic data cascading. The first row is what you actually send from your microcontroller and also what is seen by the first LED driver in the row. That driver will then consume the first 24 bits, that it sees. After that, it will forward the rest of the data to the next LED driver. That will now consume the first 24 bits that it sees (thus the second 24 bits, that you have send). The third LED driver will do the same. But since in that example you only send data for 3 LEDs, no data is forwarded. Then the reset pulse happens and at some point in time you send a new set of data.

So each row represents, what the corresponding LED driver will see of the data, that you send. D1 sees all the data. Each following LED driver will see 24 bits less. D4 will see nothing, since you send only 3x24 bits in that example.

2
  • Why they using pause after every 3x24bits?
    – Pararera
    Jan 23, 2021 at 19:13
  • 1
    Because the example only has 3 LEDs. You do a pause, when you have send all the data, because a pause of more than 80us will set cause the LEDs to actually activate the values, that you send it. You can send how much data you like, but at the end you need to do a pause to actually output the data on the LEDs
    – chrisl
    Jan 23, 2021 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.