loading

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.

Step 1: Design

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

Step 2: Print and Get Ready for Wire

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.

Step 3: Wireing

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

Step 4: Program It

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);

}

Step 5: Complet It

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

<p>Really cool! Thanks for sharing and welcome to the community! </p>
Thank You Tom<br><br>I am going to add some more detail soon<br><br>

About This Instructable

524views

1favorite

License:

More by sebilaci:3d Printer Filament Spool Holder BLINKING  DUPLO LEGO TRAIN 
Add instructable to: