This is a backpack for a backpack! This is being designed to piggyback on the back of a 'standard' IIC LCD backpack. It has an ATMEGA328 to drive the additional backlight LEDs of an RGB character LCD. It has the Arduino bootloader and the IIC, SPI and serial pins are broken out for programming and other uses. A few more pins are broken out as well for buttons and what-not.
The prototype PCBs turned up this week and I have been having fun getting then working. I am still reasonably new to soldering SMT but flux is my friend! Even so, I was still having problems reprogramming the ATMEGA on my board. Turned out there was a minuscule solder jump between the SPI clock pin and the adjacent pin on the chip. Once I had that clear the chip took on the firmware with no issues.
Finally Working with wires to allow for SPI programming! And I really should clean the board better but practise...
There are some changes I would like to do to the PCB. As mentioned in the image above I've had to wedge the boards apart to make the LCD backpack work. I de-soldered the connector to allow my backpack to attach, but I don't think the solder has flown back down fully. Next version I will use larger holes so the connector can stay soldered.
Also my backpack doesn't lay flat as I have used through hole parts for the resistor and capacitor. The resistor is the issue as it obviously comes through. I have two thoughts on this. The obvious is to go over to surface mount components. The second is to solder the top side so the excess legs can be cut flush.
While waiting for the PCBs to arrive I have been refining the firmware more. It is now possible to set the Hue, Saturation and Brightness separately in single byte commands. The 3 byte RGB command has been augmented with additional commands to set each colour separately.
There is also now an 8-bit RGB command which enables selection of 255 colours from a single byte (well 255 colours plus black). It uses the format BBGGGRRR. So red and green both have 8 possible combinations and blue has 4 giving the full 256 options. Below is the new command set and what colours are available with the 8-bit palette (please note the colours on screen WILL display differently compared to the LED output!)
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:
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
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.