loading

Addressable Milk Bottles (LED Lighting + Arduino)

FeaturedContest Winner
Picture of Addressable Milk Bottles (LED Lighting + Arduino)
Make PPE milk bottles into good looking LED lights, and use an Arduino to control them. This recycles a number of things, mainly the milk bottles, and uses a very low amount of power: the LEDs apparently dissipate less than 3 watts but are bright enough to see by.

Among other things, I wanted to see if I could make an electronic light feel more human friendly than most, and found rotary controllers are a good way of doing this.



PPE milk bottles make for a cheap yet aesthetically pleasing way to diffuse LED lighting. Especially if you can find nice round ones :)

Modding an object with LED lighting is not only environmentally friendly, but also much more straightforward than building a housing from scratch. Because LEDs are tiny, you can put them almost anywhere, and they don't produce much heat as long as they're spread out and running at the correct voltage.

This instructable will deal mainly with physical design and production, and I'm going to assume you have a basic knowledge of creating electronic circuits and LED lighting. Since the exact LEDs and power supply you use will probably vary, I'll only go into the basics of my circuit in terms of specs. I'll also try to point you to useful resources, and explain more about the Arduino microcontroller and code that tells them to work in sequence.

The electronics of basic LED lighting are really simple, similar to elementary school electronics, so probably won't take long for you to pick up at all.
 
Remove these adsRemove these ads by Signing Up

Step 1: Tools and Materials

To manufacture the lights themselves, you will need:

PPE milk bottles
Sheet of 3mm clear acrylic
2 core electrical cable (or speaker wire will do - it can be fairly light duty since it will only take about 12v and very little current, depending on how you design your circuit).
LEDs
Resistors
Solder
Heat shrink tubing
An old transformer (wall wart to Americans), plus socket+plug to go with it.
Braided copper wire
Solid core bell wire
Zip ties


Tools you will need:

Drill
Hole cutter (matched to the width of your milk bottle caps - see step 2)
Assorted tiny drill bits
Junior hacksaw (depending on what you use as a housing)
Screwdrivers
Wire strippers
Side cutters/Wire clippers
Soldering iron
Multimeter
Third hand (vital for soldering components together)
Desoldering wick (if you salvage any components from other devices)
Crocodile clip leads (for testing/prototyping).

You also might want to make some kind of housing for them. I've tried various ways of hanging them, and settled on a bent section of PVC pipe, hung from the ceiling with holes drilled for the cables. I also tried stapling them to the ceiling. You could also hang them through a piece of board mounted on the ceiling, from conduit, or even make holes in your ceiling itself to accommodate the wires and power them from a loft. Step 5 shows and talks about a few of these options.

The above is all you'll need to make some lights that work with a basic on/off switch. To give them more advanced functions such as fading or sequencing, you'll also need a load of components such as transitors and a microcontroller:

Arduino mini
Mini USB adapter for above, or FTDL USB to header lead.
Pin header sockets
Solderless breadboard
LM317T voltage regulator
BC337 NPN transistors

All shown below but more about them and how they work together in step 6.

There's also an enclosure for switch box, which could be anything you like. I saw a lovely round sacrament box in the Japan room at the British Museum, but they wouldn't let me have it. In the end I used a white plastic moo card box because it fits so well with the theme :)

With such a circuit in place, there are all kinds of things you can program an arduino to do with it. I like kinetic lighting, but I find flashing christmas lights, etc., gaudy and mechanical. Their regularity and consistency is cold and unwelcoming (it must take work to create the naturalistic twinkle of good christmas lights).

I don't want anything flashy (literally). I want a single, analogue control for the lights that feels very human-operated, that simply sequences the way they turn on and off. Code for that, coupled with a nice feeling dial and an aesthetically pleasing aluminium knob makes this into a pleasing toy.

Step 2: Cut and Drill Perspex

Picture of Cut and Drill Perspex
p1030272.jpg
p1030274.jpg
p1030277.jpg
p1030659.jpg
p1030657.jpg
First of all, we're going to cut some perspex discs to go inside the caps on the milk bottles, then drill holes through which we can mount the LEDs and cable.

