You are on page 1of 26

Design News Gadget Freak Case #164

Page 1

THE GADGET FREAK FILES CASE #164
Pet owners who want to spend a day hiking, at the beach, shopping at the mall, or even
a weekend far from home can build an automatic pet feeder to dispense water and dry
food at a preset time. Tom Thompson, Julie Redmond, Curtis Siebenaller, and Nathan
Woodworth at Colorado State University explain how to combine electronic and
mechanical devices to do just that. Their design would satisfy even Morris, the world's
most finicky cat.
The automatic feeder uses four Microchip Technology PIC microcontrollers (MCUs) to
deliver food once per day via a motor-driven feeder wheel. Water delivery depends on
the amount of water left in the pet's bowl. The feeder uses a menu system and a keypad
that let a pet owner:
Set the current date and time.
Select the amount of food to dispense (in 0.5 cup, or 120 cm3 increments).
Set the time to dispense food.
Calibrate the water sensors.
Adjust the contrast on the LCD displays.
Turn the water or food dispensers on or off individually.
System photos and additional images appear at the end of this document. Download
the PICBASIC sourceJATcode from: www.gfreak.com/GF163/GF163_Feeder.zip.
The feeder uses an integrated real-time clock to determine when to dispenses food
once a day at the time set by the pet owner who also can set the amount dispensed.
The feeder system includes the capability to operate a water valve or pump and to
monitor the water levels in a built-in water dish and reservoir tank. Tom and his team
fabricated capacitive sensors that the water-control MCU uses to determine the water
level around each sensor. Watch the video for this project for a tour of its operations.
NOTE: The as-built project included an optional spring scale that would indicate to the
Feeder MCU that the dry food supply had decreased to a preset point and it needed a
refill. The following description does not discuss the optional scale, although it appears
in several photographs. The schematic diagram shows a normally-open pushbutton
labeled, "Scale Trip Switch" connected to pin 10 on the Feeder MCU. Substitute a wire
jumper for this pushbutton in the circuit.
Note that this Gadget Freak design is not a cut-and-assembly project. It requires some
engineering and ingenuity from the builder. But, builders are free to adapt the design as
they see fit. Some metal-working experience will help, as will hands-on experience with
small motors, gears, and pulley drives. Please read the entire Gadget Freak article
before you start this project.
BUILD INSTRUCTIONS
Dispenser Motor

Design News Gadget Freak Case #163

Page 2

In the original design, Tom's group used the motor and gearing from a Black and
Decker battery-powered drill and controlled it with a pulse-width modulation (PWM)
output from the Feeder PIC16F88 microcontroller shown in the main schematic diagram
(Figure 1.1). Schematic diagrams appear on full pages at the end of this document.
In the final design, the team "geared down" the motor with a set of pulleys (which added
parts) to reduce the output speed yet retain torque. The PWM-drive transistors can
control a motor that draws as much as 3 amps at running speed. (The information in
Figure 1.2 provides additional schematic-diagram details.)
In practice, a builder could locate a more suitable motor with an attached gearbox. The
Anaheim Automation permanent-magnet brushless-DC motor, model number BDPG38-86-12V-3000-R139, can provide a peak torque of 50 in-lb, which should suffice to
prevent dry food from jamming when the wheel is adjusted correctly. (For information,
see: Design and Assembly of the Feeder Wheel, below.) Builders could choose to
include a series of pulleys and belts, or even a chain drive, to reduce motor output
speed. The belt-and-pulley arrangement would let the motor "slip" if someone
inadvertently puts a finger in the inlet to the dispenser wheel. During testing, powering
the motor at the wrong time could cause a painful experience for a person adjusting the
dispensing wheel.
The pulley set connected to the drill motor used a round vacuum-cleaner belt and two
pulleys that were turned on a lathe. The PWM signal that controls the drill motor let the
team use the drill without any "gearing down" to achieve the desired output speed. The
control loop changes the PWM duty cycle based on the wheel speed (see: Encoder
Setup, below). An output speed of 20 rpm or less is best for the wheel. Selecting a
motor geared to operate the feeder wheel at 10 rpm could let you exclude the PWM
circuitry and code and use an on-off relay, instead of the PWM-drive transistors, to turn
the motor on or off. Builders can buy pulleys, drive belts, gears, bearings, bushings, and
other mechanical components from Stock Drive products/Sterling Instruments:
www.sdp-si.com, and from Small Parts: www.smallparts.com.
Select a Valve or Pump
This type of pet feeder can rely on gravity-fed water stored in a tank or on pressurized
water from a home's water system. If you use a gravity-fed tank, a small 5V or 12V
pump would suffice. Simply wire it to the proper voltage from the power supply via the
normally-open relay, shown as Relay Switch in Fig. 1-1. (The schematic diagram shows
the connections for a 120V AC normally-closed water valve.)
As an alternative, you can connect to a pressurized-water supply and use a sprinkler
valve as long as the water connections keep the flow at a steady rate into the water
dish. DripWorks (www.dripworksusa.com) sells a variety of 24V DC valves used in dripirrigation systems. The VBAC34 valve, for example, takes 3/4-inch plastic fittings,
Builders can use plastic tubing on the outlet and pressure-compensating emitters to

