For our teams final project, four LED candles with ATmega328P(B) boards are programmed to display a creative light show. Each candle is identically hand-built and connected to an ATmega328P or ATmega328PB microcontroller. These four devices are all then connected to a single ATmega328PB that serves as the master controller. The master board is programmed with all of the light routines and signals the individual boards to turn the LEDs on or off at different brightnesses. In order for the master controller to communicate with the slave boards, the I2C interface is utilized. The purpose of this project is to develop a simple prototype for a future, larger candlelight display that can be wirelessly programmed to display more complex light shows.
We planned to use the I2C interface to serve as a means of communication for each candle. Two data lines are used: a clock line and and data line. These two line are shared with every device including the master and slave boards. The master board can request to write or read data to each slave board. The signal consists of multiple sets of two bytes of date. The first seven bits in the first byte is the address of the slave board that is being addressed. The last bit is signaling whether it is requesting for the following data to be written or read. The second byte is the data the master is trying send. If the slave successfully received the data bit then it will send an acknowledgment bit to the master board.
We ran in to difficulties trying to simultaneously interface with P and PB variant boards because they require different address name schemes.