When using the hole cutter, drill into a piece of wood. Pressing your material against something like this while you cut will help to keep the back edge neat. Softwood also lets you know when you've gone all the way through, as you can really feel the way the drill bites changing as it reaches the wood.

Once your discs are ready, make hole in all your milk bottle tops to match the centre holes in the perspex.

You also need to drill holes ready for the wiring and LEDs. What exactly you do here depends on what kind of power supply you'll be using and what kind of circuits you want to connect to it. Mine use three LEDs per light, which I arranged evenly around the disc.

You need a pair of holes to pass the legs of each LED through, and two holes big enough to pass the two strands of your cable through. (See the picture for explanatory notes).

I didn't use a template or anything for this, I just did it by eye with a battery drill, some small bits, and patience. Occasionally, two holes would be a little bit too far apart or close together for the LED legs, but as long as you're careful, a little bit of bending will allow them to fit. If this doesn't make sense yet, don't worry, the next step should make it clear.

Step 3: Mount LEDs

Now, pop the LEDs through the holes, being careful to observe polarity. We're basically going to daisy chain them, with each negative leg on one LED connecting to the positive leg on the next.

How many you daisy chain like this, if at all, depends on the voltage of the power supply you use. Mine is 12v, and my LEDs have a forward voltage of 3.3, so the 9.9 volts of three LEDs is the maximum my supply can handle. They'll also need a resistor to bring the circuit up to 12v. You should definitely have a resistor on each bottle, because if you don't the LEDs will burn out or at least run hot (and brighter). I tried this with an early prototype, and they ran hot enough without a resistor to melt the PPE of the bottle cap.

You can use this handy LED calculator to work out what to do with your own circuit:
http://led.linear1.org/led.wiz

The screengrab from it in this step shows exactly the values I was working with and the resulting circuit (The resistors are added in the next step).

Once your LEDs are through the holes and you're sure the polarity is correct, start twisting the leads together as shown in the sequence of images for this step. The leads nearest the cable holes are left untwisted, because they will be soldered to the cable rather than each other.

Keep doing this with all of them, making sure to only connect positive to negative rather than pos-pos or neg-neg. I also made sure to keep all of these lights consistent. Looking down on them, the current always goes in on the left, then clockwise around the LEDs, which are earthed through the left hole.

Step 4: Solder Components

Now we need to solder everything in place.

First of all, solder all your pairs of twisted leads together, then clip off the excess.

Next, strip lengths of electrical cable then thread them through the cable holes you drilled into each disc. Wrap the cables around the LED leads, with live (brown) going to the long (positive) lead of the LED string. Coil the copper around the leads, solder it in place, and again snip off any excess lead.

Double your cable back through the centre hole, then slide the bottle cap down the lead and over the disc. At the other end, solder a resistor of the correct value (in my case 120 ohms) to the positive cable.

The length of your cables depends on how you're going to hang your lights. As you can see in the final picture of this step, I chose to use fairly short lengths of flex, because I knew I'd be joining them to longer lengths and making housings that would conceal the joints. It's also easier to work with 12 shorter lengths, rather than 12 much longer ones.

Step 5: Switches and Housings

At this point you have a set of lights mounted in milk bottle caps and designed to run with a particular power supply. The PPE bottles, once you've delabeled and washed them, will just screw right back into the caps and act as nice looking diffusers.

You could now connect the lights up with a simple switch box, as I did at first, or choose to do something more complex, like drive them using the same power supply but also a microcontroller to make them do more interesting things.

Due to time constraints, I've had these lights around as a prototype in various stages of development for around 18 months, and in that time I've mounted them in two different ways with three different switch boxes. I also retrofitted them with some better LEDs, that gave a slightly bluer light and had diffused housings.

Rather than detail every step of each iteration, I've put a selection of pictures in this step with notes illustrating each of them.

The rest of this instructable will deal with the latest (and coolest) way I've chosen to use them: Mounted in plastic pipe and controlled individually.

Step 6: Microcontrol, Components, Scavenging

Ok, so, great. We have working milk bottle lights now. But on-off control isn't very interesting. What about dimming and sequencing? For this, we need a microcontroller, and I'm going to use an Arduino. We'll also need a bunch of components to work with it, some of which I'll scavenge and recycle from old hardware.

