Alex’s quick and easy digital making Easter egg hunt

Looking to incorporate some digital making into your Easter weekend? You’ve come to the right place! With a Raspberry Pi, a few wires, and some simple code, you can take your festivities to the next level — here’s how!

Easter Egg Hunt using Raspberry Pi

If you logged in to watch our Instagram live-stream yesterday, you’ll have seen me put together a simple egg carton and some wires to create circuits. These circuits, when closed by way of a foil-wrapped chocolate egg, instruct a Raspberry Pi to reveal the whereabouts of a larger chocolate egg!

Make it

You’ll need an egg carton, two male-to-female jumper wire, and two crocodile leads for each egg you use.

Easter Egg Hunt using Raspberry Pi

Connect your leads together in pairs: one end of a crocodile lead to the male end of one jumper wire. Attach the free crocodile clips of two leads to each corner of the egg carton (as shown up top). Then hook up the female ends to GPIO pins: one numbered pin and one ground pin per egg. I recommend pins 3, 4, 18 and 24, as they all have adjacent GND pins.

Easter Egg Hunt using Raspberry Pi

Your foil-wrapped Easter egg will complete the circuit — make sure it’s touching both the GPIO- and GND-connected clips when resting in the carton.

Easter Egg Hunt using Raspberry Pi

Wrap it

For your convenience (and our sweet tooth), we tested several foil-wrapped eggs (Easter and otherwise) to see which are conductive.

The result? None of them are! But if you unwrap an egg and rewrap it with the non-decorative foil side outward, this tends to work. You could also use aluminium foil or copper tape to create a conductive layer.

Code it

Next, you’ll need to create the code for your hunt. The script below contains the bare bones needed to make the project work — you can embellish it however you wish using GUIs, flashing LEDs, music, etc.

Open Thonny or IDLE on Raspbian and create a new file called Then enter the following code:

We’re using ButtonBoard from the gpiozero library. This allows us to link several buttons together as an object and set an action for when any number of the buttons are pressed. Here, the script waits for all four circuits to be completed before printing the location of the prize in the Python shell.

Your turn

And that’s it! Now you just need to hide your small foil eggs around the house and challenge your kids/friends/neighbours to find them. Then, once every circuit is completed with an egg, the great prize will be revealed.

Give it a go this weekend! And if you do, be sure to let us know on social media.

(Thank you to Lauren Hyams for suggesting we “do something for Easter” and Ben ‘gpiozero’ Nuttall for introducing me to ButtonBoard.)


Ben Nuttall avatar

ButtonBoard is very handy.

You can also alias it…

EggBox = ButtonBoard

eggs = EggBox(3, 4, 18, 24)
Pat Senn avatar

The Jumper leads you are showing are alligator, not crocodile, and yes there is a difference. Plus there is a lot of typos in the text.

Liz Upton avatar

It’s axiomatic that when complaining about typos, you’ll make one. Congratulations on being today’s proof!

I think that what you’re perceiving here, both in terms of favoured amphibian and spelling, is a difference between British and American English.

shannon avatar

What would the difference be between a crocodile clip and an alligator clip? That sounds like an interesting bit to know…

Shannon avatar

Ah ha! Looks like they are one and the same. Wikipedia( which I feel should be acceptable as primary or secondary source material, with proper attribution, to the chagrin of many academics) lists them under the heading of crocodile clips, and says they are different names for the same thing. However, most vendors sell them under the name alligator clips.
SO, OP, you are wrong!
Otherwise, I can’t comment on spelling or grammar. I myself make an attempt, but I am no English Major.

Izzy avatar

Great little activity idea, thank you for sharing. Had never heard of the ButtonBoard, squirreling this away for future use. Thinking this could easily be adapted for the four eggs to reveal the combination to release a padlock on a locked box / shed etc. Handy if you’re limited on hiding spaces for the actual prize!

Comments are closed