Leprechaun Trap!

Introduction: Leprechaun Trap!

March 17th comes around once a year and trapping a leprechaun is always on my families' to do list. We are designing a project that will lure in a sneaky little green gold digger and trap them in their unquenchable lust for gold. We look forward to trading our fake gold coin for the leprechaun’s freedom and real gold pot at the end of the rainbow.

After finishing the Arduino beginners guide, we are going to use the tools from the ARDX Arduino Experimentation Kit purchased from Adafruit.com.

My daughter and I are working on this project together, and we were looking for a way to truly catch those little magical wonders. We designed a small “drop” trap held up with a simple bar brace and drop technique. The brace connects to a DC motor and Arduino by a small string. We will be using the photoresistor as our input and a gold coin as a trigger. When the miniature green suited gold digger attempts to pull the coin off the photo resistor, the DC motor will be activated from the light and BAM, it’s a trap! Lucky for us, we will have successfully captured an unlucky leprechaun.

In review:

-We are building a leprechaun Trap.

-The leprechaun will trigger his (or her, are there female leprechauns?) own trap by their greed.

-The trap will be primarily composed of Arduino Uno, DC motor, photoresistor, fake gold.

-Start dreaming of all the ways you will spend that pot of real gold.

Creativity and family bonding highly encouraged but not required.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials and Supplies


These components are found in the ARDX Arduino Experimenter's Kit

  • Arduino Uno
  • 9V Battery holder
  • Breadboard
  • USB cable
  • 1 - Photo Resistor (input)
  • 1- Green LED (output)
  • 1 - DC Motor (output)
  • 1- 560 Ohm Resistor (Green-Blue-Brown)
  • 1- 10k Ohm Resistor (Brown-Black-Orange)
  • 1-2.2k Ohm Resistor (Red-Red-Red)
  • 1- Diode (1N4001)
  • 1- Transistor (P2N2222AG) (TO92)
  • 12 - Wires

Additional Hardware

  • 9V Battery
  • Box (some container, for example, shoe box, tissue box, food storage container)
  • String
  • Adhesive Tape or Adhesive material
  • Rod (pencil, dowel, stick, or series of magnetic rods)
  • Food Storage container
  • Paper or Cardboard


  • Hot Glue Gun
  • Drill (power drill works best)
  • Drill Bits (various sizes depending your needs)


  • Computer
  • Arduino IDE
  • USB cable (Computer to Arduino, included in the ADRX kit)

Decorative Craft Supplies

  • Gold Coins (fake of course, if you have real ones you may not need this trap)
  • Gold Spray Paint (if you don’t have real gold but need to make someone think you do)
  • Coin or small round disk that can be painted
  • Construction Paper
  • Stickers
  • Glitter
  • Markers/Crayons/Colored Pencils String

Step 2: Setting Up the Photo Resistor

The first step will be to set up our photoresistor according to the ARDX Arduino Experimentation Kit. This experiment is CIRC 09 in the kit, and we will be setting it up identical to the guide.

You will need to be certain that you have the correct resistors for the Ohm value in the right positions to balance the circuit adequately.

Next, we will load the code for the photoresistor to ensure our circuit was properly built and functional. The CIRC-09 code is at this link here.

After you load this into the Arduino IDE, test your light sensor a few times to be confident it is working.

We are now going to modify the code by changing the loop so the photoresistor acts as a light activated switch, like a nightlight. You can find this code on the CIRC-09 page in the ARDX guide or included below.


Rather than controlling the brightness of the LED in response to light, let’s instead turn it on or off based on a threshold value. Change the loop() code with;

