9V Lego Motor Drive


November 6th, 2010

I recently dug out my old box of Legos and have been spending lots of time in the basement around a low table with the kids building all sorts of contraptions. My old Lego set has a few of the 9V motors. I remember the batteries for those motors lasting much longer but with my kids they seemed to die out at a bank breaking rate.

The First Model

After the short lived life of the first set of batteries I headed into my workshop to look for a outlet tethered substitute. I combined one of the old "plug style" battery packs with a 9V DC wall wart using a little electrical tape. It was ugly but it worked. The kids didn't seem to mind the cord and I liked the economy.

We used my rigged up battery pack substitute for about a month but I decided it was time for an upgrade. I thought as long as I was going to build a new motor drive I might as add a few bells and whistles while I was at it. I thought at a minimum it should have an on/off switch, a variable voltage for motor speed control, and a polarity reverse switch.

Power Supply Research

For the power supply I wanted something that had an adjustable output from 0 to 10V with enough current to supply the largest Lego motors at full stall current, which seemed to be around two Amps. Initially I was going to build the 110V AC adapter transformer into the same box as the supply but I reconsidered. First, it seemed safer to keep the higher voltage away from the fingertips of whoever was operating the box. Second, the transformer would not fit in the box size I was targeting. I found an old wall wart that put out 24VAC at 1000 mA. That seemed like it would work.

To find the parts for the voltage regulator I started off by rummaging through my box of old scrap circuit boards that I had rescued from lab garbage cans at work over the years. In that box I found a gate driver power supply board that had two switching power supplies circuits (buck converters) based on the National Semiconductor LM2576 simple switcher IC. The ICs could handle up to 3 Amps of output current and 37V input. The regulator also happen to be the adjustable variety which was perfect. That circuit board gave me all the core parts I needed but the problem was they were still on the board with a bunch of other stuff I didn't need.

My solution to extracting the parts was a bit brutish from an engineering standpoint. I got out my hacksaw and tin cutters and started slicing up the boards. The power supply circuit was basically a self contained circuit so it was easy enough to cut around the parts I wanted to section out.

Voltage Adjustment Range Calculation

The datasheet for the LM2576 spells out the equations to calculate the sense resistor divider for a given voltage output. I happen to have a nifty 10K Ohm pot with nice tactile feel so that's what I plugged into the equations. I wanted the voltage dial to be 3-year old proof so when they cranked it to either extreme the voltage would be safe for the motors.

    VOut = VRef ( 1 + R2 / R1 )

    R2 = R1 ( VOut/ VRef - 1 )

    Where VRef = 1.23V and R1 needs to be between 1k Ohm and 5k Ohm.

 With a little iterative fudging of the numbers I can up with the following:

    VOut = 9.5V when R1 = 1.65 kOhms and R2 = 11k Ohms
    VOut = 2.0V when R1 = 1.65 kOhms and R2 = 1k Ohms

Values of R2 from 1k to 11k equated to a 10k pot in series with a 1k resistor. The 1k resistor would provide a minimum resistance when the pot was cranked all the way down.

The down side of this regulator is that the output voltage would only be around 2V minimum. To get it closer to zero when the knob was cranked down I added a couple of MUR120 diodes to the output to decrease the output voltage by about volt. The final voltage range was 1.1 Volts to 9.7 Volts at no load.

Lego Motor Drive Box Construction

Initially I was going to shoe horn the guts of the power supply into an old plastic enclosure I had laying around my workshop. The more I thought about it the more I thought it would be much neater to build a box out of actual Legos to house the power supply.

To build up a solid base for the supply I used some old Technic 2 x 8 plates with several 1 x whatever bricks. The idea of using the technic plates was A) I had a lot of yellow ones I never used because most of my parts are red and B) the technic plats have holes which I thought would be good for convective cooling of the power supply.

To keep the base together I used two part plastic bonder epoxy. My plan was to eventually glue the entire box together but first I thought I would make sure it worked before etching it in plastic. That and I only had enough epoxy to glue the top and bottom sections.

For the top layer of bricks I sacrificed a few of my Technic bricks. Once again the idea was those brick had holes to allow for some convective cooling of the power supply.

Visual Feedback

Once the basic heart of the power supply was figured out I thought I would some flair. I commandeered some translucent bricks from my kids Lego collection (promising to pay them back) and glued on some red, yellow, and green LEDs via the two part epoxy.  I connected three LEDs to the unregulated 24V supply and three to the variable voltage output.

Delayed Features

For the polarity reverse switch I needed at least a double throw, double row switch. I rummaged through my workshop and the only one I could find seemed to be half broken. I left a place holder for it on the box and figured I would add it in once I found one.

However after I saw the kids playing with the box I thought it would be a good idea to leave that feature out for a while. They seemed to like making the motor make extreme changes by yanking the speed up and down. With a polarity reverse switch I could see them reversing the shaft direction at full speed which would wear out my motors rather quickly.

Putting it All Together

Once the internal parts of the power supply were up and running with the top and bottom plate of the box finishing the rest was relatively easy. It was made out of Legos after all.

I let the kids play with the drive box once I had it all together. They thought it was wondrous so they kept it running continuously for pretty much the better part of an hour. I kept an eye on the box and it got warm but never overly warm, the holes in the Technic bricks I used for cooling seemed to be doing their job. I am going to keep an eye on it however.

Click to Enlarge
Click to Enlarge

UPDATE: Added the Direction Switch In

I ended up putting the polarity reverse switch in. It was a three position switch so there was at least a little delay time between switching motor directions so I think the motors can handle it. Also so far the kids have not been too cruel and its nice not having to reconnect the cable all the time.

Lego Motor Drive with Lego Train

YouTube Video