BLINKING DUPLO LEGO TRAIN

by sebilaci in Living > LEGO & K'NEX

2549 Views, 3 Favorites, 0 Comments

BLINKING DUPLO LEGO TRAIN

20151025_114456.jpg
20151025_114504.jpg
20151021_202223.jpg

We have one of these DUPLO Train set and I noticed 3 AAA battery can fit into the train front and plenty of room left for arduino..... so I thought it would be fun to light it up.

Design

Train Front 2.JPG
Train Front 1.JPG
Train Front Assambly1.JPG
5628552e4936d41ad9000a3d.jpeg

A couple hours of design (10+ hours easy) and the first prototype has been printed. During wiring i realized I have completely forgot to leave room for the cables but don't worry the attached SLT files has been updated whit those modification.

The printed parts may required some filing and re drill the holes for the perfect fit of the leds.

Also place front part into the LEGO part and marked the location of the middle led on LEGO part with 3 mm drill trough the printed part.

Remove the printed part and check the mark it should near of the middle of the headlight of the LEGO part. Adjust as necessary and drill it trough

Print and Get Ready for Wire

20151021_202206[1].jpg
20151021_202339.jpg
56285cb9937ddb46030015c0.jpeg
20151025_121959.jpg
20151025_121859.jpg

Before you place the LEDs it is a good idea to paint of the side of them with black permanent pen, and also power led on arduino board is nice to block out withs some paint.

Bend some copper stripes for battery connectors (there are some photos about the approximate size and shapes).

One was bended in "L" shape and heated up with soldering iron and I simply pushed it into the printed part. It holds firmly.

Wireing

20151025_210313.jpg

Before you place the ARDUINO Nano needs to be wired. See schematic.

Program It

20151021_222849.jpg
20151021_222936.jpg
20151021_222952.jpg
20151025_223234.jpg
20151025_223250.jpg

Progam Arduino nano

I have used USBASP to upload program (see below) since this small board does not have USB port.

I have build an attachment for programing because it will be handy for those boards witch has pinheads soldered already.

Any way if you have this project only just use a 12 pinhead connected to USBASP whit ribbon cables as shown.

Copy paste this small program to Arduino DE and use File menu> Upload Using Programer to upload it.

Should work. If not, check the wiring and polarity of LED once again

void setup() {
// initialize digital pin 7,8,9 as an output.

pinMode(7, OUTPUT);

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

digitalWrite(7, HIGH); // turn the LED on ( White led in the midel) }

// the loop function runs over and over again forever,. This code Could be nicer, but this way was quickest for me and any body could understand it.

void loop()

{

digitalWrite(8, LOW); // blibnk the LED on one sied

delay(25); // wait 0,025 second

digitalWrite(8, HIGH);

delay(25);

digitalWrite(8, LOW);

delay(25);

digitalWrite(8,HIGH);

delay(25);

digitalWrite(8, LOW);

delay(25);

digitalWrite(8, HIGH);

delay(25);

digitalWrite(8, LOW);

delay(25);

digitalWrite(9, LOW); // blink the LED on the other side

delay(25);

digitalWrite(9, HIGH);

delay(25); digitalWrite(9, LOW);

delay(25); digitalWrite(9,HIGH);

delay(25); digitalWrite(9, LOW);

delay(25); digitalWrite(9, HIGH);

delay(25);

digitalWrite(9, LOW);

delay(25);

}

Complet It

20151021_202223.jpg

If everything works, place the butteries and adjust battery connector as necessary. Place the whole thing into the LEGO part it should stuck firmly.

The last step

Put together the printed parts and using some crazy glue.

Enjoy