# Building Kinetic Sculptures with Lego Mindstorms

• Print
Learn how to build a Bubble Machine, a robot with a funny motion, and other kinetic sculptures using Lego Mindstorms.
Also see author Ben Erwin's fascinating tour of the making of his Lego Mindstorms book at his own web site.

## Chapter 11: Kinetic Sculptures

Kinetic sculptures are artistic sculptures that move. Perhaps you've seen a kinetic sculpture in a museum, an airport, a public park, or on television. They are fun to watch and sometimes can mesmerize you for a long time as you try to figure out their motion or just sit back and experience them. This chapter describes four different LEGO kinetic sculptures: a Bubble Machine, a model of a museum sculpture, a robot with a funny motion, and a model of a sculpture from a famous artist.

Yes . . . the way the world is supposed to work.
—Mitch Resnick, MIT Media Lab, after seeing an early prototype of the LEGO bubble machine, commenting on the fact that bubble wands fit perfectly into a LEGO connector peg

## Bubble Machine

### Inspiration

My first kinetic sculpture was a Bubble Machine. The book Designing Everyday Things, Integrated Projects for the Elementary Classroom includes a section on bubbles. In these bubble activities, students are encouraged to investigate and experiment with designing different bubble-blowing devices. Reading this section made me think, "Hey! I can build that with LEGO!"

Extra Building Elements

Propeller, nine-volt motor, small yellow baseplate (optional), yellow bricks (optional) (see Figure 11.1)

Figure 11.1 The propeller and the nine-volt motor are used in the Bubble Machine.

### Designing and Building

After deciding to make a kinetic sculpture, you should make a sketch. Figure 11.2 shows a sketch of a Bubble Machine that has a rack and pinion to dip the bubble wand down into some bubble solution and then up to a fan.

Figure 11.2 The first sketch of the Bubble Machine.

Engineering Aside: Form Follows Function

When first beginning a design, it's tempting to mimic something from the real world as closely as possible. Although in the case of the bubble wands, it probably would have worked, this approach often isn't the best way to do things. One example in history involves the invention of the airplane. Early inventors tried to make flying machines that mimicked birds. Birds get both forward motion, or thrust, and upward motion, or lift, by flapping their wings. These early flying machines also tried to get thrust and lift from flapping wings. All of these efforts failed. Instead of looking at the particular manner in which a bird flies, the Wright brothers thought about what the different functions of a bird's wings are: thrust and lift. They decided to have separate physical components, or forms, for each function: an engine to provide thrust and wings (that didn't have to flap because they didn't have to provide thrust) to provide lift. So remember this lesson from history when you design something: It's usually better to think about the function first and the form, or the physical components, second.

A rack and pinion is one of the best ways to transfer rotational motion into back-and-forth motion (see Figure 11.3). It's used in most steering systems. The gear that makes the rack move is called the pinion. The rack and pinion was a natural first idea for the Bubble Machine because this is the way that we blow bubbles ourselves: We use our hand to dip the bubble wand down into the solution and bring the wand straight up to our mouths, where we can blow the bubbles. Using the rack and pinion for this motion, however, would be a slow process, and there would be a long pause between one stream of bubbles and the next. The second idea was to use several bubble wands circling around (see Figure 11.4).

Figure 11.3 A rack and pinion translates the rotational motion of the steering wheel into the back-and-forth motion of the tires on a car.

Figure 11.4 The second sketch of the Bubble Machine.

The first problem to concentrate on for constructing the Bubble Machine was the fan; Getting the LEGO fan blades to blow a strong burst of air was going to be a big challenge. Knowing that I needed the fan to go very fast, I first tried to gear up the motor as much as possible (see Figure 11.5). The older, faster nine-volt LEGO motor was used for maximum speed.

Figure 11.5 A first attempt at making a fast fan involved a compound gear train.

Mathematical Aside: Compound Gear Trains

When people talk about gears meshing together, they sometimes use the term compound gearing to describe the system of gears. Compound gearing is taking advantage of the multiplying effect of having two gears on the same axle. Compound gearing was used on the six-legged walker described in Chapter 5 and is used on the inside of the gear motor. In the case of the six-legged walker, compound gearing was used only as a matter of convenience to connect one axle to another. In the case of the inside of the gear motor, however, compound gearing allows the motor to be geared down twice in a compact space.

