Hamster Door

The idea for this project stemmed from one of our group members having a pet hamster. You may not always be home all the time and you might not be there to feed your hamster. Having a hamster door set up can allow you to pre-load your food and not worry about having to feed it during feeding time! By adding a delay to the start of your code, you can time it to only open when it's feeding time. Afterwards, the hamster door will detect whenever the hamster gets close enough and it'll open up with its meal.
Supplies

12in x 12in cardboard pieces (5x)
Arduino UNO (1x)
Breadboard (1x)
Male wires (5x)
Female wires (4x)
Ultrasonic distance sensor (1x)
Servo (1x)
Battery pack/4 AA batteries (1x)
Hot glue
Duct Tape
Circuit Construction


Supplies Needed:
- Female (4x) and male (5x) wires
- Arduino Uno
- Breadboard
The circuit is a relatively simple build. Using the schematic shown, the female wires directly attach to the distance sensor and to the pins shown. Use 2 male wires to have a 5v line and ground line on the breadboard. The last 3 wires should go to the servo and wired to their respective pins. After creating the circuit, mount the breadboard and Arduino to the side of a wall and manage wires by taping to the side as needed.
Door Construction
.png)
Supplies Needed:
- Cardboard sheets
- Hot glue
- Battery pack
- Servo
- Ultrasonic distance sensor
- Duct Tape
Begin by gathering your materials.
Downloads

With one of the cardboard sheets, cut out a 5in x 8 in hole. Hold on to cutout piece. Attach the servo with hot glue about 4 inches above what will be the bottom of your door.

Hot glue cutout piece onto the servo. Leave a little gap for your door to be able to open.

Mount the door sheet and another cardboard sheet onto a base cardboard sheet using hot glue. You should end up using the door you created, and two more cardboard sheets.

Carefully poke holes using the ultrasonic distance sensor 4 inches above the door. You will have to adjust the angle as needed later.

Mount the circuit board onto the wall. Use duct tape or hot glue to do so. Attach wires to pins as shown.

Mount the last 2 cardboard pieces to close off the door. Use hot glue to seal off all the pieces.

Adjust the sensor as needed and test for detection range. Once the ideal angle is found, duct tape the sensor in place. (Optional): Wrap box in duct tape and add a roof to cover wires.
Code and Flowchart

The idea of the code is simple: open and close a door after detecting a hamster. Open upon initial detection, and close upon a secondary detection. Since there's only one sensor, the code must account for the fact that the door needs to stay open while the hamster is inside the room. By writing a double detection sequence, it ensures the hamster will not get trapped inside of the room.