It can communicate over two different busses, I2C and Serial. The main focus for communication lies on the I2C-bus as where the Serial interface is more for monitoring and testing (only reading values).
Features
I have simplified the code and made some improvements regarding memory usage and the availability of the I2C bus. Next to that I added some extra features. So the complete list of features looks like this:
I2C-bus features:
- Get the current temperature reading
- Get the current Lux-measurement reading
- Get the current RGB values the LED-strip is set to
- Color the LED-strip at once
- Color the LED-strip using the fade function
- Color the LED strip using the wipe (from left to right or the other way around)
- Color the LED strip using the random function
- Color just one particular LED
- Turn the LED strip off immediately
- Turn the LED strip on to the last know state it was before turning it off (fading it to black doesn’t turn it off!)
- Set the transitiondelay
- Set the number of LED to handle in the strip (255 max)
- And last but not least; store the settings and last known color to the EEPROM (IE. for restoring after power outage)
Serial-bus features:
- Get the current temperature reading
- Get the current Lux-measurement reading
- Get the current RGB values the LED-strip is set to and the transitiondelay
How to use it
As said before it is mainly build for the PiDome project but can also be used in a more generic way. One example to do that is to install the “i2c-tools”-package for Linux. Then you can simply send a command and parameters to the connected device and control it that way. For example:
i2c-set -y 0 0x40 0x20 0xFF 0xFF 0x00 i
This will fade the LED-strip as a whole to yellow.
At this moment the I2C address of the device is 0x40 and will remain fixed for now. The speed it communicates over the bus is 400kHz.
To get the measurements in a serial monitor, connect to it’s COM port (8N1) and send one of the ‘T’, ‘L’, ‘C’ commands to get respectively temperature, Lux or the color/speed.
Picture
Below is a picture of the setup as I have it now (working). The idea, in my case, is to make a custom PCB for it and put it in a casing so it can be mounted somewhere in my livingroom.