As was discussed in Chapter 4, different-sized gears can be meshed together to create speed with less strength, or slowness with more strength. As we saw with the Giraffe's neck, the worm gear turning another gear is one of the strongest and slowest gear combinations there is by using only two gears. But there are ways to get even slower and stronger (or faster and weaker) gears by using more than one gear on the same axle. Consider the gear train in Figure 11.6.

Figure 11.6 A compound gear train with a gear ratio of 1:25 increases the speed by a factor of 25.

When the motor turns the first 40-tooth gear (gear A in Figure 11.6) once, the first 8-tooth gear (B) turns 5 times. When the first 8-tooth gear has turned 5 times, the second 40-tooth gear (C) has also turned 5 times, because they are both on the same axle. When the second 40-tooth gear turns 5 times, the second 8-tooth gear (D) turns 25 times. In other words, the overall speed has increased by a factor of 25.

We can also examine the forces at various points along the gear train, in a similar manner to the analysis we performed with the Giraffe's gears (see Figure 11.7). The force provided by the motor is first decreased by a factor of 5 at the junction of the first 8-tooth gear, and then it's decreased again by a factor of 5 with the junction of the second 40-tooth gear and second 8-tooth gear. Overall, the force has decreased by a factor of 25, and the speed has increased by a factor of 25. The reverse would be true if the motor were connected to the 8-tooth gear (D), in which case the motor would be geared down instead of geared up.

Figure 11.7 The compound gear train has the effect of decreasing the strength, or force, that the turning axle can supply.

The compound gear train that was used to make the fan turn quickly and move lots of air was inspired by the inside of the Bubble Copter toy (see Figure 11.8).

Figure 11.8 The Bubble Copter (left) uses a complicated compound gear train (right) inside of it to get the fan to turn fast enough to blow bubbles.

The way the Bubble Copter works is this:

1. You push hard on the handle of the Bubble Copter, and the wheels start to turn.

2. The motion of the wheels turns a big gear, which in turn is geared up with a compound gear train until it's turning a fan (at the center) extremely fast to blow some bubbles.

Using all of those gears in the Bubble Machine posed a big problem though—weight and friction. There is always friction between two gears that are meshing together, causing them to spin slower than you would expect. The extra gears put an additional load on the motor, causing it to turn slower. With the Bubble Copter, the friction is overcome by pushing hard on the handle. When you try to push the Bubble Copter on the ground, you can feel the resistance caused by the friction in between the gears. You can overcome the friction by pushing harder on the Bubble Copter, forcing the wheels to move on the ground, which then forces the gears to spin quickly. With the Bubble Machine, unfortunately, you can't do that. The LEGO motor can spin only as fast and as strong as provided by the electrical power. The friction and extra weight of the compound gear train of the Bubble Machine fan was causing the fan to turn too slowly to blow a bubble. I temporarily gave up on working on the fan and moved back to the wands.

Getting the bubble wands to move slowly wasn't as challenging as getting the fan to move quickly. While working on making a slow-moving gear train, I also worked on how to connect bubble wands to the gear train. After experimenting with a couple of different all-LEGO bubble wands without success (see Figure 11.9), I cut off the ends of some plastic bubble wands that come inside bottles of bubble solution to use as wands. It just so happens that the cut-off bubble wand fits directly into the end of a connector peg very well (see Figure 11.10).

Figure 11.9 All-LEGO wands made from beams and pegs or a modified large pulley wheel were tested.

Figure 11.10 The standard bubble wand fits well into the LEGO connector peg and is held in place by friction. Cross blocks and connector pegs with axles were used to connect the wands to the slow-moving 40-tooth gear.

In the process of getting the bubble wands to move slowly, friction works in favor of the bubble wands. Wanting the bubble wands to move slowly, I geared down the motor as much as possible. The compound gear train from the Mathematical Aside, "Compound Gear Trains," earlier in this chapter —used in reverse—is the gear train used in the Bubble Machine to make the bubble wands turn slowly and with enough strength to force them through the thick bubble solution (see Figure 11.11).

Figure 11.11 A compound gear train is used to gear down the motor for the bubble wands.

There are alternatives to gearing down when trying to get something to move slowly. One alternative solution to having the wands spin slowly would have been to use the micromotor—the slowest LEGO motor there is (see Figure 11.12). The micromotor isn't always the best alternative to gearing down, however. While the micromotor is slow, it's not necessarily as strong as another motor that is geared down. Before using a micromotor for a certain application, test the maximum strength that is necessary for the micromotor to withstand.

