Bug-Eyed Eggliner

Revised 07-19-12

I am a big fan of Aristo Craft's Eggliners and, as you may have gathered from other articles that I have written, I am also a big fan of designing animations for use on model railroads.  The layout that I maintain at Pittsburgh's Children's Hospital includes a loop that normally has a honey bee Eggliner running on it.  We have run a number of different trains there but the children seem to enjoy the bright yellow and black honey bee the most.  There are a many animations on the layout and I thought it might be fun to try my hand at building a moving animation with one of the honey bee Eggliners.  What follows is a description of how the Bug-Eyed Eggliner came to life along with instructions that will help you to make your own.  I believe that you can also use many of the concepts presented here in other projects and animations.

Overview
The honey bee Eggliner already has two large eyes painted atop its body.  It seemed logical to make them larger, 3 dimensional, illuminated and movable.  I experimented with a number of different spheres until I found wooden balls at Michaels, a local craft store.  Wood is easy to paint and to work with simple tools and the balls came in a variety of different sizes.  I decided to add a single 5mm LED to the center of each eyeball and to design and build a servo based mechanism to move the eyeballs back and forth.  A PICAXE microcontroller is used to drive the servo and to blink the lights on and off.

Materials
This list shows what I used to make the Bug-Eyed Eggliner.  There are many substitutions that could be made if you can't locate exactly what is shown here.

Disassemble the Eggliner
Remove the motor block and base from the Eggliner by removing the outer four screws from the bottom (circled below).  The inner screws hold the motor block to the base and do not need to be removed.

Unsolder the bundle of red and black wires from the circuit board (area circled below).  These wires connect the Eggliner's interior lights to track power.  We will solder them back on when we are all done.

Remove the white cardboard oval that is inside of the Eggliner's body.  You can pry off the blobs of hot melt glue that hold it in place or you can cut it out.  It will not be reused so damaging it during removal is not an issue.

Unless you have VERY tiny hands it is easiest to work on the Eggliner once it has been split in half.  Note the thick line of hot melt glue that runs across the middle of the Eggliner joining the front and back.  Pry as much of it off as you can with a flat blade screwdriver.  Gently pry the two sections apart being careful not to break the interior lighting wires.

Once separated it is easy to break off the remaining glue.

Temporarily rejoin the two halves of the Eggliner securing the halves with two rubber bands that encircle the body.

Drill Holes for the Eyes
The eyes that I used were 1" in diameter.  Other sizes are available in craft stores.  Here is the package I found at Michaels.


The eyes will mount onto the Eggliner body through two 1/4" holes.  Use a marker to place a dot in the center of each painted eyeball.  Once you are satisfied that you have marked the center drill a 1/16" diameter hole through the eye.  Drilling the small hole first will make it much easier to drill the 1/4" hole.

While holding the drill perpendicular to the eyeball drill a 1/4" hole using the previously drilled 1/16" hole as a guide.  Note that you can drill these holes at slightly different angles to follow the contour of the Eggliner body or you can place the Eggliner body on a flat surface and drill both holes vertically.  I had the best results with vertical holes.

Preparing the Eyes
Drill a 7/32" diameter hole in the bottom of the eye.  If the wooden balls you purchased have an existing hole, as mine did, just expand that hole with the drill.  Drill a bit more than 1/2 way into the ball being sure that you don't go the whole way through.  I used a drill press to expand the existing holes drilling a few intermediate sized holes before finishing up with the 7/32" hole.

Cut two 1.25" long pieces of tubing from the 7/32" brass tubing.  These will be glued into the eyeballs and will hold them in place.  Test fit the tubing forcing it into the hole in the wood ball.  Remove the tubing and drill a 13/64" hole perpendicular to the 7/32" hole.  This hole is for the 5mm LED.  Drill through until the two holes intersect.  Note that there must be a passage from one hole to the other as the wiring from the LED passes through both holes.

This photo shows the way that I drilled the LED hole.  I used the 7/32" bit to hold the ball in the right position to make the two holes intersect.  The ball fit nicely into the center hole in the drill press's table.

After the eyeballs were primed and painted white I used a steel washer and painter's tape to mask off the area for the black portion of the eye.

