Introduction / Why this project
In 2016 I build my first fish feeder, see Fish Feeder 1. The feeder worked fine for more then half a year. After that period the servos were worn out, causing the program to halt, without sending an error-mail. Oops.
I didn’t had the time to correct this fault, because the aquarium was replaced by a slighter bigger version (Juwel Rio 125). Although the Fish Feeder 1 could be reused I choose to build another / different Fish Feeder.
Design goals Fish Feeder 2:
- No buttons on the Fish Feeder.
- Connection to the Raspberry Pi. The Raspberry Pi controls the E-mail, time-tables, feeding results and a display.
- The Fish Feeder should flush fit the existing feeding slot in the Juwel aquarium cover.
- The Fish Feeder should be watertight.
- The storage container with fish food for at least a month should be easily accessible.
- The Fish Feeder should drop small amounts of granulate fish food into the water.
- The amount of food should be adjustable and must be measured.
- No servos.
- This fish feeder is only suitable for granulate fish food, flakes will cause the knife valves to malfunction.
- Some parts need to be accurate and precise. I also had to throw away parts out of spec. Breathe in – Breathe out – And start over.
The build started at the beginning of 2017. It took quite a long time to test the key-components before I was satisfied with the results. Please read the following key-components / instructables which are incorporated in this instructable:
- Optical isolated single wire communication
- Transparant epoxy box casing
- Linear actuator stepper motor
- IR Photogate
- Arduino nano
- Stepper motor diver
- Stepper motor
- Earphone socket and plug
- 1, 1.5, 2mm plywood
Step 1: Woodwork
This machine is mainly build out of wooden parts. When prototyping I like to use wood, parts can be swapped out, dimensions can be changed, tolerances of 0.1mm are possible, holes can be added or filled. Attached is the model, you can make it out of wood or you can print it.
To test geometry of the wooden parts balsa wood is used. This material is too soft to be used in the Fish Feeder. Materials used:
- Birch plywood 500x250x1.0mm
- Birch plywood 500x250x1.5mm
- Birch plywood 500x250x2.0mm
- Birch plywood 500x250x3.0mm
- 18mm plywood
- 12x18mm mahogany
Step 2: Woodwork Casing
See model (01 Casing)
The casing houses the machinery of the Fish Feeder. It protects the machinery and electric parts to the moisture from the aquarium. The epoxy casing part fits into the standard Juwel aquarium feeding hole for the Juwel Easy Feed. The top of the Fish Feeder sits on top of the aquarium cover.
The choice for making the casing out of epoxy is because of:
- Epoxy is water-resistant.
- The internals can be visually inspected.
- The Fish Feeder cannot be seen when standing in front of the aquarium, only when lifting the covers.
To make the top of the casing less visible, I painted it black.
- Glue 4x L-profiles for the the transparent epoxy casing.
- The bottom part of the casing is the epoxy box casing (Transparant epoxy box casing).
- The bottom hole should be drilled after making the casing.
- The electric connector hole should be drilled after making the casing. (Not drawn, pending).
- Excess material of the epoxy casing must be removed and grinded to the desired height.
- Sand top of bottom casing. Between top and bottom a small gap is needed. Little pressure is needed to fit the parts.
- The top should be painted before epoxy glued to casing.
- Verify thickness of 2x2 and 10x2 with machine.
Step 3: Woodwork Cover & Hatch
See model (02 Cover & 04 Hatch)
The cover slides into the casing top. The cover has a square hole. When slid into the casing top the machinery is covered, the silo is accessable. The hatch slides into the cover. When adding feed to the silo, only the small part has to be remove. To add grip to the cover, a hole is drilled in the top plate.
- Saw the parts to the desired dimensions.
- Glue the 2 assemblies.
- Fit the assemblies with the casing.
- Paint the assemblies.
Step 4: Woodwork Internals
See model (03 Internal)
The internal woodwork houses the silo for feed, linear actuator, knife valves, EL-board, switches and IR photogate. Ensure parts are accurate and right angled glued, unless otherwise specified. When finished and all parts mounted, this slides into the casing.
- Drill the parts with the bearing holes stacked to get a perfect alignment of holes.
- After applying epoxy the bearing holes are smaller. Drill holes again. Use some light pressure to press the bearings into position pressure.
- Manufacture the other wooden parts.
- Glue assembly led frame. Paint with epoxy. When inside the machine some areas are difficult to paint.
- After applying epoxy the holes are smaller. Check if the IR led and IR photodiode fit into the holes. If necessary drill the holes again.
- Paint internals and frame led as separate assemblies.
- Check dimensions with knife valves to ensure tight fit.
- 3.5mm is glued 2mm and 1.5mm sheet.
Step 5: Knifevalve
See model (05 Knifevalve)
Several options to submit food were considered, see first table:
- Rotating container with hatch valve. It is not easy to make this smaller.
- Screw (drill). The feeder is inside the aquarium, just above the water level. The food in the screw will be exposed to moisture. The food will stick to the screw, clogging the output.
- Knife valves (sliding)
How does the knife valve system work?
- Step 0: Normal position of valves. This is the normal position of the valves when the machine is inactive. The food container valve is closed. The aquarium valve is closed.
- Step 1: The food valve is moving to get a batch of food. Note that the food valve hole diameter is smaller. This is to be sure that the aquarium valve is capable to move the entire batch.
- Step 2: The food valve is loaded and is moving to the photogate.
- Step 3: The food is dropped through the photogate and is in the aquarium valve. The aquarium valve is moving to the outlet.
- Step 4: The food is dropped through the outlet into the water of the aquarium. The aquarium valve is moving back, closing the machine to moisture.
Step 6: Woodwork Knifevalve
See model (05 Knifevalve)
- Top knife valve has a hole diameter of 8mm, bottom knife valve has a hole diameter of 10mm.
- Check thickness, use a mold to epoxy the valve to the right thickness.
- At the right thickness, use Commandant M5 (scratch remover) to make the sliding faces silky smooth.
- The brass nut is glued in the square 10x10 L=15 block. The diameter is ~7mm. With the thread rod, brass nut and knife valves installed, glue the brass nut to the knife valve. Be careful not spill epoxy on the thread.
- When the brass nut is glued, fill up the gaps between nut and block with more epoxy.
Step 7: Woodwork Motor Clamp & Support
See model (06 Motor Clamp & Support)
The motor clamp and support is used to position the stepper motors. When the stepper motor is clamped the axle is the only rotating part.
The motor support is used in the internal assembly and glued to the internals of the machine. Position the motor support with the stepper motors in position for a perfect fit.
The motor clamp is a loose part that is bolted to the internals of the machine.
To make sure the motor support and motor clamp are a perfect fit, these 2 parts should be made out of 1 piece 18mm plywood. To drill the holes, use a column drill machine. The holes should be perfectly perpendicular.
- Drill the large ø20 holes.
- Drill the smaller holes.
- Saw the outlines of the clamp and support.
- Thin the motor clamp to 10mm.
Step 8: Electronics
See model (99 El-board)
See the schematic: The perfoboard has an connector that provides power to the +5V rail and GND rail. The third pin is the data line. These pins are wired to the brains on the perfoboard: the Arduino nano. Always ensure the correct polarity of the power lines at the pins and Arduino. To avoid a voltage at the Arduino digital pin data out, the pin is protected by a diode. The Arduino reads commands from the data line, controls the valves stepper motors via the drivers, checks the switches and IR photo gate.
- 1x Perfoboard 43x39mm
- 1x Arduino nano
- 2x ULN2003 mini
- 1x Diode (e.g. 1N4148)
- 1x Resistor 1M
- 1x Resistor 10k
- 1x Resistor 680
- 1x 2 pin male header (photodiode)
- 1x 3 pin male header (power, data, ground)
- 2x 5 pin male header
- Electrical wire
Also some tools are needed: tweezers, cutters, vise, soldering iron, wick, stand.
How to solder: https://learn.adafruit.com/adafruit-guide-excelle.... Be aware of the safety risks and use personal protective equipment.
- Saw the perfoboard to the desired dimensions.
- Bend the pins of the stepper drivers and Arduino. Be carefull!
- Cut the (blue) wires of the first stepper motor driver. Put the wires in position, see drawing, connect pin stepper motor 4B to Arduino D12, 3B to D11, 2B to D10, 1B to D9. Press the driver in position, solder the joints stepper driver 4B, 3B, 2B, 1B. Don not solder GND and VCC.
- Add connectors for IR Photodiode at N5 and N6. Wire pin at N5 to Arduino A0. Wire resistor 1M to N5 and J5. Wire pin at N6 to I6 with a red wire.
- Cut the (blue) wires of the second stepper motor driver. Put the wires in position, see drawing, connect pin stepper motor 4B to Arduino D6, 3B to D5, 2B to D4, 1B to D3. Press the driver in position, solder the joints stepper driver 4B, 3B, 2B, 1B. Don not solder GND and VCC.
- Add connectors for switches at J15 to K16. Wire resistor 10K at N14 to N15, M15, L15, K15, wire other conductor to J14. Wire N14 to Arduino D2.
- Add connectors for led at J15 and J16. Wire resistor 680 at H15 to J15 wire other conductor to E15.
- Add connectors for Data - +5V - GND at D5 to 7. Wire diode from Arduino D8 at B5 to D5. Wire Arduino D7 at B6 to D5.
- Add the power rails +5V and GND wires.
- Press and solder the Arduino in position.
- Solder the connection.
- Remove excess material (pins) from the bottom side.
- Apply epoxy to the bare wires.
Testing (see schematic & program & video Fish Feeder 2 test electronics):
- Attach buttons, IR led, IR photodiode to the perfoboard, upload test-program to Arduino.
- Test sensibility of the IR-gate by sliding a piece of paper between led and photodiode.
- Test buttons and drivers by pressing a button.
Step 9: Stepper Motors
See model (98 Linear Actuator, 98 Linear Actuator.step, 98 Linear Actuator.pdf)
See also Linear actuator stepper motor
The stepper motors move the valves. Turning right pulls the valve towards the motor and closes the valve. Turning left pushes the valve to the open position. To ensure optimal functioning valves, axles, bearings, coupling and motors must be perfectly alligned.
One stepper motor controls the silo knife valve. The other stepper motor controls the casing knife valve.
- M5 stainless steel thread
- M5 Nuts
- Earthing connector
- Ball bearings internal diameter Ø5mm MF105 ZZ 5x10x4
- Stepper motor 20BYJ46 axle Ø5mm with flat sides.
- Shrink tube
Mounting the stepper motors
- Press bearings into bearing holes (press fit).
- Position the knife valves.
- Insert thread from “not motor side” in bearing.
- Insert nuts on thread “not motor side”.
- Insert thread into brass nut knife valve.
- Insert nuts on thread “at motor side”.
- Insert thread in bearing “ at motor side”.
- Insert coupling “earthing connector”.
- Insert stepper motor on support into coupling.
- Clamp stepper motor with motor clamp
- Position nuts and turn one clockwise and one anti-clockwise to make position permanent.
- Insert El-board into compartment.
- Remove white plug from stepper motor wire, don’t remove the metal conductors.
- Connect stepper motor to driver. Use shrink tube to avoid shorting.
- Use test program “20171210 Test ULN2003 serialread 2 steppermotors.ino” to check correct alignment stepper motor, axle, bearings and valve. Open a serial line between computer and Arduino. Use keyboard, key “2”, “3”, “5”, “6” to move the valves.
- Add hole for outlet to casing. See drawing woodwork casing and valve.
Step 10: Power & Data Input
See model (97 Power Data Plug Socket, 97 Power Data Plug Socket.step, 97 Power Data Plug Socket.pdf)
This cable provides the power to the electronics and provided a data-line. The epoxy and o-ring should provide a water-resistant connection.
- Classic bicycle (Dunlop) valve (see https://en.wikipedia.org/wiki/Dunlop_valve )
- 2x valve nut
- M8 washer
- O-ring ø7-ø15
- 3.5mm earphone 3-pole plug
- 6.35mm 3-pole plug
- ø6 electrical wire (brown, blue, green/yellow 0.75mm2)
- 3.5mm tubestyle 3-pole socket with nut
- shrink tube
- Remove rubber from valve stem.
- Remove threaded part of the 3.5mm audio plug.
- Slide back side of 3.5mm plug on the electric cable.
- Slide valve stem on the electric wire.
- Cut conductors of electric wire to length, see table “tip, ring and sleeve”.
- Solder conductors to 3.5mm plug.
- Use shrink hose and epoxy to make connections watertight.
- Slide valve stem to 3.5mm plug.
- Solder conductors to 6.35mm plug.
- Solder wires to 3.5mm tube-style socket.
- Add hole for nut in casing.
- Glue nut with epoxy watertight in casing.
- Saw the wooden parts according drawing.
- Glue wooden parts to internal. Use 3mm and 2mm fill-plates.
Step 11: Optical Isolated Single Wire Communication
Because of possible moist problems in the Fish Feeder I wanted the data and power isolated between the outside world and the Fish feeder inside the aquarium.
One side of the optical unit has four wires. This side is connects to the outside world. The four wires connect to the power, ground, a digital pin (data in), another digital pin (data out) of a Arduino or Raspberry PI. This Instructable uses an Arduino and PC as master.
The other side has a separate power supply which connects to the power supply socket. Data and power is transmitted trough the power and data cable which connects to the 6.3mm 3 pole audio socket. The power and data cable connect on the other side to the 3.5mm socket inside the Fish Feeder with El-board and Arduino nano as slave.
- Power supply +5V
- Socket power supply
- Perfoboard 5x7cm
- 2x Resistor 470Ω
- 1x Resistor 680Ω
- 2x Resistor 1kΩ
- 2x Diode (e.g. 1N4148)
- 2x Optocoupler EL817
- Pin header female 2 pin
- Pin header female 3 pin
- Pin header female 4 pin
- Round header female 6 pin
- Round header female 4 pin
- 6.35mm audio 3-pole socket
- Plastic casing
- Solder circuit according instructable.
- See schematic, connect GND External and +5V External to power socket.
- See schematic, connect +5V2, GND2, Data in/out to 6.35mm 3-pole audio socket according tip, ring and sleeve lay-out electric cable.
- See schematic, connect breadboard wires to IN, GND1, OUT and +5V1.
- Drill holes in casing.
- Mount sockets in casing.
- Use tie wrap to fix breadboard wires.
Step 12: Internal Electrics
This step contains some of the small hardware parts. Please note that some parts did not function as expected, so these parts are updated.
- IR led
- IR photodiode
- Electrical wire
- Headphone wire
- 4x SDS004
- 4x Sensor/Switch mounting plate
The headphone socket (3.5mm, 3 conductors) , see step 10, is a typical tubestyle socket with a threaded end for panel mount. When turning the plug into the casing, the plug starts to insert itself into the socket. After a certain amounts of turns the plug should be completely connected to the socket. When testing the socket started to turn with the plug. A good connection was achieved. The downside was that the 3 wires attached to the socket were twisted and snapped of the EL-board. Fortunately nothing was damaged. I decided to make a flat surface to the thread of the socket and a circular segment into the mounting plate of the socket.
Manufacturing headphone socket:
- File a flat surface to 3.5mm tube-style socket. The flat surface should be as square as possible.
- Use a 1 to 1.5mm wooden strip and start to file it to a circular segment shape to fill the gap. Make sure it fits nicely.
- Glue the circular segment to the socket hole mounting plate.
- Finish the mounting plate with epoxy.
- Connect socket and mounting plate to EL-board.
The led is situated in the frame led, see drawings woodwork internals. The led receives power directly from the EL-board. When the EL-board is powered the led has power and emits IR light. The IR led is one of the parts of IR photogate, see also instructable IR Photogate.
Manufacturing IR led:
- Solder led to the wires, long lead to red, short lead to black.
- Add shrink hose.
- Add connectors to the wires.
- Insert led in housing.
- Connect to EL-board.
The switches are used to limit the movement of linear actuator. When a switch is pressed the linear actuator should stop moving.
The fist design had push buttons. The downside is once a push button is pushed (digital pin “HIGH”) the button cannot move further. This gives stress to the button, thread, nut and stepper motor.
After a search I found some cheap and simple switches SDS004 from C&K. You need a small force to push the switch to “ON”, the pin can travel further and is still “ON” see overtravel in datasheet. This switch can be be found at Mouser.com. A support is added to the internals to position the switch that it can touch the notch on the valves, see drawing.
In this setup there are 4 switches. I ordered some more. The switches are very small. At the first try, to solder the headphone wires to the switch, I totally fried the switch. Headphone wire is used because the strands of the wires are insulated. The bare wires without the outside rubber are so thin that it can be routed through the IR photogate holes.
To make a good connection to between switch an headphone wire, you need to prepare the headphone wire. The coloring on the headphone wire is insulation. This can be removed by sanding or by burning. By tinning your soldering iron and pressing your wires between the soldering iron and a wooden surface, the insulation will be be burnt away. Take your time, you are OK when the solder flows up the strands. After the solder applied the tinned wire can be bent to an U-shape. This can be hooked to the pins of switch. Remelt the solder shortly to make a solid connection to the switch.
- Epoxy glue detector supports, see drawing
- Use headphone wire (isolated wire strands).
- Press solder iron on wire and wait until wire insolation starts to melt.
- Apply solder to the wire. The solder flows into the wire.
- Bend the tinned section of the wire to an U-shape.
- Attach the U-shapes to the connectors of the switch.
- Use solder iron to melt the tinned wire to the connectors.
- Check the joints with a multimeter.
- Route the headphone wires through the IR photogate holes.
- Add shrink hose.
- Add connectors to the wires.
- Glue sensor in position (Do not use epoxy, this will flow into the sensor)
- Connect the connectors to the EL-board.
The photodiode is the other part of the IR photogate. It is also situated in the frame led, see drawings woodwork internals. It is positioned in opposite to the IR Led
When food is passing the IR led it will disturb the light beam. This is detected by the IR photodiode, see IR Photogate. The IR photodiode is connected in reverse bias mode.
- Solder led to the wires, short lead to red, long lead to black.
- Add shrink hose.
- Add connectors to the wires.
- Insert photodiode in housing.
- Connect to the EL-Board.
Step 13: Program
When the the manufacturing of the parts is ready, the programs can be uploaded.
- The master.ino is uploaded to the Arduino connected to PC and optical circuit.
- The slave.ino is uploaded to the Arduino nano inside the FisFeeder 2.
When the programs are uploaded:
- Connect power/data cable to the Fish Feeder.
- Connect power/ data cable to optical circuit.
- Connect Arduino to optical circuit.
- Connect Arduino to PC.
- Open the Arduino serial monitor on the PC.
- Connect the power supply to the optcal circuit.
Now the Fish Feeder comes online. Read the communication at the PC serial monitor.
It is important to run the setup and calibrate programs.
- Run the setup to determine backlashes and position of the valves.
- Run the calibrate program, to check the stored values, and adjust when necessary.
When the setup and calibration program are completed, the values are permanently stored in the EEPROM. When the Fish Feeder is re-powered the stored values are read and re-used. Now the Fish Feeder is ready to feed your fish.
The programming is ready to use. You can add a timing routine or other options. Also read the comments in the Slave program.
Conclusion: Most of the design goals are met. The connection with the Raspberry is not ready. For now the system is functional and tested for durability.