Peck & Click · Blog

All posts

· Tech & builds · 2 minutes to read

The servo prototype: a flap, a display and an emergency feed button

The servo prototype: a flap, a display and an emergency feed button

The first feeder was a starter kit: a small servo opens a flap, a display keeps count, and a button feeds the hens even without Wi-Fi in an emergency.

ESP32 · Servo SG90 · LCD1602 · MQTT · PlatformIO

The first feeder was not an appliance but a test rig: an ESP32 dev board on an expansion board, an SG90 servo, an LED module, a push button and a two-line LCD display. All from an IoT starter kit, none of it meant for outdoors.

How it works

When someone presses the button on the website, the server sends a message to the ESP32 over MQTT. The board opens a flap with the servo for a set time, grain slides out, the LED blinks while it happens, and at the end the device reports "done". Only then does the feeding count as carried out on the site.

The display shows the state in the first line: connected, searching for Wi-Fi, night mode, emergency stop. The second line shows the day's feeding counter, for example "Feed: 12/40". The counter comes from the server, so display and website always show the same number.

The button

The button on the device was meant as a test button and became the most important part of the prototype. Since mid-July it also works when the Wi-Fi is down. Whoever is standing there and wants to feed the hens does not have to know first whether the server is reachable.

What I learned

  • A servo twitches when idle. The pin has to go cleanly LOW after the movement, otherwise the flap rattles away at night. It took a while to find that one.
  • Updates over USB are a nuisance once the device hangs in the hen house. So an update over Wi-Fi came early.
  • Two Wi-Fi networks in the firmware are worth their weight in gold: one at home for testing, one at the site. Unplug, switch on, done.
  • The connection to the server is encrypted with certificate checking, and the device gets its time via NTP. Both sound over the top for a chicken project, but they save a lot of strange errors.

The prototype lasted a long time, longer than planned. It was only replaced in October by a proper feeder with a feed auger. That gets its own post.

By Tobias Kurth, Runs Peck & Click.