I used a standard Arduino for prototyping and making sure I could code what I wanted to (I'm still very much a newbie at this kind of thing):
http://www.arduino.cc/en/Main/ArduinoBoardDiecimila

And bought one of these plus a USB adapter to go in the actual light:
http://arduino.cc/en/Main/ArduinoBoardMini

In case you haven't already heard of them, Arduinos are beautiful little prototyping platforms that allow you to inexpensively start learning about microcontrollers. The programming language used to tell them what to do is fairly accessible too. There's great reference on the Arduino website, and a bunch of good beginner level tutorials by Limor Friedman:
http://www.arduino.cc/en/Reference/HomePage
http://www.ladyada.net/learn/arduino/

So I need to redesign my circuit, more complex to accommodate an arduino mini. I want it to be able to switch them on and off according to a reading from a rotary potentiometer, which means incorporating transistors into the circuit for the arduino to trigger as switches. The arduino also runs at 5v, so I'll need to produce a regulated 5v supply from my existing 12v one unless I use two wall warts. The LM317T fits the bill; by using just a few resistors with it (detailed later) I can get it to push the right amount of voltage out for the arduino. Here's some reference on the LM317T:
http://ourworld.compuserve.com/homepages/Bill_Bowden/page12.htm

I've included some pictures of the components below, which are actually going to form quite a simple circuit. I've also included some photos of an old amplifier I got from a local market for 2 pounds. It has beautiful aluminium knobs that would most likely cost more than 2 pounds each, and a whole load of nice potentiometers and chunky switches to boot. Scavenging from old equipment can bag you some really nice old components for next to nothing. See the photos for a few tips.

Step 7: Transistor Circuit

I can't just switch the lights through the arduino, because they run at 12v and the Arduino runs at 5v. Transistors allow me to use a smaller current to switch on and off a much larger one, without frying the Arduino.

The first time I separated the wiring for the lights, I labeled each wire with a number, knowing I'd come back to them with an Arduino at some point.

Since I'm using NPN transistors, which go on the earth end of the circuit, I'll need to separate out all these cables and start splicing the +12v ones together. Using speaker wire, I stuck to the convention that the black striped side of each pair would be live, whereas plain would be earth. Making and sticking to conventions like this is important so as not to get lost later.

After separating all the wires out, I sawed a ragged hole in the top of the pipe for wiring. It was my intention to seal it back up with white gaffer tape, with the wiring and arduino inside, but this went a bit wrong as you'll see later.

First thing was to test my circuit. The transistor has three pins: a collector, voltage out, and base. Base is the one the Arduino will talk to through a 1K resistor, collector will take current from the earth connection, and voltage out goes to earth. The test works. More information on using transistors with Arduinos here:
http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads

(Note the 1K resistor between the Arduino and the base pin there)

here's a primer on transistors too:
http://www.mayothi.com/transistors.html

So basically:
  • Solder resistors to transistor base pins
  • Separate ground connection for each light, and number so you can keep them in a comprehensible order.
  • Splice all live connections for the lights together, heatshrinking over the splices when they're done (This is really important, as the wires will be packed back into the pipe it would be too probable for them to short the light out when packed if they weren't properly insulated). Build the splices down to a single connection for the +12v.
  • Solder the collector of each transistor to the ground connection of each light, heatshrinking it too.
  • Use short bits of wire to splice all of the transistor emitters together, building them down to a single earth connection.

Next, they'll be hooked up to communicate.

Step 8: Communication Cables

Picture of Communication Cables
P1100969.JPG
P1100971.JPG
P1100972.JPG
P1100973.JPG
P1100974.JPG
Cut and strip 12 cables to solder to the resistors on the base pins of the transistors. These will be the cables that the arduino uses to talk to the transistors. Don't forget the heatshrink.

Once the cables are in place, solder them to pin sockets to fit the pin headers on the Arduino Mini. I used pins 4 - 13 and pins AD0 (14) and AD1 (15) as the 12 output pins to switch the transistors. You can find the pinout for the Arduino Mini here:
http://www.arduino.cc/en/Main/ArduinoBoardMini

