BrickEngineer: LEGO Design

LEGO Engineering for LEGO NXT and Robot Enthusiasts

LEGO Rendering Tutorial: The Basics


This is the first in a series of installments that describe how to render high-quality 3D images of your LEGO creations.  You will need the following free software:

  • LDraw
  • MLCad
  • L3P
  • POV-Ray v3.6

which can be downloaded with the LDraw All In One Installer

In this tutorial, we will be aiming for a nice simple still image of three bricks.  In later tutorials, we will animate them.  That will require extra software to put a series of inages together to form a video or an animated gif.  I use Adobe ImageReady to make animated gifs, but there are cheaper solutions.

You can also download all the files we will create here
BE_render_tutorial_1.zip
and follow along.

STEP 1: Create an MLCad file of the scene to be rendered

Open MLCad and prepare to place a few LEGO pieces in the scene.

Step 1.1: Set up a 1×1 brick
On the upper left-hand side, click on Brick.
Drag the 1×1 brick into one of the three viewing panels.
With the brick selected click the RED color button to color it red.
Right-click on the brick and select Enter Pos. + Rot…
Use Position Values
should be checked
Set the X and Z values all to zero and Y to -100 (negative 100)

Step 1.2: Add a 2×4 brick
Following the steps above, find the 2×4 brick in the Brick list (+ will expand the list) and add it to the scene.  Set its color to YELLOW and its position to X=100, Y=-100,  Z=50.

Step 1.3: Add a 2×6 plate
Following the steps above, find the 2×6 plate in the Plate list (you will have to scroll down to the Plate tab) and add it to the scene.  Set its color to BLUE and its position to X=100, Y=-100,  Z=-100.

Be sure that these pieces are all at Y=-100.  The -y direction points upward and this will place them above the Y=0 plane.

Step 1.4: Save your work as part-zoo-1.ldr

The screenshot below shows what you should see at this point on your MLCad screen.

MLCad Screenshot

MLCad Screenshot


STEP 2: Create a POVRay file using L3PAO

Open LP3AO (L3P-Add-on) keeping in mind where you stored your MLCad files.  This figure shows you the basic L3PAO window.

L3PAO Screenshot

L3PAO Screenshot

Step 2.1: In the L3P-Add-on window set the Model File to point to your MLCad file.  To browse, you may need to click on the button labeled …

Step 2.2: In the L3P-Add-on window set the POV-Ray Output File to point to the folder where you want your POV-Ray file to go.  To browse, you may need to click on the button labeled …

Step 2.3: In the middle of the right-hand column is the Quality Level setting.  Set this to 2.  IF you select 3 it prints the LEGO logo on every stud.  If you want this, you may leave it.  But I prefer to remove them.

Step 2.4: At the bottom of the middle column is the Render upon Completion option.  This will launch POV-Ray automatically.  However, if you have problems with the automatic launch, turn this option off and load it manually.  In later tutorials, we will edit the POV-Ray file manually anyway.

Step: 2.5: To start L3PAdd-on click on the Run L3P button in the lower right.  This will create the POV-Ray part-zoo-1.pov file in the directory you specified, and possibly launch POV-Ray depending on the settings you used in Step 2.4 above.

STEP 3: Render the Image with POV-Ray

If you launched POV-Ray automatically, you will already have your image.  Here we assume that you will render it manually.

POV-Ray Screenshot

POV-Ray Screenshot

Step 3.1: Open POV-Ray and in the File Menu, use Open File to open the .pov file that was created by L3pAO.

Step 3.2: Once the file is open, you can simply press the Run button on the upper bar.  This will create a default image, which is a 640×480 .bmp bitmap image.  This is saved automatically in the same folder as your .pov file.  Here it is:

Part-Zoo-1 Default image

Part-Zoo-1 Default image

Note that the LEGO pieces are lifted up above the floor.  This is because we set their y-coordinates to be -100, which is above the floor at zero.  Remember that negative y is up.  We now look to change a few features of our render.

Step 3.3: If you click on the Ini button (to the left of Run above), you will go to a screen that enables you to change the size of the output image.  The Section field on the right has many options that include the resolution of the final image as well as whether Anti-Aliasing (AA) is used.  Try changing the resolution and look at the differences between anti-aliased images and non-anti-aliased images.

Note however, that the output images will always be saved in either .bmp or .png format.  You will have to use another program to convert them to other formats if you are interested.

Step 3.4: You can try playing with the commands in the .pov file.  POV-Ray acts like an editor and you can manually edit your files.  For example, there is a section near the bottom that reads:

