WiFi / Cellular Chicken Feeder

I’ve wanted to get chickens for a while now (I actually had over 50 of them many years ago), but there’s always been one thing stopping us from pulling the trigger: Feeding them while we’re out of town. This certainly isn’t a very difficult problem to solve, it just takes a little time to plan it out and gather the parts to make a feeder that can be controlled remotely. I didn’t want to set up an automatic feeder, then depend on it while we’re away for two weeks only to find out that our flock died of starvation while we were on vacation. To solve this, I designed this WiFi (or Cellular) chicken feeder.

Backyard farming has become increasingly popular over the past few years, so I thought I would document this project and share it with anyone interested in re-creating one of these for their own backyard.

The feeder, like just about anything else I design, consists of two parts, hardware and software. Let’s start with the hardware, and go from there.

The Hardware

Selecting the proper container and dispensing mechanism was probably the most important part of this design process. The feeder will be used to dispense ‘Layer Crumbles’, a food that’s a crumb-like consistency, similar to dried crushed oatmeal.

The hopper I used for this project is just a 10 gallon feed container which I picked up at a local farm supply store.

To dispense the feed from the hopper, I wanted a shaftless screw conveyor (sounds fancy!). A quick google search and you will see how expensive this equipment typically is (yikes!). So, I went looking for a household appliance that used the same part that I was looking for, as it would likely be much cheaper to buy a replacement part for a common appliance, than a piece of industrial equipment. While in Costco one day, I noticed that the Traeger smokers use exactly what I needed to move wood pellets into a meat smoker. A quick search and I found a nice long shaftless screw conveyor for only $35!

In order for the screw conveyor to work properly, it needs to be protected from jamming against the feed container, to do this I inserted it into a XXX inch stainless steel pipe, and cut away part of the pipe to allow the feed to enter the conveyor (see video). I chose to use stainless steel because it won’t wear down over time, unlike PVC or ABS which may wear down and result in plastic shavings in your chicken food. If you choose a different shaft conveyor, make sure to choose the correct diameter stainless steel pipe to go with it.

To control the shaft, I used a gear motor from Automation Direct. Now, this is a very powerful motor to use for this project, but I already had it in my lab so I went with it. I’m sure you could use a much weaker (and less expensive) motor to achieve the same result. The motor has a 5/16″ shaft, and the internal diameter of the connecting shaft of the screw conveyor was a little larger than 5/16″ but with set screws it worked. There was a single hole already drilled through the shaft of the screw, so I tapped it with a 5MM tap and added a set screw. I ended up tapping a second hole and adding a second set screw for safety because the first one was a little loose.

Once I gathered all the parts, I assembled the dispenser by drilling two holes in either side of the container and inserting the stainless steel pipe through both holes. I mounted the motor on one end of the container using #10/32 screws per the spec sheet, then I sealed around the pipe with silicone to keep the feed from falling out around the edges.

To control the motor, and get it connected to WiFi, I used a Particle Photon (as you will start to notice this is pretty much my favorite way to get anything connected to the internet). If you’re not familiar, the photon is an arduino that you program over the air, and you can literally be up and running in less than 5 minutes with a project like this. No drivers to install, just connect it to WiFi and flash your code. Even if it’s on the other side of the globe.

The photon doesn’t have any built-in relays, so I used the 2 Relay board from NCD.io with the particle socket, which works with either the photon or the electron (for cellular). This board uses I2C to communicate with the relays (which I’ll get into a little later on). The board also has some power circuitry for taking our 12V input down to the levels we need for the photon and relays. So all the hard work is done for us and all we have to deal with is the software.

While the feeder is intended to be controlled via WiFi, I wanted to also add the ability to control it with a remote control while I’m on the property, so in the event that I don’t have my phone, or I leave someone else in charge, they have a way to control it. To do this I used the NCD.io 8 Button Remote Control Fob (They call it a Key Fob – but I think it’s a little bog for that) and the overlay shield also from NCD.io. The remote has an incredible range (750ft LOS), and the overlay shield is pretty cool because it just plugs into the relay board overtop of the photon.

The remote control and overlay shield are totally optional, and aren’t required for the WiFi functionality to work.

To keep the electronics safe from the elements, I opted for a WH-10 from Polycase, these are IP66 rated enclosures so they can hold up to just about anything shy of submersion. I drilled 2 holes in the bottom of the enclosure for power and motor wiring, and one in the top for the remote control receiver antenna (this is not the WiFi antenna, so this hole is not necessary if you don’t plan on adding the RF remote control).

The relay board is mounted to the plastic mounting panel of the Polycase enclosure using some brass standoffs.

Parts List:

Dispenser:

  • 12V DC Gear Motor
  • 10 Gallon Feed Container
  • Shaftless Screw Conveyor (Traeger Wood Pellet Smoker Grill Replacement Auger Assembly 075 Kit KIT0023)
  • Stainless Steel Pipe
  • Silicone Caulk
  • Screws
  • Shaft Set Screws
  • Small Metal ‘L’ Bracket

