Thursday, December 17, 2009

Duplo Traffic Lights




We've been playing with LEGO and DUPLO quite a lot at home recently (Lin's been doing some great work on expanding our LEGO possibilities - see these posts over on filthwizardry: "Lego and hole punching cards", "Festive card punching with more LEGO", "LEGO and DUPLO" and "LEGO car and DUPLO truck cardboard printables").

I thought it'd be really nice to be able to add some traffic lights (like these ones I made a while back) to the creative fun. Lin suggested I house some in a DUPLO block, so I set to work trying to figure out how to do it.



Ingredients: 3 LEDs (red, yellow, green), 3 resistors (I used 330 ohm), ATtiny13, 8 pin DIP socket, perf board, magnet wire (thin), switch, stranded wire (black and red), coin cell battery, DUPLO blocks (the 8 knobble variety, 1 standard and 2 thin).

Tools: soldering iron, dremel, hot glue gun, various dremel attachments and drill bits (depending on your LEDs and switch).

The three holes/cylinders on the underside of a standard DUPLO block are perfect for traffic light mimicry. I ended up using 3 blocks, one large and two thin. The large block houses the electronics and the switch, one thin piece has 3 holes drilled in it for the LEDs and the last piece is used on the back as a battery cover.

Here's a couple of pictures showing the carved out bricks. You have to leave some of the 'tubing' in the large brick in order for the other brick to still connect normally. I used a dremel to cut off the 4 middle bobbles from the thinner piece - leaving a hollow center, between the two pieces, for the electronics.



I haven't taken a picture of the remaining thin block, I hollowed that out in the same manner as the larger block, to make room for the coin cell battery. Again leaving enough of the innards so it'd still fit tightly on the back of the main block.

I drilled 3 holes in the front piece (the thin black one above) directly in the center of the three tubes; the holes need to be just the right size for the LEDs to fit snuggly (I messed this up with my first prototype). I also drilled a small hole in the center of the big block for the power wires to feed through later on. This way you can have all the electronics hidden in the main block and have the battery accessible on the back.

The main board is just a small bit of perf-board with the 8-pin DIP socket soldered on. I'm using the same code as last time, so the LEDs and resistors are attached to pins 5, 6 and 7 (PB0, PB1 and PB2 respectively). I used magnet wire to attach the LEDs as it's flexible and takes up very little room. I tried just soldering the LEDs directly onto the perf-board but that made it difficult to get a good fit later on. If you give this a go, remember to sand the insulation off the ends of the magnet wire before soldering.



Add a switch:


Then place it all inside the main block (feeding the power wires out of the hole in the back).



Then glue the LEDs into the holes of the front piece and close it all up. I'm probably going to have to glue it shut in the future to keep out fiddling fingers.



I didn't have a coin cell holder, so I scavenged some metal tabs from the innards of a happy meal toy and soldered these onto the ends of the power leads. Then I taped them tightly onto the coin-cell. Clip on the battery cover (3rd block) and it's all done. This would all be a bit cleaner if there was a coin cell holder attached to the back in some way (I'll give that a go next time).

Here's the lights in operation (with my first attempt on the right which has directly soldered LEDs and an ugly switch):



The kids really do seem to like them! The original lights have had to be repaired a few times from er... 'overly keen' play. Well, that and Ffion ripping them apart.

Next ideas are to make them easier to include with normal duplo play by attaching blocks to the top and bottom (may require some cutting and gluing). Another good addition would be to have lights on both sides of the block to control traffic in both directions (so when one side is green the other is red). If only I had more black duplo...

2 comments:

Catherine Peart said...

Holy guacamole, this is fantastic!! You guys are so inspiring.

Tomasz Orłowski said...

Thanks for this great post, I've been thinking what can I made a traffic light for my kid until I found your page. I will have also to remind myself how to program uC, since I haven't been doing this for ~10 years.
THX THX THX

PS. not to mention, your other ideas are also great :)