Battery Powered Ladybug Eggliner Train and Controller

We wanted a garden train around our deck and backyard to deliver popcorn and drinks for outdoor movie nights. We also wanted to make it approachable and usable for our toddler, as she loves trains. With that in mind, I decided to design it with two modes, a manual mode with a controller made just for her and an automatic mode via Home Assistant. Fairly quickly, we ruled out making a Bluetooth app or local webpage to control it. We wanted the experience to be phone free and the technology not to distract from the fun. So we went about designing an ideal control experience in our own physical controller. My daughter and I sat down and sketched our ideas together, what buttons do, what indicator lights it should have, etc. I wanted it to feel as analog as possible and be natural for small hands to hold, yet rugged enough not to break. We also wanted it portable, so she could wander with it and not be tied to a cord. One of the more exciting things I learned about was ESP Now, a direct way to communicate between two ESP microcontrollers using the WiFi radio. It does not require all the overhead of WiFi, has a quicker response time, uses less power, and messages receive a confirmation. The data rate is a lot slower, but I needed to send very small messages as needed. So we put an ESP8266 on the controller and an ESP32 in the train.


I took the drawings to TinkerCAD and set to work. After a few revisions and color changes, as requested, we came up with this.

For the microcontroller, I used an Adafruit ESP 8266 Huzzah Feather I happened to have already because it had a LiPo battery connector and charge controller built right in. I should have used the ESP32 version in hind site, as I used almost every GPIO pin. 

-For the speed control, I used a potentiometer with a 3D-printed swing arm. 
-I used a vintage toggle switch my daughter picked out with just the right amount of resistance to force to control the direction. The center is off/stop.
-We wanted several actions it could do, so we put three push buttons on it. Again, purely based on feel, we picked out Japanise Sanwa 18 MM arcade buttons. This choice, along with the large toggle, made everything a VERY tight fit. Everything just fits. Right now, the buttons each play different sounds: a train whistle, a bell, and a quack.
-It contains a small Adafruit 350 mAh LiPo battery, which seems plenty for many hours of play. 
-A small, simple toggle switch on the back grounds out the enable pin on the microcontroller, turning off its voltage regulator. This allows it to be still charged even when it’s turned off.
-It was essential to give feedback that the speed was increasing, so I designed five LED ovals that sequentially light up as the speed increases. The first is a power indicator and is green; the middle ones are yellow, and the top one is red. I used white low temp thermal plastic with just the right opacity to fill the holes. 

Besides being very tight, things worked out as expected, with the exception of an ESP8266 quirk. I found that if you read the analog pin too often (which I was doing every time in the loop), WiFi or ESP Now will not connect. I fixed that by only reading the analog pin every 50 ms and not sending commands via ESP Now more than three times per second.

Train Receiver 

For the train, I went with an ESP32, so I could use it to play sounds via its built-in DAC and to give me more options to upgrade in the future. It was a tight fit, but I 3D printed a bracket to hold the following components and an oval shell to hide most of it from the train windows.
-PAM8403 audio amplifier
-1 watt speaker
-5V, 1A Step-Up/Step-Down Voltage Regulator S13V10F5
-L298N Motor Drive Controller Board Module, Dual H Bridge (I had to disable the onboard voltage regulator, which was limited to 12v, and use the external one above.)
-14.4V 2000mAh battery pack with BMS

Ladybug Eggliner Train

The decision to go with the Eggliner train was 100% decided by my daughter. She LOVES them and especially loves the Ladybug version. Ever since she saw one at Fenwood Botanical Gardens, she has been asking to watch videos of them online and someday get our own. 

Eggliners have an interestingly polarized following; people love or hate them. We happen to love them and think they are lots of fun! They are also well-made and capable. Besides pulling standard stock, you can buy an Egghauler and get some cool matching stock.

Originally invented and made by Astro-Craft when they had the brilliant idea of gluing two end pieces together from their streamline car. After they went out of business, Bachmann started making them but improved the design by making the top all one piece. We waited for Bachmann (or any retailer) to stock a ladybug for months before we found a used Astro-Craft.  It made the space we had to work with a bit cramped, but it turned out to be handy to have it split into two parts when working on it.


The Eggliner has a history of being powered by a battery. The original versions even had connectors for a battery car with a switch to change modes. From what I can tell, few people did this, but it is interesting. I also found a few examples of people that put 12v lead-acid batteries inside the Eggliner and could run for an hour or more.

There are some good reasons to run on battery. One of the big ones for us was not having to get and keep the track in perfect condition. Besides running around the deck, we planned to have it on the carpet indoors occasionally.

I wanted to be able to run the train closer to the normal max voltage/speed, so I decided to go with a 14.4v pack, and with the possibility of higher amp draws, I had planned to build a four-pack of 18650 batteries with a higher rating with a BMS like this one:
But as I was looking around, I found many cheap replacement vacuum cleaner battery packs that included that same BMS (I took it apart to confirm it had one). So I ended up getting one of those vs. building my pack.
This 2600 mAh pack goes for less than $19:

Charge it!

I planned to use a small section of electrified track to charge the battery, but it turned out that in my train, the motor block was more complicated than I assumed and seemed to have some blocking diodes. I plan to return to that, but I just added a barrel connector to charge it in the meantime.
I charge it with a 15v 2amp charger, which takes about an hour to charge to 90%. I went with 15v vs. 16.8v, so it will never be 100% charged and last longer. 

3-D Print STL files

I have uploaded the STL files to Thingiverse here:


I can share the complete code if anyone is interested. ESP Now was the most exciting part, but I did have some debounce code for buttons and the toggle, and I used map, and constrain for the analog reads on a timer.
UPDATE: Added controller code.

Controller Code 


Here are some rough drawings, I will replace them with Fritzing schematics someday.

What’s Next!?

Besides making a section of track to charge up on, I will add more sensors for automation. This might include an NFC reader to keep TRACK of where it is.


Prolonging battery pack life   

ESP Audio Library and examples:

Switch debounce library:

ESP Now tutorial:

Motor controller tutorial:

Bachmann Trains Eggliners:


Web or Bluetooth phone control



This entry was posted in 3-d printing, Computers and tagged , , , , , , . Bookmark the permalink.

1 Response to Battery Powered Ladybug Eggliner Train and Controller

  1. Erica says:

    You’re such a great dad!

Comments are closed.