Control:

  • Polycase Enclosure (WH-10) and plastic mounting plate (WH-10K-01)
  • Cable Glands
  • NCD.io 2 Relay Board (optional)
  • NCD.io 8 Button Fob (optional)
  • NCD.io Receiver
  • Particle Photon (or Electron for cellular)
  • Sparkfun External WiFi Antenna (optional)
  • Standoffs
  • 12V Power Supply
  • Misc. 18 AWG Wire

Solar Power (optional)

  • 20W Solar Panel
  • Solar Charge Controller
  • Battery
  • Misc 18 AWG Wire

Software

The software for this project is (mostly) loaded into the Particle Photon. Depending on which route you decide to go, there may also be some work to do on your mobile device (and I do recommend going that route, as I will explain).

Servings

The software is designed to dispense ‘Servings’ of chicken food. The serving size for the food I’m using is 1/4 pound per chicken, which takes 20 seconds to dispense. This will vary depending on your feed as well which screw conveyor and motor you use, so you will need to adjust this time measurement accordingly for your configuration.

I2C Relay control

There are a lot of ways to control relays, one of the more common ways is to simply wire a relay to an output of your arduino. The NCD.io board doesn’t work this way, instead it uses the I2C protocol to allow for expansion. This makes it possible to use the same 2 pins of the arduino to control many, many relays as they are addressable. Because of this, you will need to import the NCD2Relay library into your project in the Particle Web IDE.

Let’s get to it.

I mentioned that the Particle Photon is an arduino that you can update over the air (OTA). But there’s actually a lot more to it than OTA firmware updates. The Photon can connect to the Particle Cloud, it can host web pages, it can talk to your server, or even connect with third party cloud services.

For this project there are really 3 viable methods for controlling this feeder, 2 of which I will discuss along with sample code:

  1. You an host a web page on the photon, and connect directly to it using your mobile device or desktop. But this method would require port forwarding on your router.
  2. You could connect the photon to a third party cloud (Such as Blynk) and use the Blynk app on your mobile device (more secure and easier for most people than option 1).
  3. You could have the Photon communicate with a server on the internet and host a web page on that server which you access from your mobile device or desktop.

For this tutorial, I will cover options 1 and 2, and perhaps down the road we can discuss option 3 since I have several (hundred) photons currently configured this way, but if you’re only building one feeder, that’s a lot of work for a single endpoint.

Option 1: Hosting the web page on the photon itself

Note: If you want to skip straight to a practical more secure solution, go to Option 2 below. Option 1 works, but I wouldn’t recommend using it outside of your local network for testing.

This option is hands down the easiest for you to ‘cut and paste‘ and be up and running in under 5 minutes. You can literally copy my code below, modify the IP address info, wire up the motor and have a functional feeder.

Pros: This is fast to deploy, can look like a stand-alone app on your mobile device and is completely customize-able.

Cons: You would need to forward a port in your router, which for some routers may simply not work depending on how the requests are sent, which introduces security risks and is a major risk for DDoS attacks (they’re real and they are debilitating – and I can guarantee you will have them). Nonetheless, I wanted to share this method because there’s something to learn here.

If you want to try this out, simply get your photon connected to the cloud by following the setup instructions from Particle and copy the code below into a new project.

Note: Don’t forget to manually import the NCD2Relay library in the Web IDE – and you will most likely end up with that first line twice when you do so, so delete one of them if that happens.

I commented the code quite a bit, so it should be pretty self explanatory. You will need to modify the IP, net mask, gateway and DNS to match your network. Once you do that, simply point your browser to the IP address you chose and you will be presented with a webpage that lets you control the feeder!

Option 2.

This option uses the Blynk app. If you’ve never used the Blynk app, you will always use the Blynk app after today. Because, well, wow.

Blynk is basically a drag and drop app builder right on your phone. With it, you will be able to create an app laid out exactly how you want it, then connect it to your photon using your auth token. It’s that simple!

To get started with Blynk, download the app on your phone. Copy the code below into the Particle Web IDE.

The fastest way to get set up is to clone the app I’ve already created by opening the Blynk App and scanning the QR code below:

This will automatically generate an auth token, which should be e-mailed to you. Copy that token and replace the ‘XXXXXXXXXXXXXX’ in the above code and flash it to your Photon.

You’re ALL SET!

Press the number of servings you want, and you will feed some chickens!

Manually Designing the Blynk App

If you want to manually lay out the Blynk app for this project, you can do that also, simply add 8 buttons and a terminal and link them up to the following:

Button 1: V1
Button 2: V2
Button 3: V3
Button 4: V4
Button 5: V5
Button 6: V6
Button 7: V7
Button 8: V8
Terminal: V0

Going Cellular

To make this a cellular project, simply replace the photon with an electron! It’s really that easy (well, you’ll also have to replace the antenna too).

The Particle Photon and Electron are interchangeable on the relay board, so you can swap them and flash the code into the electron to make this feeder work where there’s no WiFi!

Leave a Reply

Your email address will not be published. Required fields are marked *