I’m working on a hobby project where I want to individually control 20 RGB LEDs which will be on individual wires that can be daisy chained in whatever order I want.
I’ve read up on the individual addressable LEDs but it seems that whilst you can control them individually, the way they work is the microcontroller sends instructions to individual LEDs based on their location along a string (ie LED01, LED02, etc). So if an individual LED was LED08 (as it was in position 8 along the string), and you then move it’s placement so it’s at the end in position 20, then it now becomes LED20 and you have to change your coding accordingly.
Ideally what I am looking for is something where each of the individual LEDs has an ID# which always remains with it, so even if I unplug and rearrange the order of the LEDs, and maybe remove some, when the microcontroller sends an instruction to LED#19, then the same LED will respond irrespective of where it is, and if it’s not plugged in then nothing happens.
I guess this is similar to smart lighting in a house (ie Phillips Hue light bulbs) where you can tell the controller to turn the lounge room light on and it will, and it will always remember which light bulb is Light#1 even if I plug it into another room, or add other light bulbs to the house.
Does anyone have any ideas how I can get this to work?
I'm not aware of any LEDs like you describe that are available to buy.
Perhaps you could connect a small microcontroller to each led, such as an ATtiny45, and invent your own serial/UART protocol where the master controller sends the ID# followed by the r, g, b values. Each ATtiny would be programmed with it's own ID#.
This idea would result in many Rx pins connected to the Tx pin of the master and with enough LEDs connected, this would degrade the signal so much that it cannot be read.
So another option would be to have the master transmit to the first LED's Rx pin only. That LED would check the data for it's own ID# and, if it does not match, re-send the data to the next LED in the chain using it's own Tx pin.
Thank you, this is exactly where I ideally would like to get my project to.
If I were to use a wireless controller attached to each LED, then each LED would have a gatekeeper deciding when it actions a request. I could then send out an instruction to all wireless controllers to give an instruction to wireless controller #3, and only wireless controller #3 would respond and action the request for the LED attached to it. This would then allow me to move the LED's around in their position within the string and I won't need to change my coding to adjust for the changed position.
Do you have a suggestion for a very small (and cheap) wireless controller?
Thank you! What you have suggested is a solution that I believe will work for what I am needing. If I have a controller attached to each LED then the controller will control what the LED does and I can assign a # to each controller which will then allow me to send instructions to that controller irrespective of where that controller is in the string of LED's.
Do you have any suggestions for a micro controller that could be attached to the underside of the LED PCB?
If you have a strong WiFi Access Point, then you can use the ESP32 with WiFi.
The ESP-NOW is a communication between ESP32 boards. Here is a tutorial: https://randomnerdtutorials.com/esp-now-one-to-many-esp32-esp8266/
There are many other wireless options (not always reliable), depending on the range that you need.
The RadioHead library can do a lot with wireless: https://www.airspayce.com/mikem/arduino/RadioHead/.
But some wireless modules have counterfeit chips. With ESP32-NOW, you know that Espressif made it.
The newer variations of the ESP32 have often all kinds of small improvements. For example the ESP32-C3 is a single core small module.
I gave a suggestion in post #4. However, I'm not sure ATtiny45 can support 3x PWM pins and Rx/Tx for serial comms. @DrAzzy is familiar with a these chips and a wider range of small MCU, perhaps he can suggest others.
In order to reduce the pin count of these MCU and keep them small, you could use ws2812 LEDs with them, one ws2812 led per MCU. Then, the addressing protocol of ws2812 LEDs would not be a problem and the MCU would translate between serial and ws2812 protocol, and only 1 MCU pin would be needed to drive the led.
But if an 8-pin MCU was used and is small enough, it should have enough pins to directly drive a "dumb" RGB led with 3 PWM outputs, and use 2 pins for serial communications. However, I'm not sure how well ATtiny45 can implement this, as mentioned already.
@gymbiker I suggest you begin by building prototypes for at least a couple of LEDs on Breadboard.