Introduction: Automated Refrigerator Door Closing Device
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
This device is designed to automatically close your refrigerator door when it is accidentally left cracked open. This is done using an Arduino UNO which controls a a linear and rotationallly moving arm which reaches out, grabs the door and pulls it closed.
In order to build this, you will need
2x 28BYJ-48 ULN2003 5V Stepper Motor
2x ULN2003 Stepper Motor Driver Board
Reed Sensor Module Magnetron Module with Normally Open Reed Magnetic Switch
2x VEX EDR Rack Gears
VEX EDR 12 Tooth Gear
VEX EDR 2 inch Shaft
3-D Printed Parts
Step 1: 3D Printed Parts.
Print the attached .STL files in order to assemble the device.
Step 2: Code Writing
In this code, we will use the Stepper.h library included with the Arduino software. This will allow us to easy program the stepper motors to accomplish the project goal.
We begin by assigning the two stepper motors to digital pins 4-7 and 8-11 on the Arduino using the "Stepper" function. We also define the number of steps in a full rotation for the stepper motors as 2048, which is standard for these motors.
In the setup section, we assign digital pin 2 as the sensor pin. this is where we read the switch to see if the door is open or closed (High = open, Low = closed). This is also where we set the speed of the stepper motors.
In the loop section, the Arduino waits until the door is opened and the Sensor Pin is High. It will then wait a user determined amount of time (3-5 minutes is recommended) and if the reed switch still reads high, the door closing procedure will begin. Otherwise, it will wait until the door is opened again.
The door closing procedure is accomplished by rotating the stepper motors using the "step" function built into the Stepper.h library. This will allow us to specify how much each motor should rotate. In order to extend the arm, stepper motor two needs to rotate 2.25 full rotations. Stepper motor 1 will then rotate a quarter of a full rotation to lower the hand. The arm will be partially retracted by stepper motor 2 rotating half a rotation. Stepper motor 1 rotates the hand back into its original position and then the arm is fully retracted back into its original position by motor 2.
After completing the cycle, the Arduino waits until the door is open and the reed switch reads High.
Step 3: Circuit Construction
A: This is the Board Driver for Motor 2. It is connected into Pins 4-7 on the Arduino and is connected to the 5V power rail on the breadboard. The Stepper motor is connected directly to it.
B: This is the Board Driver for Motor 1. It is connected into Pins 8-11 on the Arduino and is connected to the 5V power rail on the breadboard. The Stepper motor is connected directly to it.
C: This is the Breadboard setup. The same setup is shown on a larger breadboard for visual purposes. The breadboard consists on a power rail, a ground rail, and a setup for the magnetic reed switch. The power rail is hooked up to the 5V pin on the Arduino and the power inputs on both motor driver boards and the reed switch. The ground rail is connected to the ground pin on the Arduino and the power output on both the motor driver boards and the reed switch. The digital output of the reed switch is connected to pin 2 on the Arduino.
D: This is the magnetic reed switch. It should be wired to the breadboard as stated above.
E. The Arduino should connected directly to a 9V battery.
Step 4: Assembly
The parts should be assembled and secured as shown in the video.The wires and hardware should be secured in the empty space in the enclosure. The device can then be attached to the side of your fridge via hook and loop tape. A magnet should be attached to the fridge door which would be situated on the top corner of the device when the fridge door is closed. This will allow the Arduino to know when the door is open and closed.