Introduction: Cookie Jar Alarm

Cookie Jar's are a problem in American. I don't know who invented them, but they were in no way a security expert. We have a problem in our house that people always sneak into the cookie jar when no one is looking, even after we have said that a "No-Cookie" policy is in place. To counter that problem, I've built a little gizmo that sounds out an alarm anytime sound is caught stealing a cookie.

Step 1: Supplies

If you got the Arduino Grove Starter Kit, you should be in business fairly quickly. Otherwise, you'll need to obtain some of these things on your own:

  • LinkIT ONE Board
  • Grove Arduino Base Shield
  • Grove Sound Buzzer
  • Grove Infrared Reflective Sensor
  • Cookie Jar with Lid

Step 2: Connecting Your Sensors

The LinkIT ONE has the same pin layout as the arduino, thus an arduino grove board extension fits on top of it in a very similar fashion. Simply line up all the pins and plug it in.

Next you're going to want to attach the buzzer to any of the digital pins (any pin that starts with D. I attached mine to D3) and the infrared red sensor can also be attached to any digital pin (I attached mine to D2).

Step 3: Calibrating the Sensor

You'll need to calibrate your infrared sensor to know how 'deep' to look for your cookies. In order to do that, you'll need to screw the top of it until it properly reacts to the lid being taken off. Take some time here and play around with it until you find an adjustment that works.

For more resources, check out the Grove Infrared Wiki

Step 4: Connect the LinkIT ONE Battery

Because Cookie Jar's aren't always located right next to an Outlet I think we better attach the battery that came with our LinkIT ONE. Simply attach the connector to our battery slot at the front of the LinkIT ONE and remember when we deploy to toggle the switch over to 'BAT' instead of 'USB'.

Step 5: Deploy Code

Our code follows a pretty simple logic structure:

If the distance between the sensor has changed, then we assume that the lid has been taken off the jar and we should sound the alarm!

Download the attached .ino file and deploy it to your LinkIT ONE device.

Step 6: Deploy to Cookie Jar

Next, let's get our cookie jar set up. I drilled a small hole in the top of my cookie jar and threaded the grove sensor connector through it. Now, my infrared sensor sat on the inside of the lid, while my LinkIT ONE and Buzzer sat on the outside.

You'll want to do something similar in your set-up.

Step 7: Going Forward

And that's it! Now you're done! Hopefully all those pesky cookie robbers learn their lesson!