I have added the current firmware for the backpack. It uses the FastLED library to enable some features. Due to a small mistake on my PCB design I forgot to add in the solder jumpers to enable the device to change it's IIC address, which is currently hard coded to 0x30. Of course this can be changed in code if it is a problem, however jumpers would enable an easier change should it conflict.
The current code enables turning the backlight off and 4 other modes to set the colour. These modes are:
- Set Hue only (leave saturation and brightness at full) (1 byte command, 1 byte data)
- Set hue and brightness (leave saturation at full) (1 byte command, 2 byte data)
- Set hue, saturation and brightness (1 byte command, 3 byte data)
- Set red, green and blue values individually (1 byte command, 3 byte data)
Here is a chart for the command structure:

When sending a command standard IIC commands need to be sent, first the address, then the command and finally up to 3 bytes of data (depending on the command).
Using Arduino to tell the board to show red you could do:
Wire.beginTransmission(0x30); // device address
Wire.write(4); // RGB command
Wire.write(255); // sends red byte
Wire.write(0); // sends green byte
Wire.write(0); // sends blue byte
Wire.endTransmission(); // stop transmitting
Given FastLED starts it's hue spectrum at red (https://github.com/FastLED/FastLED/wiki/Pixel-reference) you could send:
Wire.beginTransmission(0x30); // device address
Wire.write(1); // RGB command
Wire.write(0); // sends hue byte
Wire.endTransmission(); // stop transmitting
One other feature of the code is that the unit stores the last colour settings in EEPROM (there is a 5 second delay after the last change to reduce wear on the EEPROM). So when the board powers up it will recall the last colour it was set on. That way it could be used to setup the colour you want but also be used on something that doesn't have the ability to interface with the board.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.