1
\$\begingroup\$

I want to control multiple LED panels that have each a chap ATTiny on them which controls some WS2812 LEDs. There's a Master controller with an ESP8266 that is meant to send commands to the individual panels like Panel1: color=red. Which would be the best solution to let the MCUs talk to each other? What i thought about:

  • SPI: I wouldn't use it, since I'd need a CC/CS line to every Panel
  • I2C: Better, Bus system looks good but the cheapest ATTinys don't support it
  • Serial: Not a Bus system

Some Bus system like CAN would be ideal, however this isn't supported on the smaller ATTinys and cost is an issue here.

\$\endgroup\$
6
  • \$\begingroup\$ SPI and I2C are serial comms so, what do you mean by Serial: Not a Bus system ? \$\endgroup\$
    – Andy aka
    Jul 18, 2021 at 15:29
  • \$\begingroup\$ I understand Serial to be a Point to Point Communication, so I can't hook up multiple receivers to the master, right? \$\endgroup\$ Jul 18, 2021 at 15:34
  • \$\begingroup\$ Do you want me to repeat what I just said in the earlier comment or, should you go and convince yourself about it? Maybe you are thinking of UART serial comms with no added hardware interface? \$\endgroup\$
    – Andy aka
    Jul 18, 2021 at 15:40
  • 1
    \$\begingroup\$ If you only need one-way communication - master to slaves - you can use UART serial communications - the master can talk to any number of slaves. Problems only come if you want the slaves to talk back to the master. \$\endgroup\$ Jul 18, 2021 at 15:53
  • 1
    \$\begingroup\$ RS485 is a serial bus, but you can do a serial bus without RS485 too. \$\endgroup\$
    – Justme
    Jul 18, 2021 at 15:56

1 Answer 1

1
\$\begingroup\$

As commenters suggest, you should be looking into serial protocols. The ATTINYs can support pretty much any protocol, so you want to pick one that will best fit your needs.

You could use a one-way protocol by assigning an address to each node (a ATTINY with LEDs), connecting them all to a common serial bus, and then sending packets like "Hey, address #4, switch to RED" from the controller. Each node would ignore any packets not sent to its address.

If these nodes are going to be far apart, then getting the signal to travel reliably is likely going to be one of your challenges.

If you are willing to add more hardware, then RS485 (and related current loop systems) are a time proven way to reliably move data over long wires and the hardware can be very cheap. For example, these adapters cost less than $2 each.

If the nodes are not going to be too far apart and you do not want to add extra hardware, then I'd recommend using the chip's USART to read rs232 style serial data at a relatively low speed - the slower the more realizable. Connect the TX pin on the controller to a wire, and then connect that wire to the RX pins on all the nodes. You must also connect all the grounds together.

If the nodes are all going to be in a row, then you can get slightly more complicated and daisy chain the nodes so that each one's RX pin is connected to the TX pin of the next one all the way back to the controller. This can effectively extend the maximum total length the data can travel.

Of course there also also many, many other ways to do this and the best one is really the best one for your particular situation so hard to pick without knowing more details and requirements.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks that helped a lot! So if I use USART and broadcasting my tx to all rx I'm good. But I also need my Master to know how many or which slaves are listening so I'd need some way to communicate that. If I also put all the slaves tx to the Masters rx and make sure only one slave talks at a given time, would that be possible? I kinda want I2C with more addresses (let's say 5000) \$\endgroup\$ Jul 20, 2021 at 9:28
  • 1
    \$\begingroup\$ @christopher -- That's a different question. This is the first time that you mentioned 5,000 (controllers? panels?). That 5,000 might change the answers more than just a bit! Please ask this as a completely different question, this time including the size of the problem you're asking us to help you with... and any other details you left out. Help us to help you. Incomplete questions result in answers that are also incomplete. Unfortunately, that wastes both your time, and ours, the time of our community. \$\endgroup\$ Jul 20, 2021 at 15:50
  • \$\begingroup\$ @Christopher if you really need to dynamically know when nodes are joining and leaving, there many ways to do this, but you can not just directly connect multiple TX lines together without some way (electrical, protocol, or both) of making sure they do not fight with each other (one trying to send 1 while another sends a 0). \$\endgroup\$
    – bigjosh
    Jul 20, 2021 at 20:29
  • \$\begingroup\$ @Christopher Almost all of design is about finding the best set of trade-offs to solve a specific set of problems. The best answer to "What is the best form of transportation?" is quite different if you want to get from Moscow to Buenos Aires than it is if you want to get from East 78th Street to Times Square. \$\endgroup\$
    – bigjosh
    Jul 20, 2021 at 20:33

Your Answer

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

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