Figure 11.12 The LEGO micromotor is the slowest LEGO motor at a maximum 30 RPM.

Engineering Aside: Pulse Width Modulation

In most cases, such as when very little load is on the motor, using set power doesn't have an effect at all. The reason that set power has such a limited effect has to do with the way that the RCX controls the speed of the LEGO motors. When the set power command is used to lower the speed of the motor, the RCX turns the motor on and off very quickly—over 100 times a second. This is called pulse width modulation (PWM). During one of the fractions of a second that the motor is turned off, the motor will keep spinning on its own because of its inertia. Inertia describes the property of all things to stay in motion once they are set in motion, unless acted on by an outside force. Because of the inertia of the inside of the motor, once the motor starts being pulsed—turned on and off—the motor quickly picks up enough speed to be close to equal the speed of power level 8. This applies only when little load, or outside force, is on the axle of the motor, however. With a bigger load on a motor, such as when the tires are trying to climb a ramp or go over rough terrain, the motor cannot gain enough inertia to have a considerable speed when set power is low. This is proven with datalogging in Chapter 21.

Another alternative for changing motor speed is to change it from within RCX Code with the set power command (see Figure 11.13). Unlike gearing down, using set power makes the motor spin slower but not stronger. If both motors are set to power 1 on a robot, it's possible that the robot won't move at all, and instead only the humming noise of the stalled motors will be heard. If this happens, it's a sign that too much load is on the motors, and the power level should be higher.

Figure 11.13 The set power command changes the speed of the LEGO motor.

LEGO Aside: Plastruct

I also investigated making a bubble solution dish out of LEGO bricks. On the first try, bubble stuff leaked out of the cracks. Using silicon gel on the inside of the case helped, but there were still small leaks in places. My friend, LEGO Mindstorms Master Builder Anthony Fudd, then told me about Plastruct (see Figure 11.14).

Figure 11.14 Plastruct welds LEGO elements together.

Plastruct is the product that LEGO engineers use when they want a model to stay together. It helped me to make a leak-proof LEGO bubble solution dish. You probably don't want to ever make a robot stay together permanently, but there might be cases, such as with the bubble solution holder, when you need a tight seal. Plastruct is a liquid that you brush on the plastic pieces (see Figure 11.15), and it actually fuses the two pieces of plastic together. It can be found in arts and crafts supply stores.

Figure 11.15 Plastruct can be brushed on the outside of LEGO bricks after the construction is finished or between the LEGO bricks when the construction is underway.

You can brush on Plastruct as you are building or after something has been built. A thicker form of Plastruct is used for the very large models, such as those found in FAO Schwarz or LEGOLAND.

Warning: The vapors of Plastruct are harmful, and you must use it in a ventilated area, such as near an open window.

After constructing a working system of slowly turning bubble wands, my attention was turned back to the fast motor and fan. As was mentioned earlier, too much friction and weight was in the compound gear train to make the fan turn quickly. The problem was solved by simplifying the gear train. Instead of a compound gear train, a 24-tooth gear meshing with an 8-tooth gear was used instead (see Figure 11.16).

Figure 11.16 The gear train for the fan was simplified to a lower gear ratio. The lower gear ratio actually turned the fan faster than the higher one.

It turns out that the fan actually turns faster with these two gears than with a compound gear train, even though the motor isn't geared up as much. The reason is that less weight and friction is involved with only two gears. When a bubble wand with solution in it was held up to the fan to test it, it almost worked! A bubble started to form in the bubble wand, and the motor had been geared up by only a factor of three. Even though it still wasn't working, "almost" having success made me excited. Next, I moved the propeller out farther along the axle, and I moved the motor backward so that more air could be drawn through the fan (see Figure 11.17).

Figure 11.17 The motor was moved farther from the propeller to allow the propeller to blow air more efficiently without interference.

This helped, but there were still no bubbles. For inspiration and ideas, I found Fred Martin's paper "The Art of LEGO Design" (ftp://cherupakha.media.mit.edu/pub/people/fredm/artoflego.pdf).

