Easter Eggs That Hide Themselves
by donutsorelse in Circuits > Arduino
102 Views, 2 Favorites, 0 Comments
Easter Eggs That Hide Themselves
 | Easter Robot)
We go through the effort of hiding eggs each year, but what if they could hide themselves? Better yet, what if they could try to run away from us to protect the little candies inside? Today, we're putting together a simple robotic system for allowing eggs to be on the lookout for an approaching human and run away if they see one.
I had this idea only a couple days before Easter, so it's a simple build that is focused around just being a fun and goofy project that also provided some amusement for my kiddos. It's a low cost and easy project for anyone looking for an easy one to learn some basics with.
Supplies

- Romeo BLE
- 6v 133RPM Motor (2x)
- Ultrasonic Sensor
- 4 Slot AA Battery Pack
- Wheels (x2-4)
- Simple Robot Base (I used a scrap piece of wood)
The project takes only a few electronics. The Romeo BLE is handy because it acts as a motor driver and the arduino device, so it cuts down on the hardware list a bit and makes things slightly simpler. I had a couple of 6v 133RPM motors so I went ahead and used those for the robot's mobility. For the eyes, we're using an ultrasonic sensor. The power is just a 4x AA battery holder. Otherwise, it's all literal junk I had lying around, so the supply list from here feels super doable (and, very obviously, cheap!).
For wheels I used 2 lids of the same size. I used just a small thin board for the body, a couple rolly wheels I found for some added stability, and random wood pieces to get those wheels a bit closer to the ground relative to the lid-wheels. The motors sat on a bent piece of metal I had around.
Wiring

Like I mentioned, the Romeo BLE acts as both the motor driver and the arduino device, so this section will be short. We just need to get our motors, ultrasonic sensor, and battery pack connected and we're good to go.
The motors get plugged into the designated left and right motor spots on the Romeo BLE.
The ultrasonic sensor connects like so:
Vcc → Romeo 5 V
Gnd → Romeo Gnd
Trig → D2
Echo → D3
And we just connect the battery pack to the Romeo BLE for power. This is enough power for both the motors as well without extra effort.
Code

As always, the code is provided, but here's a brief overview of what it does. We check for if we see something between 1 foot and just under 6 feet and start the run away process if we see something. We look for something past 1 foot in case it stops near something. If it's hiding, it's better that it stays put instead of just scaring itself away over and over unless we do see someone approaching! We keep it under 6 feet to ensure the ceiling isn't detected during testing.
When we see someone within that range, the robot backs up, turns around, and then books it in the opposite direction. After a certain point in the running, it can do some slight turns for additional evasive maneuvering.
The robot runs through a few simple states: cruising around, dodging when it sees someone, sprinting away, and then stopping until it sees another person. The sprint time is random, just to keep things fun. And while I originally thought about making it find a hiding spot, it turns out just running like a maniac works better — so that's what it does now.
Downloads
Putting It Together


Last but not least is the egg. I'm going to include the models I put together for the egg. I wasn't able to use them, as they wouldn't have been done in time, but hey the models exist now so maybe someone out there will enjoy them. The 2 holes are for the ultrasonic sensors.
I ended up just adding a horde of plastic eggs to the top of the robot and calling it a win. Now, many eggs get the power to escape. Perfect.
My kids had a blast with it as the robot ran away from them on approach. It's a simple build, but I had fun with it so hopefully you enjoyed the journey as well. Have a good one.