Once the paint is completely dry, insert the 7/32" tubing into the hole in the eyeball until it is just short of the LED hole.  Remove the 7/32" tubing, coat it and the hole with CA (super glue) and reinsert the tubing making sure you get the end of the tubing just below the LED hole.  Insert a 6" long two conductor wire, as shown here, or two pieces of insulated wire through the brass tubing, exiting through the LED hole.  The wire I used was from an old rainbow colored printer cable where the two strands are joined together.  Any thin, stranded wire will work.  You may be tempted to use solid wire but, because the eyeballs rotate back & forth, stranded wire has a much better chance of having a long, conductive life! 

Preparing the LEDs
You will note that the base of the LED (the flange at the bottom that has a notch in it) will not fit into the 13/64" hole that we drilled in the eyeball.  The flange at the base must be removed to get the LED to fit.  I nipped away at the base of the LED with wire cutters then cleaned up the edge with a file. Be careful not to scratch the rounded top of the LEDs.

Cut the LED leads so that only 1/8" or a bit more remains. Note that I left the anode lead (positive) somewhat longer than the cathode lead as they were before cutting.  This makes it easy to locate the anode and cathode once the flange at the base is removed.

Solder a 6" piece of red wire to the anode (longer lead) and a 6" piece of  black  wire to the cathode (shorter lead).  Here I used orange (the closest I had to red!) for the anode and yellow for the cathode.

 

Test the LEDs by temporarily attaching a 470 ohm resistor to the red LED wire and applying positive 5 to 12 volts DC to the resistor while connecting the black LED wire to the negative terminal of the power source.  A 9 volt battery works well for testing.  Just make sure to use the resistor or you are sure to destroy the LEDs.

Push the LEDs most of the way into the hole leaving about 1/16 to 1/8" of the LED coming out of the hole.  Glue the LED at that position with CA.

Mounting the Eyeballs
Cut two 3/8" long pieces of brass tubing from the 1/4" diameter tube.  Align them with the 1/4" holes in the top of the Eggliner and tap them into the holes with a small hammer.  The tops of the tubing should be nearly flush with the top of the Eggliner.  In this photo the tubing on the right is in the proper position while the piece on the left still needs to be pushed in a bit.

Insert the eyeball into the 1/4" tube.  It should rotate smoothly.  If there is any friction or binding carefully file away any obstructions.  When you are done testing put a drop of CA on the outside of the 1/4" tube from the inside of the body being careful not to get any glue on the tube attached to the eyeball.

The eyeball on the right is pushed in all the way.

Mounting the Servo
Using heavy duty hot melt glue mount the servo to the back half of the body right against the rear light.  Once the glue has dried temporarily mount the horn to the top of the servo and rotate it back and forth to find the extremes to which it will move left and right.  Move the servo to its center position and remount the horn so that it is perpendicular to the servo.  Note that in this photo the small screw that fastens the horn to the servo has not yet been installed.  Be sure to install the screw when you are done to keep the horn from falling off.

The rods that will move the eyeballs will connect on one end to the servo horn.  On the other end the rods will connect to a horn that we will make from two pieces of brass.  This arrangement will transfer motion from the horn on the servo to the two shafts that attach to the eyeballs.  We could have used a separate servo for each eyeball but using just one makes the installation and software simpler.

Fabricating a Brass Fixture to Move the Eyes
Cut two 3/4" pieces from the 1/32" thick brass stock.  Cut two 3/4" long pieces from the 1/4" brass tubing.  Sand & polish the end of the tube and the brass stock to prepare them to accept solder.

Put a bit of solder flux on the surfaces that will be joined to facilitate soldering.

Here the flame from a small torch is heating the tube.  It is not necessary to heat both pieces.  Once the flux begins to boil remove the flame and touch the joint with solder.  Make sure you get a good flow between the pieces.  Silver solder was not used as this joint will not be under much stress.  I used the same solder that I use with circuit boards and it worked well.

Here are the two pieces after soldering.

Although the next step could be done with a hand held drill, is best to use a small drill press.  Put a 7/32" bit into the drill and, while holding the piece we just soldered with pliers, drill through the tubing to make a hole in the brass bar stock that is perfectly aligned with and the same size as the tubing.  DO NOT hold this with your fingers while drilling!