If you solder your comms wires to the pin sockets in the right order, they should plug straight into the arduino and work as intended... mine did. Phew. With the sockets completed, thread them through the end of the pipe for now, along with the live and ground connections you spliced earlier.

If you have any spare pin headers around, they make it easier to use crocodile clips to test everything is still working. You can tell the arduino to set a single pin high all the time, then use one lead from it to touch the pin for each light in turn.

Step 9: Voltage Regulation

Since the lights run from a 12v supply, there needs to be a voltage regulator dropping it to 5v for the arduino. Enter the LM317T, which gives an output voltage depending on the resistors you augment it with. The difference between the input and the output is shed as heat, so sometimes these ICs need a heatsink.

Here's a tutorial on the LM317:
http://www.sash.bgplus.com/lm_317/tutorial-full.html

and here's a handy calculator:
http://www.electronics-lab.com/articles/LM317/

Once I've found the right values to get it belting out 5v for the Arduino, I solder, heatshrink, and test. 5.07v coming out, not bad. Now I know it works, I can solder it into the main bundle of wiring, taking 12v, going to earth, and having a third output that will go to the arduino. I start another header socket, putting the 5v line on it corresponding to the 5v pin on the arduino. I also connect ground from the arduino on the same socket too.

Almost time to test it.

Step 10: Programming

Picture of Programming
P1110007.JPG
I need to write some code to test with first, and to upload it to the Arduino I need to wire up some breadboard to connect the USB adapter to the Arduino Mini.

See the guide to the Arduino mini here:
http://arduino.cc/en/Guide/ArduinoMini

and the pinout for the USB adapter here:
http://arduino.cc/en/Main/MiniUSB

After trying out flashing sequences with the code, etc. I settle on something like the debugged and tweaked code at the end of this instructable. Also notice how the crocodile clip tests get neater the more soldering is done. It's kind of satisfying, and also very worthwhile to test that each light still works at every stage. Testing solely at the end will leave you mystified and not knowing where to start if you do have a problem.


Step 11: Cabling and Switchbox

Now for the controls. Since I want the controls to be separate to the light, I'll need some cable. The circuit needs live and ground connections, and the potentiometer will need three connections. One of these will be live from the Arduino, one with be the connection to the analog pin that the arduino will use to read the pot. The other is earth, so that means I need just four cores going up to the light.

Since I don't have any four core cable, I twist two long lengths of speaker wire together. Not perfect, but not bad. You can easily do this as shown in the photos below by zip tying the ends of two lengths of cable, putting one end under something heavy enough to hold it, then braiding the cables yourself.

I'll be making the control box out of an empty white plastic moo card box I've had for quite a while. Some of the components, such as the power socket, are also recycled from previous projects. An end cap and some zip ties will serve as strain relief at the light end of the cable.

I start marking out the box for the pot, then set to connecting the cables up at the light end. By stripping one pair but not the other when they're entwined, it makes it easy to identify them. One of the stripped ones will go to ground on the potentiometer in the switch box, one will go to +12v at the power socket. The other two will be signaling wires connected to the other pins on the pot.

At the other end, one of these will go to the analog pin that the code tells the arduino to take a reading from, and one to +5v. Again, all heatshrinked up when in place.

The pictures should show you better how I made my switch box, which almost went disastrously wrong. I tried gluing it first, and the plastic seems to be impervious to superglue... in the end, I sorted it by using a couple of rubber pads inside the box then putting a couple of PC case screws though all the layers of the box to hold them together and keep the pot in place. The power socket also needed a zip tie since I didn't have any nuts to fit the thread on it.

Step 12: Sequenced Light

Picture of Sequenced Light
P1110056.JPG
P1110057.JPG
P1070158.JPG
Finished! More photos and video to come, and the code is attached below.



The wiring, it turned out, was too big to all go back in the pipe, which is unfortunate. It means the LM317 and the arduino both stick out of the top of the pipe because it's so packed with wires and components. Squashing them in any further started to make it behave erratically, so I'm going to leave them outside. Since it will hang from the ceiling, I doubt they'll be particularly noticeable. However, I would have liked to have come up with a solution that stayed good looking while accommodating all of the circuitry.

Never mind though, it works how I want it to. The simple analogue control feels pleasingly human.