// Floor:
object {
plane { y, 24 hollow }
texture {
pigment { color rgb <0.8,0.8,0.8> }
finish { ambient 0.4 diffuse 0.4 }
}
}

This code controls the floor of the image.  If you delete it completely, the floor will disappear as you can see here in this image:

Part-Zoo-1 with No Floor

Part-Zoo-1 with No Floor

Step 3.4: IF you don’t like the black background, look in the .pov file for the Background section:

// Background:
background { color rgb <0,0,0>}

Changing the rgb (red, green, and blue) colors to <0.7, 0.7, 1.0>:

// Background:
background { color rgb <0.7, 0.7, 1.0>}

Will give you an image with no floor and a light blue background:

Part-Zoo-1 with a blue blackground

Part-Zoo-1 with a blue blackground

We have explored making simple cad images in MLCad, generating a .pov file using L3PAO, and rendering a high-quality bitmap image using POV-Ray.   You should read through the .pov file and try to figure out what the different parts do.  You can change their values and re-render the image to see what impact your changes have.  Just remember that POV-Ray saves the changes on top of the original file,  so you may want to make a backup first.

Happy Rendering!

The Blossoming Lotus: LEGO Kinetic Art

I call this creation The Blossoming Lotus.  It was originally posted on Online Cortex, but I have decided to repost it here because its just plain fun. Basically it is a large 2D version of a Hoberman sphere. Why did I not make a large Hoberman sphere? First, the parts to make the circle cost almost $80 US. Second, I have other more pressing projects I am working on.

The Blossoming Lotus Kinetic Art

The Blossoming Lotus Kinetic Art

It is about 4 feet in diameter when completely extended and is pretty impressive. Its relatively easy to make. My design consists of constructing each petal with two interlocking pieces: a single-claw arm and a double-claw arm. The parts needed to make the two arms are illustrated below.

Parts for a Single Lotus Petal

Parts for a Single Lotus Petal

To make the entire circle of petals, one needs 20 copies of each petal. The job then is to put them all together. I will post detailed instructions on a website in the near future. For now, here is a closeup of the blossom when completed.

Close Up of the Lotus Blossom

Close Up of the Lotus Blossom

And of course, the project wouldn’t be complete without that animation above made with MLCAD, L3PAO, and POV Ray. The animation was straightforward—once you get the geometry right (which is not straightforward). I will post a lesson on the geometry and the animation of this creation in the future as well. For now, enjoy.

Basic Electronics Supplies for Beginners

I am getting interested in more general robotics projects, but will still be relying on LEGOs for their construction.  The LEGO brick is a bit too limited with its specialized programming languages and limited sensor and motor ports.

So for those interested in some LEGO electronics hacking, here is a list of supplies that will get you up and running fast for about $275… just a but more than the cost of a single Mindstorms kit.  Plus you’ll now get to learn electronics!

First, check out the book:
Making Things Talk: Practical Methods for Connecting Physical Objects

This book explains how to wire, program and interconnect various microcontrollers, some of which are very closely related to those used by the NXT Brick.

Supply List

Item Number Description Quantity Unit Price Total
Amazon.com
  Making Things Talk 1  $19.79 $19.79
Jameco.com
19166 Desoldering Pump 1 $4.95 $4.95
159291 Wire Stripper 1 $10.15 $10.15
161411 Diagonal Cutter 1 $7.49 $7.49
35474 Needlenose Pliers 1 $5.49 $5.49
127271 Mini Screwdriver 1 $1.89 $1.89
681002 Helping Hands 1 $8.75 $8.75
159611 Power Connector 2 $1.79 $3.58
10444 Alligator Test Clip Leads 2 $4.39 $8.78
103377 Header Pins 10 $0.16 $1.60
119011 Push Button (PCB Type) 10 $0.27 $2.70
29082 Potentiometer 2 $1.05 $2.10
242115 LM1117T-3.3 Voltage Regulator 3 $1.39 $4.17
51262 7805T 5v Voltage regulator 3 $0.32 $0.96
38236 2N2222A Transistor NPN 5 $0.41 $2.05
32993 TIP120 Power Transistor 5 $0.45 $2.25
643488 3.3V Zener Diode 5 $0.03 $0.16
35991 1N4004 Diode 5 $0.04 $0.20
152792 LED Yellow 10 $0.17 $1.70
152805 LED Red 10 $0.21 $2.10
153139 LED Orange 10 $0.35 $3.50
156962 LED Green (567 nm) 10 $0.20 $2.00
334529 LED Bargraph Red 1 $1.31 $1.31
334537 LED Bargraph Yellow 1 $1.23 $1.23
334511 LED Bargraph Green 1 $1.28 $1.28
17187 7-segment LED Display 3 $0.88 $2.64
38818 4-switch DIP 4 $0.48 $1.92
38842 8-switch DIP 2 $0.89 $1.78
103166 Resistor Refill 1 $12.95 $12.95
15270 0.1 uF 10 $0.15 $1.53
94161 1 uF 10 $0.12 $1.20
29891 10 uF 10 $0.06 $0.60
158394 100 uF 10 $0.11 $1.08
MPJA
4443 TE Solderless Breadboard 1 $4.95 $4.95
4447 TE Large Solderless Breadboard 1 $22.95 $22.95
7027 TE Jumpers 2 $3.95 $7.90
14213 TE Digital Multimeter 1 $14.95 $14.95
15860 TL Mini Soldering Station 1 $14.95 $14.95
Sparkfun
Wiring Platform DEV-00744 1 $84.95 $84.95
Radio Shack
64-025 Lead Free Solder 1 $3.89 $3.89

