This box is simply made to show and tell people if you are busy or not, showing the red light you are busy so no time for questions or whatever, green light you are free, go for it thats the moment!
It will be really helpfull in an office or in a studio.
Step 1: Build the Box
The first step is build the box:
- first thing first, draw your box in illustrator, this box will be 5x5cm and will have 4 little holes for the leds in 4 faces of the 6 you need to do for the box, make sure to make the female joints 0,1mm in each side because the lasercut machine laser is 0,2 mm of diameter and they will join perfectly without the needs of anything else;
- second, lasercut the wood to make the box;
- third, place all the faces of the box on the table to make sure that all the joints are ok, then build it up.
Step 2: The Components
The second step is make sure you have all the components:
- 2 Panasonic CR-2032/BN Knopfzelle Lithium 3V 220mAh;
- 1 Coin Cell Battery Holder;
- 4 Adafruit Flora RGB Smart Neo Pixel version 2;
- 1 Adafruit GEMMA;
- 2 Tilt Sensor/Switch Brick;
don't forget some wire and some connectors.
Step 3: Build Up the Components
The third step is build up the components:
- cut some connectors;
- cut some wire in different small pieces max 8-10 cm, remember the box is just 5x5 cm big;
- put the connector in te cable;
- repeat as necessary;
- take a piece of cardboard and cut a line wide the same as one of the box faces to take the proper measures for the distance of the 4 leds;
- make little circles to sign the cardboard where the leds will be placed;
- do the first line of cables to join the 4 leds to see if the distance is ok starting from the little arrow in the middle of each led;
- do the others lines of cables one passing through the "+" and the other one passing through the "-";
- solder it and then add the Adafruit GEMMA: the "+" to the 3volt, the "-" to the GND and the "arrow" one to D0;
- then connect the 2 tilt sensors: G to the GND, V to the 3volt, S to the D1 for the 1 tilt sensor and G to the GND, V to the 3volt, S to the D2 for the second tilt sensor.
Step 4: Write the Code
The fourth step is write the code:
- open Arduino Adafruit;
- follow this path to open the code to test the leds: sketch folder > libraries > Adafruit_Neopixel > Strandtest;
- put 0 for the value of the pin because the leds are connected to D0 of the Adafruit Gemma;
- put 4 in the number of the leds because we are using 4 leds;
- put the right type of arduino: Adafruit Gemma 8MHZ;
- put the right programmer: USBtinyISP;
- open googles and copy and paste the yellow highlighted part of the code inside the strandtest part of the code between #include and #define this will let it work well;
- open examples > 02.digital > buttons to test the tilt sensor as a button;
- write the code as is in the screenshot
- define the 2 TILT sensor as a button so if you turn it 180° to up (sopra) and down (sotto) it will change color from red to green: look void sopra() and void sotto() and if you turn it to right (destra) or left (sinistra) 180° it will be off, no color: look void destra() and void sinistra()
- using the void loop() as it is in the screenshot you will have a loop doing that: if you rotate the box to right it will turn on the light, then if you rotate the box following the 4 faces with the leds it will change the color from red to light 180° at time.
Step 5: Test the Box
The fifth step is test the box:
- close the box and test if it works;
- in the first image is off;
- turn it to right it will be on with the red light;
- turn it again in the same direction of the led 180° and will be green.