Introduction: LEGO + Arduino = Brickduino (1. the LED)
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:
LEGO:
- 2x1 black bricks
- 2x2 black bricks
- 2x1 red plates
- 2x2 red plates
- 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
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
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
- 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
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
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
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
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.
Step 10: Finishing 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
- 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
- light-sensors
- make a LEGO-compatible housing for the Arduino
- motors
- servo's
- IR-sensors
- push-buttons
I love to hear your ideas and comments.

Participated in the
Hack It! Contest
15 Comments
7 months ago
I made a LEGO / Arduino ESP32 Bluetooth Arcade Joystick. It is only 3.3V though.
7 years ago
Now we're getting very close to my embryo of idea!
But
I'm not very interested of the electric connectivity LEGO offers. It's
both expensive and very coarse. I'd suggest use the Dupont system
instead, if possible. What LEGO really can offer to Arduino projects is some mechanical stability. The true gain of this combination is a chance to attach the Arduino and its external modules to a LEGO plate or, say the body of a LEGO robot!
A LEGO-compatible housing for the Arduino
would be great! But I think just an "open air" interface part would be
even better as you don't know how high the Arduino will build, with
Dupont cables and maybe shield(s) attached to it.
Finally, there
are already tons of modules for the Arduino out there for the cost of
almost nothing. As I view it, the trick is to create an interface system
to snap them to the LEGO baseplate. I'm thinking of making 1x1 round
bricks with an M3 threaded screw or hole, but the problem is that the
modules lack a standard hole configuration. It would have been perfect
if they started using multiples of LEGO stud spacing...
9 years ago
Found this trying to find a quick connect alternative for HO scale train track electrical joiners.
Have you done any more work with Legos since part 2? I'm very interested to see the sensor bricks and arduino case that you mentioned.
Reply 9 years ago on Introduction
Hi! I can't see what you found. Yes I did some more work on it, but I still didn't find the ideal solution. Next month we are planning on integrating some sensors to make a Christmas village. Not sure if we will manage, because last year we had the same plan and we did't finish it than.
11 years ago on Introduction
Epic instructable, super.
I had to stop my own projects for a wile since I am swamped in work. But this project really is marvelous
Keep it up.
Reply 11 years ago on Introduction
Thanx!
It was actually a lot of fun to build the CNC and really great to get it up and running. Also the G-code isn't as hard as I thought it would be. Now I'm just trying to find a way to get my drawings in to g-code without me coding it by hand. That is not so easy on a mac...
Reply 11 years ago on Introduction
True g-code is very straight forward. Altough doing it by hand would not be my first choice.
Very nice hack.
Can you also incorporate stepper motors and drivers into Lego?
11 years ago on Introduction
@Kenyer if you're hoping to drop the price of the Arduino, try the approach described at http://shrimping.it
In particular http://shrimping.it/blog/bill-of-materials/ shows you where we get stuff for workshopping with kids and adults. Following the circuits on the front page should get you a battery-operated standalone near-equivalent to the Arduino Uno for £1.40 (UK money), or around £3.05 if you need USB power and connectivity.
We're still working out how best to document the approach and standardise it for educators, and mostly working with local teachers so far on this, but would be great if we can support you out there too.
Weirdly my main hobby is paragliding. I lived in Ipswich for way too long - the same geology as Holland. Now I've moved near the Lake District. It must be frustrating not to have any hills. I'm putting together a project to create a flight instrument based on the Arduino as part of my PhD, and maybe that would be relevant to you as well.
Reply 11 years ago on Introduction
Hi Cefn,
It was also a great wish of me to build my own Arduino-based Vario. You must have noticed that I am a hang glider pilot.
It would be really great if you made an instructable from your DIY vario.
Your cheapduino is cool. I also make my own cheap Arduino versions, but nog as cheap as you do. I don't bother with the serial port and just program the ATmega in a real Arduido and then transfer the chip to my own board, but I don't manage to get my parts for 2,50 euro (a little bit more than 3 dollar) so I might order some kits in the future.
Peter
aka Kenyer
Reply 11 years ago on Introduction
On the Vario front, to prototype it I just picked up some cheap BMP085 on a breakout board, followed some code and libraries on the web, wrote some averaging code to drive a Piezo and job done! I reckon following the @ShrimpingIt strategy to replace the Arduino I originally used you could get a fully functional alti-vario for less than 10 euros.
My main research direction from there is to use the Nook Simple Touch (E-Ink with a Rootable Android Build) running either as a USB host and a Serial, or using the ADK with a USB host shield. That way you can have a nice, low-power daylight readable display permanently displaying data when flying. We should probably take this discussion off the thread. I'll PM you.
Reply 11 years ago on Introduction
The main trick of @ShrimpingIt is to bulk-buy the ATMEGA328-PU (not the ATMEGA328P-PU - only 1 letter different), which costs much less, but can be flashed with Optiloader to appear the same as an Uno. As far as I know it's binary and pin-compatible, but doesn't have Pico-Power (fancy power management) which I don't expect to use most of the time. Another trick is to use CP2102 for USB->UART which costs a tiny fraction of an FTDI even when shipped individually from Hong Kong. We've dropped the voltage regulator for simplicity as once again it's not needed for a lot of deployment scenarios. When you've finished programming the #Shrimp as a standalone device you can remove the CP2102 altogether, (unlike with an Arduino board) getting you down to that incredibly low cost. Aside from those changes all we're doing is following best practice of other "Breadboard Arduinos" and trying to standardise/document it well. I'm still trying to figure out if I can afford to sell them or if it's better to try to coordinate a buying consortium for schools/hackspaces to collectively buy in bulk.
11 years ago on Introduction
This is awesome, if you can make all of the other sensors and compatible motors then this will beat mindstorms by far. you should try to make some technic versions maybe.
Reply 11 years ago on Introduction
Hi Emdarcher,
I really want to make all the sensors and stuff that I planned.
My only problem with implementing "technic" is that I'm not familiar with the "new" technic beams. I'm from the bricks with holes in them :)
Peter
PS parallel connection brick coming soon!
11 years ago on Introduction
Great Idea, great execution, great Ible!
11 years ago on Introduction
https://www.instructables.com/id/Scrape-Free/