Notice in the code that the numbers at which things get turned on and off don't have uniform differences? That's because the pot I used turned out to be Log rather than Linear, so distributing the thresholds evenly resulted in all the activity being squashed up in one end of the pot's travel.
1-40 of 46Next »
mslobogean2 years ago
Great instructable! By the way, for other readers in Canada/USA, Perspex is commonly known here as Plexiglass.

This reminds me of a project my friend's dad made, which involved lights placed under inverted plastic 4 litre ice cream buckets. The string of lights were left beside the sidewalk before winter so that snow would cover them, and they'd light the snowbank from below. It would look awesome to add individual addressing and control as you did!
Robsen2 years ago
Very nice! thank u :)
Great looking lights! I love the idea of using milk bottles to diffuse the light. I find 'em pleasant to look at anyhow.

You might also want to look into straight AVRs (start !). They're just as easy (almost) to work with as arduino, but 6X cheaper and 1000X more flexible (just a chip, not a board). In addition, with the combination of ladyada's USBTinyisp, you'll be able to get that easy usb -> milklights that you're looking for.

If you'd like advice with that, just shoot me a pm, but great work, and congrats!
Nachimir (author)  T3h_Muffinator6 years ago
Thanks for that, really useful link. I've been thinking for a while that using a whole Arduino in each project is a bit excessive, and surely I can use them to program ATMega168's to wire up without the boards... great tutorial, thanks.
If you search (even this site) for 'AVR programmer using Arduino" you should come up with several methods for programming basic ATMega's using an arduino board.
mo3eed2 years ago
great
Great Work!!!
Can you use PWM with a transistor? Thanks
Nachimir (author)  joejoerowley6 years ago
Thanks for your compliments. A google search suggests that PWM can be used with transistors. I'll give it a try this weekend.
Very Cool. Image having these fade down the line. The possibilities are endless :) Great Instructable btw, I'm still lovin' it.
Nachimir (author)  joejoerowley6 years ago
Cheers :)

I just did a quick test with PWM on the bottles connected to the right pins:



I've put the code up as a text file in the last step too (PWMtest-milklights.txt) if you want to look at it. However, don't learn code from me; I'm a beginner and have been told I use way too many curly brackets :)

Also, the Arduino environment contains a much more straightforward example of PWM using a single pin in File > Sketchbook > Examples > Analog > Fading
Or you could simply use the SoftPWM library for arduino that gives you PWM on all pins.
ajtag Nachimir6 years ago
have a look at ti's tlc5940: http://focus.ti.com/docs/prod/folders/print/tlc5940.html, that has 16 pwm pins for leds, and can be daisy-chained for more. thats what i am using.

great instructable, keep up the good work.
ajtag, How do you hook up, program and use the flc5940? I'm an noob and a tad bit confused on how you would go about using this chip. Thanks in advanced, Joe
Never mind. I just found a great resource.
http://students.washington.edu/acleone/codes/tlc5940arduino/html_r012/
Thanks,
Joe]
I was about to recommend that! damn second... lol. (The TLC)
ShortedOut3 years ago
I wasn't sure whether I understood the wiring completely, so I drew up a little diagram. I put in (for simplicity's sake) only three sets of 3 LEDs (connected only to pins 4, 5 and 6 on the Arduino Mini). I think I got the pin order wrong on the NPN transistors. Also, I wasn't sure how to label the resistors on the LM317T, as I'm not sure what you ended up using (and because my eyesight is terrible!). Could you tell me whether I'm thinking this correctly? If not, where is it wrong? Thanks so much!
LED_Arduino_Wiring_Diagram_Small.jpg
Nachimir (author)  ShortedOut3 years ago
Really sorry, but it's been over two years since I touched this. It looks about right. I would have used an online calculator to put the right resistors to each trio of LEDs, and this was the first time I'd ever used transistors or the LM317. I had quite a few to spare, and experimented until I got it right.
ASCAS5 years ago
Wow you drink a lot of milk!
 nice work
