I want to control several microcontrollers from a mobile app. What I need is for each controller to receive a set of bytes, for it to process. What's a decent way of setting something like this up?
Specifically, each receiver controls three lights (LEDs) which should light up according to the byte received. The purpose of this is visual effect :-)
This is all short distance (within same room) and since we're blinking lights, there's a natural limit on rate (let's say max 60Hz). So the data rate is not high. 9600 baud gives 960 bps, and 16 bps at 60Hz. If we have N receiver units, receiving 1 "addressed" byte every r=1/60 second, it's possible to have N=16 such units. I'm thinking Bluetooth is a convenient protocol for interfacing from a mobile app. Maybe a bunch of HC-06 modules?
- However, is it possible to "broadcast" to all N receivers (from the app) or must I pair with each module separately?
- I'm thinking bytes may contain an address part -- say, first 4 bits -- which the receiver can use to filter out its bytes and process its payload
- Should I transmit in real time, sending N bytes every r seconds, relying on controllers to receive, filter and process the bytes as they arrive?
- Or should I buffer bytes in memory, trnasmitting larger packets of "blink bytes" at a time?
If I go for the buffer approach, the design would be based on that the buffer is sufficiently large to keep the blinking going until the next packet is received (and added to the buffer). Since the processing is quite slow (max 60Hz, presumably a lot slower) the buffer doesn't really need to be very large at all.