Sie sind auf Seite 1von 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

Design News Gadget Freak Case #164

Page 3

reduce the flow to 1/2, 1, 2, or 6 gallons/hour. Many home-improvement and buildingsupply stores sell similar valves, fittings, and reducers.
Making the Capacitive Sensors
Each of the two water-level sensors comprises two thin waterproofed aluminum plates,
2-inches (5 cm) wide by 10-inches (25 cm) long, attached to a lead wire and separated
with a nonconductive spacer, as shown in Figure 2. The lead wire to each plate must
make a good electrical contact with the plate. Make two small holes in a plate near a
short edge and weave the wire into the holes. Then fold over the short edge onto the
wire once or twice and crimp the connection with pliers. You will need four of these
plate-wire assemblies.

Figure 2. Water-level sensor plates.


Next, wrap each plate--with wire attached--with a nontoxic dielectric material to seal the
plates from the water. The original plates use several layers of electrical tape. The
amount of tape used to seal the plates made them much thicker than the original metal.
Any sealant should also cover about the first 1/2-inch (12 mm) or so of the wire as it
leaves the aluminum plate.
[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.plastidip.com). Plasti Dip is nontoxic
when fully cured. Or, try Starbrite Liquid Electrical Tape (www.starbrite.com), available

Design News Gadget Freak Case #163

Page 4

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

Design News Gadget Freak Case #164

Figure 3.

Figure 4.

Page 5

Design News Gadget Freak Case #163

Page 6

Figure 5. Front view of the feeder without front cover. The water container is on the left,
the food container on the right.

Design News Gadget Freak Case #164

Page 7

Figure 6. Front view of the feeder, less the front piece that completes the water bowl
and food holder.
Design and Assembly of the Feeder Wheel
The feeder uses a "paddle wheel" with four paddles, or dividers, to dispense dry food for
a pet as the wheel rotates. The height of the four dividers, relative to the sides of the
wheel (the height difference shown in Figure 7), depends on the type of food you
intend to use. For large pieces of dry food, increase this dimension. During the wheel's
operation, the dry food should not get cut into pieces as the wheel rotates, and the food
should not cause the wheel to jam, as the divider passes the edge of the outer shield
near the top. Figure 8 shows a 3D view of an assembled wheel.

Figure 7. This front view of the reeder wheel shows the position of the dividers and
cross braces, the encoder disc and the infrared LEDs and photo-transistors. Note the
height difference between the diameter of the wheel and the top of the divider.

Design News Gadget Freak Case #163

Page 8

Figure 8. Food-dispensing wheel with ramp and outer shields in place. Food enters
through an opening above the wheel to the upper left.