"The Art of LEGO Design" offers many tips on good LEGO construction. One topic in the paper is about axles binding, or rubbing, inside of the LEGO beams. It mentions that a good solution to this problem is to put the axle through two beams and brace the beams with a plate to ensure that the axle stays straight (see Figure 11.18). I turned on my fan motor and looked at the axle from the side. Sure enough, it was vibrating (see Figure 11.19). In fact, the vibration was made worse by having the propeller farther along the axle away from the motor. With the fan axle through a beam, and the beam secured to the Bubble Machine, I tested it again (see Figure 11.20).

Figure 11.18 An axle turns more efficiently when held in place properly.

Figure 11.19 The axle of the propeller was vibrating too much to turn the propeller at a good speed.

Figure 11.20 Placing the LEGO axle through a beam stopped the axle from vibrating too much and allowed the fan to spin faster and blow bubbles.

It blew a bubble! It was one of the proudest LEGO building moments I've ever had, because I had worked so hard for it and solved so many problems. Streams of bubbles came out of the bubble wands every time they passed in front of the fan. It was great fun.

### Programming and Testing

The Bubble Machine can be programmed many different ways. One idea is to program it to turn on and off when the touch sensor is pressed (see Figure 11.21).

Figure 11.21 A touch sensor-watcher doesn't act like an on-off switch.

The touch sensor-watcher turns on the Bubble Machine when the touch sensor is pressed and turns it off when it's not pressed. This doesn't act like a real on-off switch, however. A better program would be to wait for the touch sensor to be pressed, turn on the motors, wait for the touch sensor to be pressed again, and then turn off the motors (see Figure 11.22).

Figure 11.22 A better program for the Bubble Machine that attempts to act like an on-off switch

This new program doesn't work well, however. The reason is because the RCX processes commands very quickly, one right after the other. For example, when the touch sensor is pressed and then released, it takes a small amount of time to press the touch sensor. In that small amount of time, the RCX turns on motors A and C and then checks again if the touch sensor is pressed. If your finger is still on the touch sensor when the RCX checks the touch sensor again fractions of a second later, it turns the motors off. The solution to this problem is to add commands that will wait until the touch sensor has been released (see Figure 11.23).

Figure 11.23 Adding commands that will wait until the touch sensor is released before checking for a new action makes the touch sensor act like a real on-off switch.

To make the wait for touch sensor command wait for a release, click on the image of the touch sensor (see Figure 11.24).

Figure 11.24 To change a touch sensor command from pressed to released, click on the image of the touch sensor.

Besides a toggle switch, more interesting programs can be written for the Bubble Machine. Once during a conference presentation, I programmed the Bubble Machine to turn on when the temperature in the room reached 70 degrees (see Figure 11.25).

Figure 11.25 A program that uses the LEGO temperature sensor to turn on the Bubble Machine when the temperature rises above 70 degrees

A program can also be written that turns on the Bubble Machine when someone gets close to it, by using the light sensor. It's possible to write a program that simply uses a sensor-watcher to wait until the light level is above ambient room light and turn on the motors. However, this program doesn't work when the person approaching the Bubble Machine is wearing black clothing. In this case, the light sensor senses a value darker than the ambient room light. What is really needed is a program that will do the following:

• If the light sensor value is below ambient light, turn on the motors.

• If the light sensor value is around ambient light, do nothing (turn off the motors).

• If the light sensor value is above ambient light, turn on the motors.

To accomplish this, the Bubble Machine should sense a change in the value of the light sensor, and not just "do something when bright" and "do something when dark." A sensor watcher in combination with a continuous check and choose command will accomplish this "change detection." A check and choose command is similar to an If-Else statement, in the same way that a sensor-watcher is similar to an If-Else statement inside of an infinite loop (see Figure 11.26).

Figure 11.26 A program that turns on the Bubble Machine when someone gets close to it.

In the example shown in Figure 11.26, the ambient light level in the room is 35. If the light remains within the range of 31–40, the motors will be off. If the light falls below 31 (someone wearing a dark outfit is approaching) or above 40 (someone wearing a bright outfit is approaching), the motors will turn on.

One cautionary note should be added about the Bubble Machine. It does matter which direction the propeller is turning. If it turns in the wrong direction, the air blows the wrong way!

The Bubble Machine received a nomination to the mindstorms.lego.com Hall of Fame in August 1999 and got second place in its category.

### Further Work

Here are some more ideas for your Bubble Machine:

• Make a rolling Bubble Machine on wheels.

• Add a pivot to the Bubble Machine and use the second gear motor to automatically tip the Bubble Machine up and down periodically, so that it can blow bubbles high up into the air and then redip by itself.