Here is the piece after drilling.

Drill three 1/16" holes in the brass bar at 1/8, 1/4 and 3/8 inches from the tube.  Cut away any remaining brass that extends beyond the last hole and round the corners.

Here are the two finished pieces.

Test fit the eyeball tube into the tubing on the piece we just made.  It should fit snugly but should go clear through the newly drilled hole.  If it does not go through use a small round file to expand & clean out the hole.

This photo shows the eye assembly.  From right to left is the wood eye with the piece of brass tubing glued in, the short 1/4" bushing that goes through the Eggliner's body and the custom horn that will connect to the drive rod from the servo.  The wires exiting the tube will supply power to the LED.

Connecting the Eyes to the Servo
A connecting rod goes from the each side of the servo horn to one of the eyeballs.  Although it is possible to cut these rods to an exact size it is infinitely easier to use two rods on each side with an adjustable joiner in the middle.

Cut four 3" pieces from the 3/64" brass rod.  Using small needle nose pliers bend a "Z" into one end of each rod.  The "Z" bend is quite small with each segment being only a few millimeters long.  Note that connecting rods like these are normally made from much harder piano wire.  I have found that the brass works well in this application and is much easier to work with!

The two pieces that will make up one adjustable arm are joined by "Dura-Collars" like the ones shown here.  The rods at the bottom give you an idea of how the rods are joined together.  The collars have a small set screw that forces the two rods together locking them in place.

Test fit the "Z" into the brass fixture that moves the eyeballs.  Do the same with the servo horn.  Note that many servo horns do not have holes in them large enough to accommodate the rod I am using.  If it does not fit just drill out the holes in the horn with a 1/16" drill bit.

To join the two rods insert both ends of the rod into one of the Dubro Dura-Collars.  With the servo's horn in the middle position adjust the two eyeballs so that they point straight ahead and tighten the set screw in the collar to join the two rods.

Test the movement of the eyes by manually moving the servo horn back and forth while observing the eyes.  In this photo the two horns attached to the eye rods face in the same direction (see red arrows) - in this arrangement the two eyeballs will move in opposite directions as in the third video.  If you want both eyeballs to follow together (both looking left at the same time & both looking right at the same time) just remove the connecting rod and turn one of the eyeball horns 180 degrees before reconnecting.  Note that I used the outer holes on the servo horn and the 1/4" (center) hole in the eyeball horn.  On those brass pieces I cut off the third hole to prevent it from rubbing against the body.

Electronic Circuit
To make it all work we need to design and build a circuit that can operate the servo and turn the two LEDs in the eye on and off.  I chose to use the PICAXE 08M microcontroller.  I already had made up a circuit board for this chip to operate servos and I determined that it could be easily modified to operate the eyeballs.  The original servo controller and its construction are detailed in these two web pages:

Servo Controller
Servo Kit Assembly

Here is the schematic.  It is the same as the one from the Servo Controller with a few modifications like adding LEDs for eyes and removing the pair of potentiometers for adjusting the servo's movements.

The circuit at the top takes track power and rectifies it and cleans it up with a few capacitors before it delivers 5 volts to the circuit.  The 2200 mF capacitor across the power pins on the PICAXE keep it running if track power is briefly interrupted by dirty track or the frog on a switch.  Pin 2 is used for programming.  Pin 3 goes to the servo.  Pins 5 and 7 go to the eyeball LEDs through 470 ohm current limiting resistors.  Pin 6 attaches to an optional potentiometer that can be used for testing.  Pin 6 could also be used to operate a second servo allowing for independent eye control.  It could also be used to turn the interior lights on and off via a Mosfet or other transistor switch.

The modifications to the board are shown here.  A few traces need to be cut and a few jumpers need to be installed.  You may want to review the procedures in the Servo Kit Assembly described above before starting to build this controller.

Two traces, marked with "X", must be cut on the top of the board

Cut one trace on the back of the board.

Install the voltage regulator, socket and indicator LED.  Apply power and test pins 1 and 8 on the socket to make sure that you have 5 volts present there.

