Wednesday, September 3, 2014

LEGO + Arduino = Brickduino [Full Tutorial]



I know LEGO has the Mindstorms-set that probably is great, but wouldn't it be even better (and cheaper) to hack your regular bricks into your own micro controller controlled LEGO? Well I think so!
I had this idea for a long time, but to many other projects stood in the way until Tristram posted this instructable: DIY-LEGO
We tried to work together on this project, but it seemed impossible to synchronize our agenda's and get together so we both run our own projects. First I took the same route Tristran took and even build myself a MYDIYCNC to cut the bricks, but finally I decided to take an other approach.

A nice first step in this project will be a simple LED in a brick.
(Tristram also did a LEGO-LED but with his own approach)

My goals for the LEGO-LED:
  • It must be 5V so is can be easily controlled by an Arduino micro controller
  • It must fit in a 2x2 brick and be flush within the brick
  • There must be come logic in the positive and negative poles
  • There must be a easy (LEGO-like) system to connect cables
  • The design must be useful for different modules in the future, like sensors and switches. (so there must be a possibility for three poles: 5V, GND and signal)
  • It must be repeatable
  • It must be cheap (not counting the CNC I build for it)
  • It definitely must look cool

Step 1: You will need:

For starters you will need a bunch of LEGO-bricks to destroy. I couldn't destroy my LEGO, so I bought it specially for it in "Pick a Brick" on the LEGO site.

LEGO:
  • 2x1 black bricks
  • 2x2 black bricks
  • 2x1 red plates
  • 2x2 red plates
Other stuff:
  • M2.5 x 5 mm bolts
  • M2.5 nuts
  • 0.5 mm copper plate
  • small electrical wires
  • 5mm LED
  • The fitting resistor to light the LED on 5V
  • (if you want) 6 mm plastic, aluminum of wood and 4 mm aluminum to make rigs

Tools and stuff:
  • Needle nose pliers
  • Wire cutter
  • Small screwdriver
  • Phillips head screwdriver
  • Drillpress (it might also be doable with a hand drill)
  • Drills: 2.5 mm, 4,5 mm, 5 mm, 5.5 mm an old 8 mm wooddrill
  • A CNC is helpful, but small files might also work
  • Soldering tools
  • Razor blade
  • Super glue
  • Grinding wheel or power sander


Step 2: 1) The cables

Normally I wouldn't start with the cables, but my bricks for the LED-module aren't delivered yet, so the cables it will be.

The cable will be a 1x2 black brick with one of the studs made into a connector and a 1x2 red plate on the bottom with the little round stud in the middle replaced by a connector.

The hole in the Bottom plate

To make the connector, we need a 3mm x 4 mm hole though the 1x2 plate. I use my CNC for that. (you can also use a drill and file). To make it easier to repeat, I first made a jig to hold the brick out off 6 mm thick HDPE plastic. The G-Code to make the jig is included in this instructable. I used a 1.4 mm bit in the CNC.
As you can see on the pictures, the LEGO fits snugly in the jig. When I zero-out the CNC on the little hole I made in the jig, the bricks will be cut perfectly every time. (G-code included. You might need to change the .txt extension in .ngc)


Step 3: The connector on the bottom plate

I tried manny different ways to make the connector. I tried 3mm nails, machined parts and bolds, but I think that I found a good solution now.
The best solution that I found until now for the bottom connector is a folded strip of copper. I was lucky to find a nice 0.5 mm thick, 3.5 mm wide strip of copper at the place where I buy my metals.
See the drawing on how to fold the strip.
To make this also easily repeatable, I also made a jig for this.
You can also use needle-nose-pliers.
  • Cut the strip to a length of 30 mm
  • Fold up the last 1.5 mm on both sides
  • Fold up again 4.5 mm from both folds
  • Fold down 3.5 mm from the last folds
  • Fold down 2.5 mm from the last folds
If everything went well, you ended up with something that looks like the pictures.

  • Now just push the thing in the slot that you made in the 2x1 plate.
  • Just bend out the two little contacts with a small screwdriver and you are sorted.




Step 4: The top brick

Now the bottom plate is finnish, we start on the top 2x1 black brick.

Here I also tried different approaches. My first idea was to machine the studs out of copper. Being new at machining, I had no idea that copper was so hard to machine. It costed me a routing-bit and the result was terrible. In aluminum the result was much better, but still not what I wanted and how would I connect a wire to a piece of aluminum?!
Finally I found a much easier and faster solution. I found M2.5 bolds that have a head that is exactly the right size. The nuts where a bigger problem. I found the right ones, but they where about $2,00 each. Now I have like 50 for that price, but they need some slight modifying to fit in the brick.

To prepare the brick
  • With the drill press you drill a 2.5 mm hole in the middle of one of the studs. If you do this from the inside out, your drill will centre itself on the dent that is already in the inside of the brick.
  • Drill a 2.5 mm hole in the middle of the side of the brick on the side where you didn't drill the hole in the stud.
  • Put the brick upside down and drill away the stud that is inside the brick, with a 4.5 mm drill.
  • Put the brick right side up and drill away the stud with the 2.5 mm hole in it. Do this with a 5.5 or 6 mm drill. (You might need the razor blade to clean it up)



