Design a timed feeder, which can feed your pet regularly when you are out.
Suitable kits: mCookie202, mCookie302
- USB cable*1
- Sensor cable*3
- Sensor shell
- Lego or other fixation structures
- Assemble the modules and sensors together:
- Connect the servo connector to pin 6/7 of Hub;
- Connect the servo to pin 1 (the below three pins) of servo connector;
- Connect Line Finder to pin A0/A1 of Hub;
- Connect the Joystick to pin A2/A3 of Hub;
- Insert one end of USB cable into the battery base, and connect the other to computer.
Required Program Blocks
Open the cap, wait for putting food into it, press the Joystick, and then close the cap. Start timing, after the time is over, and finding the pet is approaching through the Line Finder, open the cap automatically, so that the pet can access to the food.
Start to Program
1. Open the cap, and put food into it. Wait for the Joystick to be pressed, and then close the cap. Start to time.
Servo rotates to 180 degrees (open the cap and put food into it).
Wait for the Joystick to be pressed.
Servo rotates to 90 degrees (close the cap).
Timer1 starts to work.
2. After the time is over, and Line Finder finds the pet is approaching, it will open the cap automatically.
Wait for timer1 to be larger than 5s.
Wait for the Line Finder to find the pet is approaching.
Servo rotates to 180 degrees (after the time is over, the pet can get the food if approaching).
Test the result
After the program is uploaded, and the servo rotates to 180 degrees, press the Joystick and the servo will rotate to 90 degrees. If the pet approaches to the Line Finder after 5s, the servo will rotate to 180 degrees.
Q: The current feeder can not let the pet know when is a meal served. Can an indicator be designed for it which the pet can understand?
A: Install a red LED to the automatic feeder, the red led on which can get off gradually with the coming of the meal time.
Add feeding indication with a color LED
Variable LIGHT is for recording the brightness of LED.
If timer1 is less than 5s, execute repeatedly.
Map timer1 from 0-5000 to 100-0, and save it into LIGHT.
The red brightness is LIGHT (with the coming of the meal time, the red LED will go off gradually.