__Master_5 years ago
NM my question it is yea you can do it and i looks cool to
__Master_5 years ago
do u think that u cud stop the RGB LED colour fade and thin make it go again to choose a new colour?
Blackice5046 years ago
Hi this is a great project i think i will build this for my mum and dad's house as they always complaining about light because the voltage is low and you do need well alot of lights to be controled one by one would it be better to have a single ground wire for all the lights then just use Cat5 is this possible so far i think it is but i have not played with the Arduino PS i live in Australia i have only found one place that sells them :'( and its FAR
you could use two of those pipe fittings that make the pipe size larger and a short section of larger pipe to hold the arduino
Euphy6 years ago
Congratulations on the win Nachimir - it's a great project!
Ioannes6 years ago
This would have been neater and easier for fault-finding if you had soldered all the transistors and resistors into a piece of Veroboard (Copper strip Board) and then soldered the wire onto solder pins. Alternatively, if facilities were available a small PCB made to fit into the pipe is another solution.
Nachimir (author)  Ioannes6 years ago
Yeah, I learned a lot from this, and would have loved to be able to make a PCB for it.
notsure6 years ago
Have you considered using a LM7805? They drop the voltage to a regulated +5 instead of needing to regulate it with a 317. I like the 317, but the 7805 works better for a constant +5.
Nachimir (author)  notsure6 years ago
Thanks for the tip. I'm only just learning about all the components there are out there.
bumsugger6 years ago
What a F-A-N-T-A-S-T-I-C instructable Nachimir,I commend you on your thorough detail,and neatness, (all things considered).I'm not too well up on Arduinos though,so I've got a pretty steep learning curve ahead of me,despite being an Electro-Tech.I have a just a project in mind for a setup like this,so I better get reading,once again,Congratulations!!
i wonder if you can make allot of OLED dolor changing suond to light system. imagine... color flashing milk bottles with a ipod connected... must invest in this, i think ill make a japan paper lantern theme and hang it on my celling everywhere, that be nice, any tips?
Nachimir (author)  crampedyogapositions6 years ago
That sounds like a lot more work than this. You could make things sound reactive pretty easily, either with mics, or even piezos attached to speakers. I know those T-qualizer shirts that have the light up EQs on them and were everywhere in the UK a couple of year ago just react to volume through some components integrated with the battery pack, but I've never taken a close look and it only gives very limited responses to sound. If you want to do anything particularly fancy you'd probably need to route the signals through a computer. It would be cool to teach something the difference between Brian Eno and Extreme Noise Terror, and appropriate colours to display for each :)
mman15066 years ago
what about adding a tepture sensor that controls the dimness or even coulour of ligt
Nachimir (author)  mman15066 years ago
Yes, that would work. You can do just about any basic sensing and processing with an Arduino. I have a load of RGB LEDs for my next electronics project, which will record data from somewhere else and pass it on to them...
susioneill6 years ago
My Buddy john Callaghan (www.johncallaghan.co.uk) has a costume made from Yakult milk bottles which light up. There's some photos knocking about my Facebook page of him playing a party at my house wearing it.
Nachimir (author)  susioneill6 years ago
emerson6 years ago
i wonder how one could program the arduino to control dimness and creating a breathing light effect on various bottles. sweet project, very inspiring.
Nachimir (author)  emerson6 years ago
Thanks very much, everyone.

A breathing light would be fairly simple with PWM, though a standard arduino only has 6 PWM pins. Maybe you could get around that by routing the output of one pin to more than one bottle, then blocking with transistors for ones you want off at any time... that wouldn't allow you to control all simultaneously without some being perfectly in synch though.

I made a little demo of PWM with an RGB LED:


I added a heatsink to the LM317 today just to be on the safe side. Aiming to get more video/images of the finished light too, but have to find a way to get it the 3 miles or so back to my house now :)
you could use the arduino mega it has 11 pwm pins
arduinomega_1stpic_cc.jpg
Nachimir (author)  bigbodysmallbrain6 years ago
Indeed, I've been eyeing them up, but that's still one short for these :) I like the idea of the Mega, but it seems like overkill. For any project an Arduino seems to have a lot of unused capacity, so maybe deeper prototyping skills based on them could lead to custom PCBs and dedicated circuits that do exactly what you want. Though I think anything that makes physical computing more accessible to people is basically a brilliant idea :)
1-40 of 46Next »