Step 5: Putting the cable together

Now it is time for the fun part! Lets put the cable together:

First we need to make some adjustments to the M2.5 nut. Lake they are now, they won't fit in the brick. We have to grind off three sided of the nut until it fits. (Be careful this will get hot!)

Making the cable:
  • Strip 10mm from a piece of wire
  • Stick the stripped wire trough the 2.5 mm hole in the side of the black 2x1 brick
  • Bend a 90° bend in the last 4 mm of the wire
  • Put the wire in the corner of the brick (around the hole where the stud was)
  • Stick the M2.5 bolt from the outside trough the hole
  • Now try to get the (adjusted) nut on it while retaining the wire underneath it
  • Tighten te bold
  • Put the (already prepared) bottom plate under the brick and finished!
  • Now do the same on the other end of the wire
  • It might also be a good moment to test the connections with a multimeter
  • If it all works, glue the bottom to the brick with a little bit of superglue

Step 6: Making the LED-brick

To make the LED-brick we first prepare the black 2x2 brick.

Preparing the brick:
  • Like with the cable we need to drill a hole in the middle of the studs. We choose two studs across from each other.
  • I prepare an old 8 mm wooddrill to drill out the stud on the inside of the brick. I grind of the point of the drill until it is totally flat.
  • Drill away the stud on the inside of the brick with the prepared 8mm drill. This must go really easy.
  • Drill the two studs with the 2.5 mm holes in them away with a 5.5 or 6 mm drill
  • Finally drill a 5 mm hole in a side of the brick. 


Step 7: Preparing the LED

I want the LED to be flush with the side of the brick, so I have to grind off the nice rounded bit.
Luckily it still worked after the grinding.
---This is also a nice moment to use some LED's from broken LED-ligting. (Just solder them out, attach the right resistor for 5V power to the ground lead and attach a piece of wire on the other lead.)---
If you grind down a new LED, you also need to solder a resistor to the ground lead. (the ground lead is the short one)
Now check wether the LED survived the grinding down. 

Step 8: Put the LED in the brick

Put the LED in the brick

It is a kind of struggle to get the LED in the brick. You need to bend the resistor underneath the LED and the other lead of the resistor in a way that it passes both 2.5 mm holes when you put the LED in the 5 mm hole. You will need to bend the positive lead out of the brick. Be sure that the positive and negative leads aren't touching.
You might want to secure the LED in place with a drop of superglue. I didn't have to. The tightness of the hole and the negative lead being bolted down was enough to keep the LED firmly in place.
(always be careful with superglue. It is great for glueing LED on LEGO, but it will also glue finger on LEGO or finger on LED or finger on finger or finger on face or finger on tool or... you get the picture)

Now we can insert the bolts. Just stick them through the holes and make sure that the negative lead is going kind of around it in a way that it will be trapped between the nut and the LEGO when we tighten the nut.
- There is a little bit more room in this brick than there is in the 1x2 brick, but we still need to grind two sides of the nuts down. -

Again it is kind of hard to get the little tiny nuts on the bolts, but it is doable.
(for me it helped to first put in the nuts and then carefully put in the bolt)
Tighten both nuts and the LED is in!

Step 9: The bottom plate for the LED-brick

To make the holes in het 2x2 plate, I first need a new jig, to hold it in the CNC. It is an easy edit on the G-code for the 1x2 plate-holder-jig to make this jig. Again I use a 6 mm thick piece of plastic.
I added the G-code file.
- Remove the ".txt" extension from the G-code files -

With the jig and a the G-code included in this instructable it is easy to mill the holes in the 2x2 plate.
Next we just put in two of the contacts like we made them for the bottom part of the cables. We need to make them a little bit flatter than for the cables. This time we don't want the contacts to touch the bolts that are the negative poles of the brick.


The MYDIYCNC cuts the brick in just 1 minute!

Step 10: Finishing the LED-brick

To finish the LED-brick:
  • Just stick the positive lead of the LED through the two connectors in het 2x2 bottom plate.
  • You might need to cut the positive lead so it will fit in the brick.
  • Close everything up.
  • Test wether it all works.
  • When everything works it is time to definitely close the brick with a drop of superglue (remember the dangerous stuff)

Step 11: Just add Arduino

To finnish this project:
  • Put the cables we made on the top and bottom of the LED-brick
  • Stick the other end of the cable that is on top of the LED-brick in the GND-port of the Arduino
  • Stick the other end of the cable that is on the bottom of the LED-brick in port 13 of the Arduino
  • Connect the Arduino to a computer with the Arduino software running
  • Upload the "BLINK" sketch from the Arduino example files to the Arduino

FINISHED!


Step 12: The next step

The next step will be to make more modules for the Brickduino:
  • light-sensors
  • make a LEGO-compatible housing for the Arduino
  • motors
  • servo's
  • IR-sensors
  • push-buttons

0 comments:

Post a Comment