The servo prototype did its job, but a small plastic flap is no good for continuous use in the run. What was needed was a feeder that reliably delivers a portion, even with damp, dust and a hundred feedings a day.
The hardware
The new feeder is based on a device by Weimer Engineering: a hopper, below it a feed auger driven by a stepper motor with 2 amps per phase on a microstep driver. The whole thing is controlled by an ESP32, the same chip everything started with. A thank-you to Thomas Weimer, who helped with the feeder and with the 3D printing.
A feeding is a small choreography: the auger first turns a tenth of a revolution backwards so nothing jams, then exactly half a revolution forwards, at ten revolutions per minute. That gives a portion the six hens have pecked away in a good minute. The values can be adjusted later in the admin area of the website.
Own firmware
The device's original software opens its own Wi-Fi network that you have to log into. For a device in the hen house that is controlled by a server on the internet, that is no good. So I rewrote the firmware, with the same motor control, but:
- The ESP32 joins the home Wi-Fi. It only opens its own network as a fallback, when no known network is there for 20 seconds.
- The connection to the website runs encrypted over MQTT like with the prototype, outbound, without an open port.
- Updates come over Wi-Fi. That was necessary because the device's USB port disappeared from the computer for days and came back on its own.
- A rescue function in case the auger ever jams.
Stumbling blocks
- The DIP switches on the driver were set to 8 microsteps, the old firmware assumed 16. The motor would have turned twice as far and twice as fast as set. Whoever changes the switches has to adjust the firmware with them.
- The board's Wi-Fi is weak. On some days it barely reaches two metres to the router, on others no problem. So a dedicated access point hangs right next to it in the hen house.
- A feeding takes about six seconds. The server initially only waited eight and occasionally reported errors although the grain had long since fallen. Now it waits 20.
- The old prototype must not be online at the same time. Both listen to the same messages, and then both feed.
The feeder is not the final version yet. I am fine-tuning portion, speed and the backward run, and soon the final feeder arrives, built from everything learned here.