Networking and Communications
My final project is a RGB Lamp made in concrete, was designed to work as a Output device in networking regulated by two inputs. The inputs idea is to dim ligth intensity and change the RGB color game, for this I am using two potentiometers. There are five Output devices which four are rows of five RGB LED’s and one that only has one RGB LED, this one is on charge of the communication between all.
Boards Design and production
I designed the Boards using Eagle, and all the components are from the Fab Inventory so if you want to make yours have a look to the list below and the fab inventory. Just in case to double check info updates of the components because the list is constantly being updated.
The RGB LED’S used work with 5V and there is a power regulator of 4.7V that protects the components in case to receive more power than the accepted. The LED’s are using 499 resistor for green and blue color, and for red color two 499 resistor one over the other to cruze them and create the half of the power that requires. Programing is made through the 6 PIN HEADER and Power, RX and TX with the 4 PIN HEADER.
Then I proceed to mill them with the Roland Modela using bits of 1/64 for traces and 1/32 for cut it, once were ready I soldered all the boards and then they were ready to program.
Programing
For programing the four lighting boards I am using Arduino IDE, the program consist in turn on/off the RGB game of colors (white, red, green, blue, yellow, cyan, magenta) and one set that fades the whole color game. So the boards function when they are connected to the power, but they were designed to be slave by the bridge which has connected the power supply, and two potentiometers that one dims the light intensity and other for change the color set program.
I need two different codes: first for the ATTINY 45 Nodes and second for ATTINY 44 Master.
The ATTINY 45 Node Code
/* Attiny45a co. nod rgb led lighting system
created 2014
by Juan Esteban Vallejo (with Andrew Leek)
*/
#include
The circuits are going to be connected in networking slaved by the main board that receives input commands, so I used the SoftwareSerial library that allows serial communication to define the RX TX. Inputs are analog potentiometers, the turning is divided by the number of steps that the program requires. First dims the light from 0 which is off to highest light intensity and second change to 7 seven colors.
All the functions I want to have in the Lamp exceeds the microprocessor memory, so my colleague Andrew Leek advised me to run the program with a variable modifier from Arduino called PROGMEN to save memory and run a lighter program.
I declared the pins RGB LED colors are using and then used the next code to define the colors I want the LEDs combination produce (red, green, blue, cyan, magenta, yellow, white), this action is saving enough memory to have the rest of the program.
PROGMEM prog_uchar color_table[6][3] = { {1, 1, 0}, {0, 1, 0}, {0, 1, 1}, {0, 0, 1}, {1, 0, 1}, {1, 0, 0} };
The ATTINY 44 Bridge Code
/* Attiny44a co. bridge networking 1 rgb led
created 2014
by Juan Esteban Vallejo (with Andrew Leek)
*/
#include
Summering both codes do the same program, what changes is the microprocessors (ATTINY 44/45):
-Change the light intensity
-Change to 7 different RGB colors
-Turn ON/OFF