Choose an axle and bearings that match. Create a center hub for the wheel to match
your shaft diameter and cut it to 2.1 inches, or 5.3 cm, in length. 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. The nice
thing about this type of setup is that you can align and adjust the bearings and prevent
their axial movement.
A wheel with four dividers that measure about 2.1-inches (5.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. Builders can change the dimensions to account for larger or smaller volumes, but
they must properly adjust the rest of the design to accommodate their new feeder-wheel
volume.
Tom's team fabricated the wheel shown from 20-gauge aluminum sheet. The wheel
requires two circular pieces for the wheel sides, four rectangular pieces for individual
dividers, and 16 narrow rectangular pieces for braces, as shown in Figure 9. As an
easier alternative, you cut out four dividers with integral tabs (Figure 10) and use them
instead.

Design News Gadget Freak Case #164

Page 9

Figure 9. Partially assembled feeder wheel. This view shows the use of individual
dividers and braces.

Figure 10. Instead of using individual dividers and braces, a feeder wheel could use allin-one pieces of aluminum with integral tabs.
Roughen the ends of the braces, or the tabs, and the roughen the area around the slots
on one side of each wheel side-piece. During assembly, ensure the roughened side of
the wheel side-pieces faces out, away from the spacers.

Design News Gadget Freak Case #163

Page 10

Whether you use the tabbed spacers or individual braces and spacers, assembly
proceeds in basically the same way. Insert the tabs or braces in the slots in one wheel
side-piece and bend them into position. If you use separate dividers, slide them into
place between pairs of dividers. Next, place the second wheel side-piece over the tabs
or braces and bend them into position. 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, but that still leaves the wheel flexible enough so you can aligned it after
assembly.
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. If you used separate braces and spacers, 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, the spacers, and the wheel 's center hub.
Now that the parts are assembled and glued, let the glue set. Then, clamp down the
wheel and use threaded alignment spacers for the bearings or, if you matched the axle
and bearings, then use nuts and washers. 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.
[Editor's note: You drill the hollow feeder-wheel hub or spindle and tap it for set screws.
Then machine (or file) a flat section on the center shaft, slide the wheel on the shaft and
tighten the set screws. A drop of Loctite on the set-screw threads will hold the tightened
screws in place.]
Making the Wheel Housing/Motor Mounts
A wheel/ramp housing is shown in Figures 11 and 12, and earlier in Figure 8. This
housing doesn't include space for a motor mount, but builders can extend the space in
the housing under the wheel for a motor, depending on whether or not they use a pulley
or chain drive for the feeder wheel. A design could leave space under the water tank so
the motor could directly drive the feeder wheel.
Small braces (Fig. 8) hold the ramp/outer shields in place. Tom's team used small wood
blocks attached to the large frame on the outside, and glue from a hot-glue gun
stabilized and sealed the ramp edges where they met the side of the housing.

Design News Gadget Freak Case #164

Page 11

Figure 11. 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 #163

Page 12

Figure 12. Feeder wheel assembly, front view. The ramp in the foreground delivers dry
food to the feed container on the front of the feeder system.
Encoder Setup
A disc of plastic or metal creates an optical encoder wheel that the control circuit uses
to determine wheel position and speed. 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.
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. The inner ring has only four

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. Figure 8 illustrates the placement of the encoder
disc on the wheel shaft. The aluminum encoder measures 3-inches (7.6 cm) in diameter
and the holes measure 0.1-inches (2.5 mm) in diameter. You can place the holes
radially as you choose for your mounting configuration. Tom recommends at least a 0.4inch (1 cm) space between holes.

Figure 13.
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. The program for the feeder MCU lets it
recognize a complete stall that would occur if food bits prevent the wheel from turning.
When a stall occurs, the feeder MCU adds to the PWM output cycles to boost power to
the motor and clear the jam.

Design News Gadget Freak Case #163

Page 14

Figure 14. 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.
If you use discrete infrared (IR) sensors and emitters, pay careful attention to their
placement. You should put both IR Sensor LEDs on the same side of the encoder wheel
and the IR phototransistors on the opposite side (Fig. 8). Place the IR photo transistors
and LEDs so they align with their respective holes. Keeping the LED/photo-transistor
pairs far from each other helps reduce any interference, or "splash," from the IR
radiation produced by one LED from influencing the photo-transistor from the other pair.
You will need sufficient space between the holes on the encoder wheel so the infrared
sensors do not produce an output greater than 1.0V when blocked by the wheel. 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. The IR photo-transistor's output should only exceed 1V when the encoder wheel
positions a hole between them. You could use a small-diameter paper tube around each
LED and photo-transistor to provide a shield that reduces interfering light.
If your design does not need the 20 holes in the encoder wheel for speed control, you
could cut four slots in the outer edge of the encoder wheel and use a slotted optical

Design News Gadget Freak Case #164

Page 15

switch, or optical interrupter, such as the H21A (Allied part #263-0581) in place of the
discrete IR LED and photo-transistor. The H21A combines an IR LED coupled with a
phototransistor in a single plastic package with about a 3-mm slot between them. 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. The 30-ohm shown
in figure 1.1 for the emitters allows about 100mA of current which exceeds the limits of
the H21A emitter.
To check the alignment of discrete LED/phototransistor pairs, power the circuit and
measure the voltage at pins 8 and 9 on the Feeder PIC16F88 MCU. This voltage should
measure below 0.75V when you have the opaque encoder wheel between the LED and
its corresponding phototransistor. The voltage should measure between 1.8 and 5V
when you rotate the encoder wheel to position a hole between the LED and the
phototransistor. The Feeder MCU should detect a logic one when a phototransistor's
output voltage rises above 1.15 to 1.4V.
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, you might need to create an encoder
wheel with a larger diameter so you can increase the spacing between the holes. If that
does not solve the problem, lower the resistance between the input pin on the Feeder
MCU and ground. If the voltage doesn't rise high enough during the best line-of-sight
placement, 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. A good setup produces
a voltage at the respective Feeder MCU below 0.6V when the wheel blocks the IR light
path and blocked and a voltage above 2.5V when a hole permits IR light to reach the
corresponding photo-transistor.
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. Tom placed the
reservoir-tank sensor vertically and the dish sensor horizontally (Figure 14).
If a sensor gets disconnected the MCU should produce a sensor "reading" at or near 0.
If the dish sensor gets disconnected, the MCU defaults to the valve-relay-off state. If the
tank sensor indicates a disconnected condition, the MCU will ignore the tank reading.
If your design will not use a tank or reservoir to store water, use capacitors as
substitutes for the tank sensor and follow the procedure below to calibrate the
parameters the MCU uses. 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. Leave the two
capacitors in place so the MCU will determine that the water tank is always full.
The calibration of each sensor is very important for the accurate measurement of the
water levels. During calibration, a pet owner uses the LCD menu and the keypad. Start
with dry sensors fixed in their permanent mounting locations. After calibrating the tank-

Design News Gadget Freak Case #163

Page 16

empty condition, fill the dish and tank to the desired water line and perform the full
calibration. Menus on the LCD guide you through the process.
Contrast Controller
Connect the three signal lines between the Master MCU (18F2525, pins 15, 16, and 17,
shown in Fig. 1.1) and the Contrast MCU to ground through 1000-ohm to 10-kohm
resistors, one resistor per line. 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. If the Master 18F2525 MCU does not maintain 0V on the
LCD contrast controller's enable line (18F2525, pin 17), the contrast MCU could detect
false logic-high signals on this input. A false logic high will cause the contrast to change
drastically, most often to a lighter-contrast condition that makes the display appear
blank and nonfunctional.
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). The programs will work without the contrast-controller MCU because no other
MCUs depend on signals from the contrast-controller MCU. 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.
Troubleshooting the Electronics
Good connections are essential! If you suspect problems with a serial signal, use an
oscilloscope to probe the input side of each signal. The protocols for serial
communication between the MCUs in this project use three lines between each MCU.
One line provides analog signaling (handshaking) from the sending MCU to the
receiving MCU to indicate information is ready to be sent, when the receiving MCU
registers this high signal, it readies its portion of code related to serial comm. Then the
receiver sends a high signal along a second handshake line to the sender, indicating
that it is ready to receive data. When this high signal reaches the sending MCU the
serial comm. is sent to the receiving MCU. To obtain a representation of the serial
signal use an oscilloscope probe connected directly to the sending MCUs data pin. The
data rate is specified by PICBASIC PRO with the number 16416, which establishes the
serial comm. driven true, with no parity, at a baud rate of 19200 bits/sec, and data can
be sent in either direction on the same data line. PICBASIC PRO is available from
microEngineering Labs: microengineeringlabs.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. You must make this
change in the code for both receivers and transmitters.

Design News Gadget Freak Case #164

Page 17

Design News Gadget Freak Case #163

Page 18

GF #163, 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 #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.1 F Ceramic Capacitors
0.1 F Polyester Capacitor
100-ohm Resistor, 1/4W
1000 Resistor, 1/4W
10k Resistor, 1/4W
1M Resisto r, 1/4W
3M Resistor, 1/4W
1500 Resistor, 1/4W
3000 Resistor, 1/4W
6000 Resistor, 1/4W
1N5059 Diode, 2A
12 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, 5V DC or 12 VDC, must


operate via relay.

Geared motor, 5V to 12V with high torque and less


than or equal to 20 rpm.

Computer Power Supply, RAIDMAX RX-380K 380W


ATX12V. www.newegg.com

Design News Gadget Freak Case #163

Fig A. The MCU circuit board.

Page 20

Design News Gadget Freak Case #164

Page 21

Art B. The front panel provides a keypad for data entry and two displays. 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. A sensor pushbutton indicates when the
springs can lift the platform.

Design News Gadget Freak Case #163

Fig. C. The front view of the Pet Feeder.

Page 22

Design News Gadget Freak Case #164

Page 23

Fig. D. This top view of the open feeder shows the water-storage tank and the food
dispenser wheel below the food-scale platform.

Design News Gadget Freak Case #163

Fig. E. The power transistors require a heat sink, as shown here.

Page 24

Design News Gadget Freak Case #164

Page 25

Fig. F. This view of the feeder wheel shows the arrangement of dividers and braces.
Using an all-in-one divider that includes tabs eliminates some of the work involved with
discrete dividers and braces.

Fig G.

Design News Gadget Freak Case #163

Page 26

Fig. F.
-----END-----

Das könnte Ihnen auch gefallen