com). Or. Water-level sensor plates. Any sealant should also cover about the first 1/2-inch (12 mm) or so of the wire as it leaves the aluminum plate. wrap each plate--with wire attached--with a nontoxic dielectric material to seal the plates from the water. Many home-improvement and buildingsupply stores sell similar valves. attached to a lead wire and separated with a nonconductive spacer. and reducers. 1. 2-inches (5 cm) wide by 10-inches (25 cm) long. 2. You will need four of these plate-wire assemblies. Make two small holes in a plate near a short edge and weave the wire into the holes. The amount of tape used to seal the plates made them much thicker than the original metal. as shown in Figure 2. Next. available . try Starbrite Liquid Electrical Tape (www. or 6 gallons/hour. The lead wire to each plate must make a good electrical contact with the plate. Plasti Dip is nontoxic when fully cured. Figure 2. [Editor's note: Consider using a material such as Plasti Dip in which you can dip each electrode to create a integral molded coating (www. Then fold over the short edge onto the wire once or twice and crimp the connection with pliers.plastidip.starbrite.com). The original plates use several layers of electrical tape.Design News Gadget Freak Case #164 Page 3 reduce the flow to 1/2. Making the Capacitive Sensors Each of the two water-level sensors comprises two thin waterproofed aluminum plates. fittings.

Main Box Assembly For most of the prototype we used 1/2-inch-thick medium-density fiberboard (MDF). use a non-toxic paint to protect the wood from moisture.5 mm) thick plastic spacers between each pair of plates at regular intervals. but keep the unconnected end of the wire lead out of the water. Wood glue provides the best bond. Let the sealed plate sit in the water for several hours. too. dry it and attempt to seal the leak. such as Allied part #839-1097 or 839-1114 would work well. If water has penetrated the sealed electrode. Likewise. create a new electrode.] After the coating material has dried. You could use a removable water container and dish. Place the power supply's. see Figures 3 through 6. As water fills the space between the fixed pair of electrodes. which would make for easier cleaning and construction. you will measure a small voltage across the resistor. Then attach a fixed resistor with a value between 10 kohms and 100 kohms to the wire and apply between 5V and 12V DC to the unconnected end of the resistor. [Editor's note: plastic spacers. A 9V battery will work well. Use a non-toxic paint on all parts of the feeder. You can create the sensor plates in any 2D shape. Water Storage The feeder requires a lined or sealed water dish that will prevent water from soaking into the wooden frame. Sensors with slightly larger capacitance (larger surface area) should work. 10 kohms.] The space between the plates lets water flow freely. a voltmeter may show a small voltage across the resistor even with no current flow. the capacitance across the connections increases. ground wire into the water. Or. The pieces are joined with screws and 1x2 and 2x2 (inch) dimensioned lumber made from furring strips. If you suspect this is the case. After you have completely insulated four plates. . Note: If you use a high resistance resistor. or battery's. The best results will occur with plates of the same surface area and spacing.Design News Gadget Freak Case #163 Page 4 at hardware and building-supply stores. as noted above. Your main box might vary. Also. say. glue six (6) 1/4-inch (6. For CAD drawings of the box assembly. Use a nontoxic water-insoluble glue such as a silicone-based sealant. some copying stores have laminators that could encapsulate the electrodes and their lead wire. depending on how you decide to construct it. If you think a defect exists in a plate's seal. the water reservoir requires a similar lined or sealed container. Again. A reading of 0V indicates a good seal around the electrode. use a lower resistance. place a sealed electrode in a container of tap water. however 1/2-inch plywood might be a better choice if you plan to create a built-in waterstorage section rather than use a removable reservoir and dish.

Design News Gadget Freak Case #164 Figure 3. Figure 4. Page 5 .

Design News Gadget Freak Case #163 Page 6 Figure 5. the food container on the right. . Front view of the feeder without front cover. The water container is on the left.

Figure 8 shows a 3D view of an assembled wheel. During the wheel's operation. increase this dimension. depends on the type of food you intend to use. the dry food should not get cut into pieces as the wheel rotates. The height of the four dividers. or dividers. less the front piece that completes the water bowl and food holder. Note the height difference between the diameter of the wheel and the top of the divider. For large pieces of dry food. the encoder disc and the infrared LEDs and photo-transistors. relative to the sides of the wheel (the height difference shown in Figure 7).Design News Gadget Freak Case #164 Page 7 Figure 6. Figure 7. This front view of the reeder wheel shows the position of the dividers and cross braces. Design and Assembly of the Feeder Wheel The feeder uses a "paddle wheel" with four paddles. as the divider passes the edge of the outer shield near the top. and the food should not cause the wheel to jam. Front view of the feeder. to dispense dry food for a pet as the wheel rotates. .

.3 cm. you cut out four dividers with integral tabs (Figure 10) and use them instead. or 5. Food-dispensing wheel with ramp and outer shields in place. As an easier alternative. Builders can change the dimensions to account for larger or smaller volumes.3 cm) wide and 2-inches (5 cm) deep provides about 1/2-cup (120 cm3) of dry food for each 90-degree turn of the shaft. The nice thing about this type of setup is that you can align and adjust the bearings and prevent their axial movement. as shown in Figure 9.1-inches (5. Tom's team fabricated the wheel shown from 20-gauge aluminum sheet.Design News Gadget Freak Case #163 Page 8 Figure 8.1 inches. Choose an axle and bearings that match. four rectangular pieces for individual dividers. Take care when you press the bearings into the wood (you want them to fit tightly into the housing to hold the wheel in place) so that the wood that makes up the housing is not damaged. Food enters through an opening above the wheel to the upper left. but they must properly adjust the rest of the design to accommodate their new feeder-wheel volume. The wheel requires two circular pieces for the wheel sides. Create a center hub for the wheel to match your shaft diameter and cut it to 2. and 16 narrow rectangular pieces for braces. A wheel with four dividers that measure about 2. in length.

a feeder wheel could use allin-one pieces of aluminum with integral tabs. Roughen the ends of the braces. During assembly. away from the spacers. .Design News Gadget Freak Case #164 Page 9 Figure 9. and the roughen the area around the slots on one side of each wheel side-piece. Instead of using individual dividers and braces. or the tabs. Figure 10. This view shows the use of individual dividers and braces. ensure the roughened side of the wheel side-pieces faces out. Partially assembled feeder wheel.

If you used separate braces and spacers. Tom's team used small wood blocks attached to the large frame on the outside. and the wheel 's center hub. then use nuts and washers. glue the tabs the same way and also use some glue to hold the spacers in place against the inside of the wheel side-pieces.] Making the Wheel Housing/Motor Mounts A wheel/ramp housing is shown in Figures 11 and 12. . place the second wheel side-piece over the tabs or braces and bend them into position. Then machine (or file) a flat section on the center shaft. but builders can extend the space in the housing under the wheel for a motor. A design could leave space under the water tank so the motor could directly drive the feeder wheel. Insert the tabs or braces in the slots in one wheel side-piece and bend them into position. Next. Make the slots in the wheel side-pieces slightly wider than the thickness of the material you use for the dividers to ensure a tight assembly. You must establish solid contact between the sides of the wheel and the wheel spacer and the pieces that are pressing the sides because the assembly must transmit torque to the wheel from the axle. but that still leaves the wheel flexible enough so you can aligned it after assembly. If you use separate dividers. This housing doesn't include space for a motor mount. if you matched the axle and bearings. let the glue set. and earlier in Figure 8. [Editor's note: You drill the hollow feeder-wheel hub or spindle and tap it for set screws. slide the wheel on the shaft and tighten the set screws. slide them into place between pairs of dividers. Small braces (Fig. Then.Design News Gadget Freak Case #163 Page 10 Whether you use the tabbed spacers or individual braces and spacers. A drop of Loctite on the set-screw threads will hold the tightened screws in place. clamp down the wheel and use threaded alignment spacers for the bearings or. 8) hold the ramp/outer shields in place. assembly proceeds in basically the same way. Use an epoxy or other high-strength glue to bond the bent tabs on the outside of the wheel side-pieces to the side-pieces. and glue from a hot-glue gun stabilized and sealed the ramp edges where they met the side of the housing. Now that the parts are assembled and glued. the spacers. depending on whether or not they use a pulley or chain drive for the feeder wheel.

. Feeder wheel and encoder assembly. Food enters the wheel through the top opening in the shield and goes down the incline into the feeder dish.Design News Gadget Freak Case #164 Page 11 Figure 11.

front view. The ramp in the foreground delivers dry food to the feed container on the front of the feeder system.Design News Gadget Freak Case #163 Page 12 Figure 12. The inner ring has only four . Feeder wheel assembly. The encoder comprises a thin disc of opaque material with two concentric rings of small holes that align individually with an infrared photo-transistor on one side of the wheel and an IR-emitting LED on the other. Encoder Setup A disc of plastic or metal creates an optical encoder wheel that the control circuit uses to determine wheel position and speed. As shown in Figure 13. the outer ring has 20 evenly spaced holes (18 degrees apart) that the feeder MCU uses to determine the wheel's speed.

Figure 8 illustrates the placement of the encoder disc on the wheel shaft. The aluminum encoder measures 3-inches (7. The feeder MCU uses the speed data to adjust the PWM duty cycle for the motor and it uses the quarter turn data to measure the food. .1-inches (2. the feeder MCU adds to the PWM output cycles to boost power to the motor and clear the jam.5 mm) in diameter. You can place the holes radially as you choose for your mounting configuration.Design News Gadget Freak Case #164 Page 13 equally spaced holes (90 degrees apart) that let the MCU measuring the number of quarter rotations the wheel has made. The program for the feeder MCU lets it recognize a complete stall that would occur if food bits prevent the wheel from turning. Tom recommends at least a 0. When a stall occurs.4inch (1 cm) space between holes.6 cm) in diameter and the holes measure 0. Figure 13.

you could cut four slots in the outer edge of the encoder wheel and use a slotted optical . This view shows the horizontal water sensor in the water bowl and the inset image on the right shows the sensor in the water-reservoir section.0V when blocked by the wheel. Place the IR photo transistors and LEDs so they align with their respective holes. The IR photo-transistor's output should only exceed 1V when the encoder wheel positions a hole between them. Some spurious IR radiation from the IR LEDs and from ambient conditions could cause the IR photo-transistor's output to exceed the 1V threshold and signal that condition to the MCU. You will need sufficient space between the holes on the encoder wheel so the infrared sensors do not produce an output greater than 1. If you use discrete infrared (IR) sensors and emitters. You should put both IR Sensor LEDs on the same side of the encoder wheel and the IR phototransistors on the opposite side (Fig. If your design does not need the 20 holes in the encoder wheel for speed control.Design News Gadget Freak Case #163 Page 14 Figure 14. pay careful attention to their placement. 8). Keeping the LED/photo-transistor pairs far from each other helps reduce any interference." from the IR radiation produced by one LED from influencing the photo-transistor from the other pair. or "splash. You could use a small-diameter paper tube around each LED and photo-transistor to provide a shield that reduces interfering light.

If the tank sensor indicates a disconnected condition. If that does not solve the problem. This voltage should measure below 0. The calibration of each sensor is very important for the accurate measurement of the water levels. or optical interrupter. such as the H21A (Allied part #263-0581) in place of the discrete IR LED and photo-transistor.75V when you have the opaque encoder wheel between the LED and its corresponding phototransistor. To check the alignment of discrete LED/phototransistor pairs.Design News Gadget Freak Case #164 Page 15 switch. the MCU defaults to the valve-relay-off state. The H21A combines an IR LED coupled with a phototransistor in a single plastic package with about a 3-mm slot between them.1 for the emitters allows about 100mA of current which exceeds the limits of the H21A emitter.4V. the MCU will ignore the tank reading. If the dish sensor gets disconnected. Sensor Setup You must place the two capacitive water-level sensors in the dish and tank so that water can rise and fall freely in the space between the plates in each sensor.8 and 5V when you rotate the encoder wheel to position a hole between the LED and the phototransistor. The voltage should measure between 1. The Feeder MCU should detect a logic one when a phototransistor's output voltage rises above 1. During calibration. a pet owner uses the LCD menu and the keypad. This would require changing the resistances involved with the IR devices to ensure that the current limitations of the IR emitter and detector are not exceeded.15 to 1. If the voltage doesn't rise high enough during the best line-of-sight placement. Leave the two capacitors in place so the MCU will determine that the water tank is always full. Tom placed the reservoir-tank sensor vertically and the dish sensor horizontally (Figure 14).5V when a hole permits IR light to reach the corresponding photo-transistor. Replaced the tank sensor with one 22-pF capacitor to perform the tank-empty calibration and then place a second 22-pF capacitor in parallel with the other 22-pF capacitor to perform the tank-full calibration. Start with dry sensors fixed in their permanent mounting locations. After calibrating the tank- . make sure the emitter and detector are lined up properly and if they are then increase the resistance from the pin on the controller to ground. If a sensor gets disconnected the MCU should produce a sensor "reading" at or near 0. power the circuit and measure the voltage at pins 8 and 9 on the Feeder PIC16F88 MCU.6V when the wheel blocks the IR light path and blocked and a voltage above 2. A good setup produces a voltage at the respective Feeder MCU below 0. If your design will not use a tank or reservoir to store water. you might need to create an encoder wheel with a larger diameter so you can increase the spacing between the holes. lower the resistance between the input pin on the Feeder MCU and ground. If the voltage output by a photo-transistor remains too high when you block the light path with an opaque portion of the encoder wheel. use capacitors as substitutes for the tank sensor and follow the procedure below to calibrate the parameters the MCU uses. The 30-ohm shown in figure 1.

pin 17). If the Master 18F2525 MCU does not maintain 0V on the LCD contrast controller's enable line (18F2525. when the receiving MCU registers this high signal. Troubleshooting the Electronics Good connections are essential! If you suspect problems with a serial signal. it readies its portion of code related to serial comm. one resistor per line. The programs will work without the contrast-controller MCU because no other MCUs depend on signals from the contrast-controller MCU. A false logic high will cause the contrast to change drastically.Design News Gadget Freak Case #163 Page 16 empty condition. driven true. indicating that it is ready to receive data. If you include the contrastcontroller MCU and the displays flicker while using the contract controller following the instructions at the end of the code for the contrast-controller MCU to adjust the period of the PWM signals for the displays. fill the dish and tank to the desired water line and perform the full calibration.1) and the Contrast MCU to ground through 1000-ohm to 10-kohm resistors. The protocols for serial communication between the MCUs in this project use three lines between each MCU. use an oscilloscope to probe the input side of each signal. which establishes the serial comm. Menus on the LCD guide you through the process. and 17. A builder could remove the contrast controller MCU and connect the contrast lines of the LCD to a 10 kohm potentiometer for each LCD to provide contrast that can only be adjusted by gaining access to the pots themselves (this is a standard way to provide contrast adjustment to an LCD display and is shown in the data sheets for the LCD displays).com. Builders can reduce the baud rate to 9600 bits/sec by changing the value 16416 to 16468 in all of the serout2/serin2 commands in all of the programs. and data can be sent in either direction on the same data line. with no parity. Contrast Controller Connect the three signal lines between the Master MCU (18F2525. most often to a lighter-contrast condition that makes the display appear blank and nonfunctional. When this high signal reaches the sending MCU the serial comm. pins 15. One line provides analog signaling (handshaking) from the sending MCU to the receiving MCU to indicate information is ready to be sent. . at a baud rate of 19200 bits/sec. You must make this change in the code for both receivers and transmitters. This arrangement should prevent the contrast MCU from receiving false logic-high signals if the 18F2525 is physically disconnected from these three lines during power-on. the contrast MCU could detect false logic-high signals on this input. 1. PICBASIC PRO is available from microEngineering Labs: microengineeringlabs. To obtain a representation of the serial signal use an oscilloscope probe connected directly to the sending MCU’s data pin. The data rate is specified by PICBASIC PRO with the number 16416. 16. shown in Fig. Then the receiver sends a high signal along a second handshake line to the sender. is sent to the receiving MCU.

Design News Gadget Freak Case #164 Page 17 .

Pet Feeder Bill of Materials Amt 1 1 3 1 Part Description Keypad. 12 key PIC18F2525 MCU PIC16F88 MCU Piezoelectric Buzzer Allied Part # 948-0013 383-1727 383-0496 854-0084 .Design News Gadget Freak Case #163 Page 18 GF #163.

1/4W 10kΩ Resistor. 2W Heatsink for NTE392 Heatsink for TIP120 18-Pin DIP Socket 28-Pin DIP Socket Infrared LED Photo-transistors Page 19 935-8009 568-1140 568-1125 788-1089 355-0020 355-0010 541-0340 862-2142 296-6638 296-4741 296-4743 296-6331 296-6574 895-0540 895-3159 895-0605 431-0632 296-2323 619-0087 296-6966 374-5536 374-5548 387-0014 387-1799 Other Parts 1 Water valve or small pump. 1/4W 3000Ω Resistor. www. 1/4W 3MΩ Resistor. 1/4W 1MΩ Resisto r. 1 Computer Power Supply.1 μF Polyester Capacitor 100-ohm Resistor. 1/4W 1N5059 Diode. 5V to 12V with high torque and less than or equal to 20 rpm. 1 Geared motor. 1/4W 1000Ω Resistor.com .1 μF Ceramic Capacitors 0. 2A 12Ω Resistor. 1/4W 1500Ω Resistor. 1/4W 6000Ω Resistor. 5V DC or 12 VDC. RAIDMAX RX-380K 380W ATX12V. must operate via relay.Design News Gadget Freak Case #164 1 1 3 2 1 1 4 1 13 8 1 2 4 1 1 3 4 3 1 1 3 1 2 2 NTE392 Transistor TIP120 Transistor PN2222A Transistor DPDT Relay 24x2 Character LCD 16x2 Character LCD 0.newegg.

Design News Gadget Freak Case #163 Fig A. The MCU circuit board. Page 20 .

A sensor pushbutton indicates when the springs can lift the platform. The bottom view shows the optional scale platform removed from its mount and placed on its side. The unpainted wood piece "floats" up and down on springs and fits against the Food Dispenser opening in the green painted area. The front panel provides a keypad for data entry and two displays.Design News Gadget Freak Case #164 Page 21 Art B. .

Page 22 .Design News Gadget Freak Case #163 Fig. The front view of the Pet Feeder. C.

. D.Design News Gadget Freak Case #164 Page 23 Fig. This top view of the open feeder shows the water-storage tank and the food dispenser wheel below the food-scale platform.

as shown here. The power transistors require a heat sink.Design News Gadget Freak Case #163 Fig. Page 24 . E.

Using an all-in-one divider that includes tabs eliminates some of the work involved with discrete dividers and braces. . F. Fig G.Design News Gadget Freak Case #164 Page 25 Fig. This view of the feeder wheel shows the arrangement of dividers and braces.

Design News Gadget Freak Case #163 Page 26 Fig. F. -----END----- .