Note that the light gray items are optional, and not necessary.

Also, this list does not include some sort of power supply. Pulling one out of an old computer is an easy option. Or rechargeable batteries work well too (in which case you will need battery holders).

Last, there are special items in the book Making Things Talk that you may decide to purchase separately, such as flex sensors, or bluetooth boards, etc.

You can store your electronics in much the same way you store your small LEGO parts. Check out the article on Storage.

Enjoy Hacking!

LEGO Pin and Axle Puller

One of my students recently gave me an idea for a LEGO tool.  This is the LEGO Pin and Axle Puller.  Axle pins and axles themselves are often hard to get out.  At some point everyone has used their teeth, but you damage your LEGOs when you do this; not to mention your teeth!  Pliers do too much damage.  Coating the tips with rubber is a nice trick, but it doesn’t last.  There are plastic grippers, but they don’t grip in the right way to remove these pieces.

So why not make a tool out of LEGOs?

Presenting the LEGO Pin and Axle Puller:

LEGO Pin and Axle Puller

The handle is sturdy enough to apply a reasonable force.  The rubber axle joiners grip axles well without damaging them.  The shock absorber is a nice feature that keeps the tool open, but it is not necessary. Just be sure to use one with a soft spring, rather than a hard spring.  Otherwise, you’ll find yourself working against the spring rather than the part.

The instructions can be found here.

Enjoy,
Kevin Knuth

10+1 LEGO Design and Engineering Tips

1. Use only parts that are necessary…no less and no more.
In the course of trying to fortify a LEGO construction, it is extremely easy to get carried away and add too many parts. If you are like me, you have a limited supply of parts.  Using too many parts rapidly depletes your supply and can add significant weight to your creation.  If you are building a robot, this extra weight can really slow it down.

2. Build strong connections
We all know that when stacking bricks to make a wall, you need to stagger the bricks so that the next layer of bricks holds the bricks in the lower layer together by covering up the cracks.  This is one way to build strong connections.  You can do even better by bracing the wall with a beam by pinning it to technic bricks embedded in the wall.  By adding a few carefully chosen pieces, it is possible to significantly strengthen a structure.  Just be careful not to go crazy and violate Tip #1.

3. Be aware of design constraints
Every time you add a LEGO part to your creation, you limit the possibilities of what you can make.  When you have nothing you can make anything.  When you grab a brick, you can now only make things that have that brick in it.  Each part constrains the creation. Be aware of parts or constructs or mechanisms that place too strong of a constraint on your design.  You dont have to get rid of them, but just be aware of the role they play in constraining what you do next.