Install the other components on the top of the board including the PICAXE programming header and the 10K and 22K resistors.  The two sets of pins on the far left are for connections to the two eyeball LEDs.  The three pins in the upper left are for the servo.

A number of connections need to be made on the back of the board.  The cross over at the top left shows the leads from the large capacitor going to pins 1 and 8 on the PICAXE.

The two 470 ohm resistors go from the LED plugs to pins 5 and 7 on the PICAXE.  There is also a jumper between two of the LED plug pins.  The black heat shrink tubing keeps things from shorting out.

This close-up view shows the 2200 uf capacitor that keeps the microcontroller alive when going over dirty track.

Power for the Circuit
If you plan on operating the Bug Eye Eggliner at a fairly high speed most of the time, with a track voltage of at least 9 or 10 volts, the circuit will operate just by running the track power through a simple bridge rectifier to provide DC voltage to the board.

If you would like to operate the Eggliner at a low speed, as we frequently do at the Children's Hospital layout, two things need to be done.  First, you need to add an electrolytic capacitor just past the bridge rectifier.  More importantly you need to operate the Eggliner with a power supply unit that employs PWM (also called PWC).  PWM is Pulsed Width Modulation.  This is a method of adjusting power to a train set (or any DC motor) by rapidly turning the power on and off (in pulses).  If the pulses, which can come at very high rates, are off more of the time than they are on the motor goes slowly.  If the pulses are on more than off it goes more rapidly.  By adjusting the ratio of on to off the speed of a motor can be controlled very precisely.

The reason this is important is that the power supply on the circuit board will see, with the addition of that capacitor, a voltage that is very close to the voltage that is powering the speed controller.  For example, if your PWM speed controller has 16 volts on its input side the controller in the Eggliner will see a voltage very close to 16 volts even if pulses are very short and the motor only sees a few volts and moves quite slowly.

The difference in operating the Bug Eye Eggliner with PWM vs. operating it with linear DC is dramatic.  With linear DC the Eggliner starts to move at about 3 or 4 volts but the eyes do not light up and the servo doesn't start to operate until the voltage on the track is raised to nearly 9 volts.  Under PWM the servo starts and the eyes light up even before the Eggliner starts to move and everything operates very nicely at just a crawl.

A standard 1 or 2 amp bridge rectifier can be used for this project.  I opted to make my own bridge rectifier from 3 amp diodes.  The bridge rectifier is made up of four diodes wired as shown in this diagram.  The bar at the end of each diode represents the cathode and is marked on the diode with a band of silver paint.

Track power goes to connections 2 and 4.  Positive voltage is available at connection 1 while negative is at connection 2.  If you follow the path of the diodes you will see that power is always going through two diodes.  Since silicon diodes drop voltages passing through them by 0.7 volts the total voltage loss is 1.4 volts.

To minimize the voltage drop across the diodes in the bridge rectifier I used Schottky diodes which have about half of the voltage drop of silicon diodes.

In order to make up my own Schottky bridge I placed four diodes into clay and soldered their leads.   The clay holds everything in place while soldering. Track power goes to the top center and bottom center joints.  Positive power is available at the far left and negative at the far right, just like in the diagram above.  Once soldered clip off the wires that extend below the solder joints.

Here the diode bridge has been attached to the Eggliner weight with double sided tape.  The two wires in the upper right bring power from the wheels to the bridge.  There are two sets of output wires coming from the bridge rectifier.  One goes to the servo circuit board and the other goes to the Eggliner's inside lights.   The two sets of wires in the lower left go to the eyeball LEDs.  The servo connects via the three conductor cable in the upper left of the board.

The capacitor in the lower right (blue object) normally sits atop the diode bridge.

 

This view shows the unit ready to accept the body shell.

Software
The program is very straightforward and easy to follow.  Each movement of the eyes and accompanying LED activity is called a behavior.  A random number routine calls up the six behaviors with the ON GOSUB statement.  Additional behaviors can be designed or those that I coded can be modified.


'd. bodnar 7-12-2012

