-
Notifications
You must be signed in to change notification settings - Fork 0
RGB Master Slave
The general idea is to have many "cheap" slave devices, each controlling one strip of RGB LEDs, and a Arduio (or similar) master device, controlling those slaves.
To get a cheap slave device I'd like to use a simple ATTiny board which can be controlled via Two Wire Interface (TWI, aka I2C) by the master.
The problem here is that, though the ATTiny supports a TWM by hardware, is has only three PWM pins which are necessary to control the RGB strip, and one of the PWM pins would be needed for the TWI.
Since I don't think that PWM makes sense without hardware support, I decided to try to implement the TWI "in software". This resulted in a slave device that is not fast enough to support the 100 kHz clock frequency of the standard TWI, but a clock of 30-50 kHz seems to work OK.
The master device was given fewer thoughts, leaving details here as an exercise for the reader... :-)
The most simple solution is probably an Arduino Uno type board using the Wire library with Wire.setClock(31000); to set the TWI clock to about 31 kHz.
As an alternative a Sparkfun Feather 32u4 Bluefruit was evaluated, which should allow controlling the LED strips using the Bluetooth Low Energy (BLE) protocol supported by many smartphones.
To use this board with the Arduino IDE the URL https://adafruit.github.io/arduino-board-index/package_adafruit_index.json has to be added in the preferences to the Board Manager URLs, the USB drivers for the Feather (as well as other Sparkfun boards) can be downloaded at https://github.com/adafruit/Adafruit_Windows_Drivers/releases/download/2.0.0.0/adafruit_drivers_2.0.0.0.exe
The BLE library of Adafruit for the Arduino IDE can be downloaded at https://github.com/adafruit/Adafruit_BluefruitLE_nRF51/archive/master.zip
More details can be found at https://learn.adafruit.com/adafruit-feather-32u4-basic-proto/using-with-arduino-ide and https://cdn-learn.adafruit.com/downloads/pdf/adafruit-feather-32u4-bluefruit-le.pdf