4. Dont become TOO attached to your creation.
Sometimes we find that we really really like a certain aspect of the construction or a set of parts, but nothing else works. The tendency is to get rid of everything else and then build up around those parts we really like. However, these parts are placing strong constraints on the design… often too strong, which is why nothing else works. The solution is to get rid of the problem. In this case, you have to get rid of the set of parts you like because it is over-constraining the rest of the design. You dont have to destroy it (see Tip #9)… just set it aside, but be sure to remove it from your creation.

5. Be open to new ideas.
There is always more than one way to solve a problem. Be open to new, and seemingly crazy ideas. Sometimes these lead to ingenious solutions. If you suspect that you are having problems similar to those described in Tip #4, take some time out to brainstorm and see if you can come up with a new idea!

6. Build in stages.
Designing a complex structure or mechanism in one step is almost impossible. Break the construction up into stages, and consider each stage separately. Sometimes a given stage will still be too complex. If so, break that construction up into stages as well. Just be aware of the dangers in Tip #4 above. Your solution for one stage might be awesome, but if it doesn’t work well with your solution as a whole… it has to go. Again, if you have enough parts, keep your creations. Otherwise, at the very least preserve their memory by building them in a LEGO Computer Aided Design (CAD) system.

7. Watch for opportunities.
Sometimes we get lucky and we find that a part or a set of parts can serve two or more functions. This is an excellent situation as it saves you both parts, size and weight. Watching out for these opportunities, and taking advantage of them when you can, can really help make an elegant and efficient design. Just be careful not to become too attached to the idea, as you could end up in trouble as described in Tip #4.

8. Study your design.
When you are all finished, take some time to study and test your design. Consider both form and function. When considering form, you are concerned mainly with aesthetics (beauty). What do you like about the design? What dont you like? Is it too big? Is it bulky? Can it be made smaller, sleeker, more elegant? When considering function, you are concerned mainly with its operation and effficiency. Does it do what it is supposed to? Do the parts go together well? Does it vibrate? Do the gears mesh properly? Does it get stuck? Is there too much friction in the system? Could it be smoother? Is it safeguarded against parts breaking in high torque situations? Then consider the big picture. What did you do right? What did you do wrong? If you could do it over again, what would you change?

9. Keep your designs
I have mentioned this tip several times above. If you have enough parts, and enough room, keep your creations. Otherwise, at the very least preserve their memory by building them in a LEGO Computer Aided Design (CAD) system and generate building instructions. That way you can keep a good idea. Who knows if it will come in handy later?

10. Do it over again!
When building mechanisms that require careful consideration of either form or function, you should plan to make several prototypes (a prototype is a first design). Don’t destroy what you just constructed. You may need to refer to it by copying a part of the design that worked well. You may also need to see if you have improved the form or function by comparing it to your first attempt. I personally plan to make at least three prototypes until settling down with a final design.

11. Color coordinate your creation
I dont apply this rule to my first prototypes, but as I settle in on a final design, I work to choose the brick colors carefully. Of course, we do not always have enough parts to do this, but it is worth the extra effort. Colors scattered all over a design leads the eye to seeing it as haphazard rather than elegant. A careful choice of colors can really enhance the form of your creation. You can also use colors to enhance the function by color-coding functional segments of your design. This is maybe better for illustrative purposes (as in a LEGO CAD design), but usually I choose the latter and aim for an elegant coloration.

Kevin Knuth
Albany NY

Storing your LEGO Collection

It can be very difficult to figure out exactly how to store one’s LEGO parts. This depends greatly on the extent of your collection, and how mobile it needs to be. Below I offer a wide array of suggestions ranging from the size of one NXT set through tens of NXT sets with thousands of dollars of extra parts. Here I will review the solutions that I have found useful, and at the end I will provide a detailed description of my particular storage strategy.


Utility Boxes with Compartments
Clear plastic utility boxes with adjustable compartments are excellent for storing LEGO parts, keeping them separated, and making sure that they are accessible. I have found the products manufactured by Plano Molding Company to be especially useful. The Plano Prolatch with Adjustable Dividers
is secure and allows one to carry the box around without fear of accidental opening. These utility boxes are also included in the larger Plano Tackle Boxes, which provides an excellent means of both storage and transport.The new Custom Divider Systems (CDS) give you a great many ways to divide each box into bins with the greatest versatility. The other divider systems work well, but this is a nice option.

Small Box
Plano No. 2-3500-20
9-1/8″ Wide. x 1-1/4″ High x 5″ Deep
Up to 9 adjustable compartments
Order from Amazon.com
These fit into the Plano 1354 Tackle Box
below
Medium Box
Plano No. 2-3650-20

11″ Wide x 1-3/4″ High x 7-1/4″ Deep
Up to 18 adjustable compartments
These fit into the Plano 1364 Tackle Box below
Large Box
Plano No. 2-3750-20

14″ Wide x 2″ High x 9-1/4″ Deep
Up to 20 adjustable compartments
These fit into the Plano 1374 Tackle Box below

Tackle Boxes
Plano tackle boxes are designed to hold multiple (typically four) utility boxes above. This provides for a readily mobile storage solution. Your LEGO collection can be carried from your home, to the lab, a friend’s house, or into the field at a moment’s notice. Here is a photo of my Plano 1364 Tackle Box that I use for most of my construction needs.

Plano 1354 Tackle Box (3500 size)
I have found that the 1354 Tackle Box is a bit on the small side for even the smallest collections. You will be surprised at how many distinct kinds of Lego parts there are, when you find that they will never fit into the 9×4 compartments. However, this tackle box can hold 4 utility boxes, and you often can put an additional box in the top compartment.
Order at Amazon.com
Plano 1364 Tackle Box (3650 size)
This is a really nice size for a tackle box. I can easily store at least two NXT sets in this tackle box as well as many extra parts. Four Plano ProLatch 3650 stowaway boxes
fit in the tray resulting in 4×18 = 72 compartments. I also manage to keep an additional 3650 box in the top of the tackle box. I can often work with just this subset of my collection. In addition, it makes travel easy.
Plano 1364 Tackle Box at Amazon.com
Plano 1374 Tackle Box (3750 size)
This tackle box can hold a large number of parts. The top bulk storage compartment is sufficiently large and deep to actually hold smaller robots! The 3750 size utility boxes are very spacious, and this tackle box comes with one of the newer Custom Divider System (CDS) utility boxes, and one flip-sider, which is good for fishing tackle, but not so useful for LEGO parts. For this reason, you may need to buy an extra 3750 box to replace the flip-sider. And you may want an extra 3750 to fit in the top compartment.
Plano 1374 Tackle Box at Amazon.com

Compartmentalized Storage
For a more extensive LEGO collection, one may require more storage space for small parts, such as pins, axles, etc. Akro-Mills makes some very nice organizers with a large number of small drawers.

Akro-Mills 10724 24 Drawer Storage

This organizer can hold a healthy supply of small LEGO parts. The organizer comes with partitions that can be inserted into the drawers allowing one to keep more parts.Overall Size: W=20″ H=15.81″ D=6.38″ (inches)
Drawer Size: 4.25″ W x 5.25″ D x 2.0″ HI have three of these. One holds all of my pins and connectors. The second holds all of my axles and axle connectors, and the third holds all of my gears.
Akro-Mills 10124-2 44 Drawer Storage
This organizer can hold a healthy supply of small LEGO parts. The organizer comes with partitions that can be inserted into the drawers allowing one to keep more parts.Overall Size: W=20″ H=15.81″ D=6.38″ (inches)
Large Drawers: 4.38″ W x 5.25″ D x 2.0″ H
Small Drawers: 2.13″ W x 5.25″ D x 1.50″ H
Akro-Mils 10764 64-Drawer Storage

This organizer can hold many small LEGO parts. The organizer comes with partitions that can be inserted into the drawers allowing one to keep even more parts.Overall Size: W=20″ H=15.81″ D=6.38″ (inches)
Small Drawers: 2.13″ W x 5.25″ D x 1.50″ H

Large Storage Bins with Drawers
The larger collections require more extensive storage. Storage bins with drawers are excellent for storing large numbers of bricks of many colors and types. Stackable bins with drawers facilitate organization and access, although they require a good bit of space… or rather, your collection does!

Three Drawer Organizer
I have found the Sterilite ClearView™ Wide Three Drawer Organizer 2093 to work very well. Its dimensions are suffciently large to hold a large number of brick. Or one could make partitions (they do not come with the drawer) to store a wide array of parts in a single drawer. At this point, I use 20 of these to store my bricks, plates, liftarms, wheels, and specialized NXT parts. The clear drawers make it easy to see what is inside, and one can easily afix large easy-to-read labels.The dimensions of the three drawer organizer is:
14 5/8″ L x 14 1/2″ W x 10 5/8″ H.

Large Mobile Storage
My lab requires that a large proportion of my parts be easily transported. The best solution that I have found for this is the mobile toolbox together with a healthy set of Plano Utility Boxes (above). I was surprised to find that there is not the diversity in toolbox designs that I expected. I finally settled on the
Stanley Consumer Storage 033023R Pro Mobile Tool Chest.

This tool chest when packed full holds:
4 large Plano 3750 compartment boxes
3 medium Plano 3650 compartment boxes
6 small Plano 3500 compartment boxesThis is in addition to the large top tray that can hold Mindstorm NXT bricks, a great deal of cabling, and other tools that you might need.The tool chest has a handle and wheels, which makes for easy transportation.
Order from Amazon.com here.

See the more recent posts: COLORFUL LEGO STORAGE IDEAS and New LEGO STORAGE OPPORTUNITIES for more ideas.

Content Protected Using Blog Protector By: PcDrome.