'activity:
' blink 3 times on startup
' slowly scan blinking two times
' return to center - pause 1000
' slowly scan blinking rapidly three times
' return to center - pause 1500
#PICAXE 08M2
#NO_DATA
SYMBOL CCWMax = 180
SYMBOL CWMin = 100
SYMBOL Middle = 128
SYMBOL Srvo = c.4
SYMBOL PotRead=c.1
SYMBOL LED1 = c.0
SYMBOL LED2 = c.2


Symbol RndRange =b27
Symbol MinNumber =b26
Symbol Result =b25
Symbol RndNum =w5
Symbol Divisor =w6
Symbol TempVar =b2

servo c.4,Middle ; initialise servo
SERTXD (13,10,13,10,"Version 2.1 Random July 12, 2012",13,10)
for b0=1 to 3
high led1:high led2:pause 200:low led1:low led2:pause 200
next b0

again:

RndRange=6:MinNumber=1:gosub GetRnd'returns "result" between 1 and 6

on result gosub behavior1,behavior2,behavior3,behavior4,behavior5,behavior6

goto again

Behavior1: ' fast blink and med speed scan with eyeballs!
SERTXD ("At Behavior1",13,10)
for TempVar=CWMin to CCWMax
servopos srvo,TempVar
toggle led1:toggle led2
pause 20
next TempVar

for TempVar=CCWMax to CWMin step -1
servopos srvo,TempVar
toggle led1:toggle led2

pause 20
next TempVar
return

Behavior2: ' slower blink and med speed scan with eyeballs!
SERTXD ("At Behavior2",13,10)
high led1:high led2
for TempVar=CWMin to CCWMax
servopos srvo,TempVar
b3=b3+1
if b3 > 8 then
toggle led1:toggle led2
b3=0
endif
pause 20
next TempVar

for TempVar=CCWMax to CWMin step -1
servopos srvo,TempVar
b4=b4+1
if b4 > 8 then
toggle led1:toggle led2
b4=0
endif
pause 20
next TempVar
return

Behavior3: ' fast blink and med speed scan with eyeballs!
SERTXD ("At Behavior3",13,10)
high led1:low led2
for TempVar=CWMin to CCWMax
servopos Srvo,TempVar
b3=b3+1
if b3 > 8 then
toggle led1:toggle led2
b3=0
endif
pause 20
next TempVar

for TempVar=CCWMax to CWMin step -1
servopos Srvo,TempVar
b4=b4+1
if b4 > 8 then
toggle led1:toggle led2
b4=0
endif
pause 20
next TempVar
return

behavior4:
SERTXD ("At Behavior4",13,10)
HIGH LED1:low LED2:
servopos Srvo, middle
for TempVar=1 to 10
toggle led1:toggle led2:pause 500
next TempVar
low led1:low led2
return

Behavior5: ' no blink and slow speed scan with eyeballs!
SERTXD ("At Behavior5",13,10)
high led1:high led2
for TempVar=CWMin to CCWMax
servopos Srvo,TempVar
pause 50
next TempVar

for TempVar=CCWMax to CWMin step -1
servopos Srvo,TempVar
pause 50
next TempVar
return

behavior6:
SERTXD ("At Behavior6",13,10)
HIGH LED1:high LED2:
servopos Srvo, middle
for TempVar=1 to 20
toggle led1:toggle led2:pause 250
next TempVar
low led1:low led2
return

GetRnd: ' select random number routine
'RndRange =50 'random range --- gives a range from 12 to 62
'MinNumber =12 'min number

Random RndNum
Divisor = 65535 / RndRange
'sertxd("divisor ",#Divisor," ")
Result= RndNum / Divisor
Result=Result+MinNumber
sertxd (" ",#Result)
return

The three videos show the Eggliner in my garden, at Children's Hospital and on rollers.  If you look closely you will see that there are two different engines.  One has eyes that track back & forth together while the other has them going crossed as they both move from the outside to the inside.  Please let me know if you have any questions or ideas for enhancements!

VIDEO #1
Eggliner in the Garden
Right click the box below and select PLAY
or click here

 

 

VIDEO #2
Eggliner at Children's
Right click the box below and select PLAY
or click here

 

 

VIDEO #3
Eggliner on Rollers
Right click the box below and select PLAY
or click here