void loop(){

int threshold = 300;

if(analogRead(lightPin) > threshold){

digitalWrite(ledPin, HIGH);


digitalWrite(ledPin, LOW);



Step 3: Replace the Output With DC Motor

In the previous step, we set up our photoresistor according to the ARDX Arduino Experimentation Kit . This is CIRC 09 in the kit and we will be set it up identical to the guide.

In this step, we are removing the green LED output from our circuit. We will be replacing it with the DC motor as the output.

We are referring to CIRC-03 in the ARDX Arduino Experimentation Kit . We will be adding the CIRC-03 breadboard layout to our current layout for the photoresistor.

Be certain that you are using the correct resistors in each situation in order to balance the circuit.

At this point, you should be able to run your “Night Light Code” through the photoresistor to use light as the trigger for an on and off switch.

We will modify our code later to match our syntax for a DC motor. This will be done in the software phase of our leprechaun trap.

Step 4: Software and Code

In this step, we will be uploading the code to our Arduino. The code is organized to use the photoresistor as our input and the DC motor as our output. We want the leprechaun to grab the coin and trigger the light threshold set by our programmed code to turn the DC motor “on.” Once running the DC motor will wind up the string attached to our brace and drop the lid of our trap down on the leprechaun.

In this step, you will need the Arduino IDE installed on your computer. You can follow the link here to find and download the software. This is what we will be using to upload our code to our board in order to program our trap.

You will also need the USB cord for your Arduino. Connect this cord to both your Arduino and your computer. This will be your “rainbow” magically sending the code from your computer and the IDE to the Arduino.

This is the code we will be using. You can copy and paste the code below into the IDE. Notice the notes below to help you understand how the program runs. This code is a modification of the CIRC-09 code from the ARDX. We changed the Pin from a lightPin to a motorPin in order to keep our syntax accurate.

/* * A simple program that will sense light and turn on a DC Motor * */

//PhotoResistor Pin

int lightPin = 0; //the analog pin the photoresistor is connected to the photoresistor is not calibrated to any units so (relative light)

//Motor Pin

int motorPin = 9; //the pin is controling the DC motor use one of the PWM (pulse width modulation pins)

void setup()


pinMode(motorPin, OUTPUT); //sets the DC motor pin to output of the circuit



* loop() - this function will start after setup

* finishes and then repeat


void loop(){

int threshold = 300;

if(analogRead(lightPin) > threshold){

digitalWrite(motorPin, HIGH);


digitalWrite(motorPin, LOW);



After entering this code into the IDE be sure to upload it to your Arduino Board. You can do this by clicking the arrow in the green circle in the upper left hand corner of the IDE program.

Step 5: Encasement

I am a little (pun intended) terrified of my Arduino and breadboard getting destroyed by one of these little green menaces especially after this trap tricks them into capture.

In this step, we will be enclosing our board into the plastic food container to conceal the electronics from grubby little hands of destruction.

You are want to find a form-fitting container. In the image above you can see this container is a snug fit which will allow protection for the board.

You will need to drill a hole in the lid of your container to expose the light sensor (photoresistor) as well as drill a hole in the side of your container to expose the DC motor and allow it to spin freely.

Step 6: Decorate the Trap

We now need to disguise this trap. In this phase of the process, you will be using your craft supplies to decorate the trap as you see enticing for a leprechaun. We used green construction paper to cover our box. In this phase, we also added stickers and other decorations to lure in the green guys.

Step 7: Putting It All Together

Once we have our breadboard setup and organized, the Arduino coded, our trap decorated, and our encasement prepped we need to put everything together.

First, we will be putting the Arduino and breadboard into the food container and attach the 9v battery to the battery holder and then plug it into the Arduino. If you are working in a well-lit room your DC motor should start running as soon as you plug the battery and battery holder in. You may want to place a sticker, post-it note or tape on the sensor while you are assembling everything. Your container should allow for space to tuck your power source into the container. This keeps everything protected inside of the container.

Next, you will be adjusting the height of your Arduino and breadboard so your photoresistor sticks out of the hole your drilled. In the image above you can see I stacked sheets of paper, (cardboard could also be used). The photoresistor (light sensor) should be flexible enough to “wiggle” around until you get it to poke out of the drilled hole.

Now, we will be strategically placing our coin on top of the hole covering the photoresistor. (If you covered the photocell while you were assembling it remove that sticker now.)

We are now going to carefully set our container with the Arduino, breadboard and coin in place. In our project we set the container inside of our shoe box lid. This allowed our DC motor to hang out the side of the box and be elevated it enough to spin. The DC motor will need enough clearance to wind up the string or cord.

We are now attaching the string to our rod. We choose to use a set of magnetic rods as they would keep the lid of the box up with the structure we are looking for while still separating easily so that the lid can fall.

Step 8: Set the Trap

Finally, we prop our box lid up on top of our rod above our base and wait. We wait for the little green bothers to show up, overcome with greed as the grab as they snatch the coin. Then we as captors joyfully celebrate as the box shakes across the floor.

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Rope & String Speed Challenge

      Rope & String Speed Challenge
    • Wearables Contest

      Wearables Contest

    5 Discussions


    3 years ago

    Fun project, Mr. Steier! Did you catch any leprechauns??


    3 years ago

    It doesn't have to be gold. Tiny little bottles of Irish whiskey also work...

    DIY Hacks and How Tos

    Ha. Fun project. I may have to make one of these with my son.

    DIY Hacks and How Tos

    Ha. Fun project. I may have to make one of these with my son.

    DIY Hacks and How Tos

    Ha. Fun project. I may have to make one of these with my son.