Introduction: Lightboxes Using Arduino (WIP)
These were made for the schoolproject If This Then That over at HKU. The assignment was to make something using an Arduino. Sadly due to practical difficulties I was not able to make a working prototype, but I know very well that this project could work. I will guide you through the simple steps I have taken in order to make my Lightboxes.
The only skills needed for this project are soldering and basic knowledge of Arduino.
The materials I ended up using for my prototype are:
- 1 Arduino Uno
- 1 Adafruit Neopixel 30 RGB LED strip
- 1 roll of conductive copper tape
- 4 small tupperware boxes
- Lots of small cables
- 1 bag of foam stickers (optional)
I do want to note that the tupperware boxes are not ideal to work with and I'd highly suggest finding boxes with completely flat surfaces.
Step 1: Inspiration
In order to figure out what I wanted to make, I made a moodboard on Pinterest including some things that fascinate me. Mostly I've been looking at color and light. These are two things that I love and that seemed relatively easy to use with an Arduino. Plus, if I ended up making something I thought was pretty, I could put it on display in my future apartment!
To see the moodboard, follow this link:
https://nl.pinterest.com/shikariix/ittt/
My first idea was to make tetris lights that would each have their own color, but light up white if 5 blocks were on the same row. Then I got the idea to make lights that get a color assigned depending on their distance from the first block. Since this last idea seemed a lot simpler to put into action than the first, I decided to go with this.
Step 2: Gathering Materials
It's important to have the right materials for your project. I knew that I was going to need several things. Namely:
- Boxes
- RGB Lights
- A solid connection from box to box
The boxes were easy. I found small square tupperware boxes at Xenos which were a bit mat - exactly how I wanted it.
For the lights, I wasn't sure wether to get a LED strip or seperate lights. The teacher adviced me to get a strip since there would be less cables involved.
For the connection, I had to do some research. I ended up picking conductive tape because it seemed easiest to work with. You just stick it on and it works! Do try to find a tape that can be soldered. You're gonna need that in a few steps.
Step 3: Code
The code for this project is relatively simple. Since I focussed on getting at least one dimension working, I simply assigned a row of colors in an order that I like with help of the 'simple' example. The main thing I did was take out the for-loop, as there won't be any looping happening in my lights. Here is the code:
#include <Adafruit_NeoPixel.h><br>#ifdef __AVR__ #include <avr/power.h> #endif // Which pin on the Arduino is connected to the NeoPixels? // On a Trinket or Gemma we suggest changing this to 1 #define PIN 6 // How many NeoPixels are attached to the Arduino? #define NUMPIXELS 7 // When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals. // Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest // example for more information on possible values. Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); int delayval = 500; // delay for half a second void setup() { // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket #if defined (__AVR_ATtiny85__) if (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif // End of trinket special code pixels.begin(); // This initializes the NeoPixel library. } void loop() { // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one. pixels.setPixelColor(0, pixels.Color(150,0,0)); pixels.setPixelColor(1, pixels.Color(110,20,0)); pixels.setPixelColor(2, pixels.Color(100,70,0)); pixels.setPixelColor(3, pixels.Color(0,100,0)); pixels.setPixelColor(4, pixels.Color(0,100,100)); pixels.setPixelColor(5, pixels.Color(0,0,100)); pixels.setPixelColor(6, pixels.Color(100,0,90)); pixels.show(); }
If I were to add a function where you could change the color of the main block, I would use a button that counts +1 on every click, and depending on the current number on the counter the main block gets a color. The other colors are of course assigned depending on the first block.
Step 4: Testing
This is an optional step if you're more familiar with Arduino and the other materials. Since it's one of my first hardware projects ever, I did a lot of testing involving the working of lights, Arduino itself, conductive tape and the Neopixel strip.
Step 5: Assembly
Now that the code is working and the materials are all here, it's time to put together the Lightboxes!
First, cut your Neopixel strip. I know it hurts but you have to put one light in every box.
Next, put three strips of copper on opposite sides of the lid of the boxes. The strip should go as far over the top as over the bottom. Make sure they are well separated from eachother so they don't make contact. For reference, the above images should work.
Solder the lights to the copper using small wires. This is very precise work and it's going to be tough if you haven't soldered before. Trust me, I know. Don't worry if the box melts a bit - as long as the copper sticks it should be fine. Also, do remember what side is the ground and which is the 5V!! You're going to ruin a lot of lights if you forget!
With the lights in place, you're already almost done! One thing to note is that on some boxes the copper won't be brought out far enough to hit the copper on the next box. To solve this, I used pieces of foam stickers to bring the copper out more. If your boxes connect well enough then you can skip the foam stickers.
Step 6: Arduino!
Now that the boxes are in place, it's time to connect it to Arduino! You'll need a cable in 5V, Ground and Pin 6. Just hold them to the appropriate pieces of copper and your first Lightbox should light up red! Now if your connections are a little weak like mine (curse you, foam stickers) it might be hard to hold them together in order for the next one to light up if you're also holding on to the cables from Arduino. If you've got the foam, it's more than alright to poke holes through the copper to stick the cabled in the foam. This way they will be kept in place and you can mess with the rest of the boxes as much as you want.
I liked this project a lot and hope to find the time to make a better prototype soon. Hopefully I can include more dimensions and the changing of colors as well. Overall I'm definitely not done with this project yet.
Thank you for reading!