Introduction: Cookies Adminitrator Box [Electronics Only]

About: Hello! My name is Martin Buenahora. A 15 year old homeschooler. Lover of free cultures and in my way to become a Maker. My favorite "toys" are the Arduino and the Raspberry Pi
At home the cookies disappear relatively fast. ¿Why? Well, principally because of me and my father. That's why my mother and my sister have to hide some to eat them later. It's embarrassing, I know, but it's because we are like "Oh, I want to eat a cookie", and some time later "I will eat another", and so on, and when we realize, we have eaten more than a half of the cookies. That's why I decide to make this box, to correctly administrate them.

The interface of the box have some pushbuttons, one rgb LED and a LCD screen. Normally, the LED is blue (to show that the box is working) and the LCD display the message "x of y cookies. z have no owner", where x is the actual amount of cookies, y is the original amount of cookies and z is the number of cookies that leftover.  

Every user have one button, so when I press my button, the box check if I have any cookies left, and if I have, opens the door, turn the LED green, and in the LCD shows "You have x cookies left". After a while (5 seconds), it closes the door again. If I haven't any cookie, the LED turn red and the LCD say's "You have no cookies left :(" and the door stay closed.

When the box is empty (maybe it's not empty at all, but there's no cookies left for any of the users), the LED turns red, the LCD show's the message "The box is empty!" and the door opens.

Here's a demo:


Here I leave a zip file with the schematics and the code.

Step 1: Parts and Toools

For this project you will need:

Parts:

4 Pushbuttons (Normally open)
4 10K Ohm resistors (for the buttons, more about this in the next step)
3 330 Ohm resistors (for the LED. Any value bethween 220 Ohm and 1k Ohm must work right)
1 RGB LED (common cathode)
1 10k potentiometer
1 16X2 LCD screen
1 Servo (I used the TowerPro SG92R which I had at hand. The servo you will need depends on your box)
1 Arduino (I used an UNO r3)
1 box

Tools:

A working pc with the Arduino IDE
USB cable to upload the sketch
A power supply between 7 and 12 volts with relatively high amperage*
Protoboard
Jumpers

*Mine supplies 500mA, which seems to be low, because the box don't work. I had to connect it to both, my computer and the power supply

Step 2: Hardware

The conections in the pictures are a mess, so here I leave you the Fritzing "draw" and the schematic. I think the "draw" it's pretty clear, but the schematic seems to be a liitle more complicated, so, just in case, in the conections, just the "doted" lines are joints.

I think the servo and the LED conections are self explanatory, but I'll explain them anyway. The servo is powered with 5V from the Arduino, and is connected to the 13rd pin of the Arduino. The RGB LED have a longer leg. That one is the cathode. At the left of the cathode it's the "red leg" and at the right are the green and blue (In that order). The cathode is conected to negative and the three other legs are conectet to the Arduino with 330 Ohm resistors (the cable colors shows the LED color that turns on/off).

All the buttons have the same connection. One side is connected to 5V, the other to the Arduino and to GND with a 10k resistor. The resistor help to make the signal equal to LOW when the button it's not pressed. The resistors are not necessary, but help to make the LOW signal concrete.

The LCD it's used in 4-bit mode, to save some pins.

Here's the pin explanation of the LCD, from the Arduino LCD Twitter display, I found it very clear and useful:

Pin 1. Ground
Pin 2. VCC (+5V)
Pin 3. Contrast
Pin 4. Register Select (RS)
Pin 5. Read/Write (R/W)
Pin 6. Clock
Pin 7. N/A
Pin 8. N/A
Pin 9. N/A
Pin 10. N/A
Pin 11. Bit 4
Pin 12. Bit 5
Pin 13. Bit 6
Pin 14. Bit 7
Pin 15. Backlight Anode (+)
Pin 16. Backlight Cathode (-)

The potentiometer manages the contrast of the LCD.

Step 3: Software

The software is pretty simple and short. I commented it as good as I could, so I think is no necessary to explain it here.

WARNING: When you're going to upload the code to your Arduino, you may connect the board to the power supply. That's because the servo start working inmediatly and some motors need more amperage than your USB port can supply, maybe causing damage on your Arduino or even to your computer.

Step 4: The Box

I made this project as experimentation, so it's not permanent and my box is made with Lego. If you want to make something permanent, you probably should make or adapt an existing box. Anyway, the goal is to make the servo flip up and down the lid.

Step 5: Hack It!

Well, that's my box. As you can see, is pretty simple, but anyway can be really handy.

The box is made to prevent that someone eat more than he should, and everybody have one button. Here we know that we will not steal others cookies, but, for example, if you live with frends, or another place where maybe someone can steal your cookies, you can add a keypad and passwords. Or if you are a mother and want to know when your childrens eat a cookie, you can add the Ethernet/Wifi shield and make the box send you e-mails/tweets when a cookie is taken.

I invite you to hack this basic box to customize it your wishes and needs. Remember that the limit is your imagination.

Thanks for reading!

If the box had helped you to control some "cookie monsters" at home, don't forget to vote it on the Arduino contest ;D

Arduino Contest

Participated in the
Arduino Contest