Celebrate

 View Only
Expand all | Collapse all

Chicken Tracking with QB

  • 1.  Chicken Tracking with QB

    Posted 09-18-2019 00:24
    Here's my latest cause for Quick Base celebration:

    A while back I made a Quick Base app for tracking my flock of chickens and supply inventory, but just incorporated RFID scanning to help move toward automatically tracking egg production instead of manually tapping URL formula buttons. Very much still a work in progress, but here's what it does so far and how it works:
    Chicken Tracker DashboardThe app keeps records of what chickens are in the flock, egg production, store health records, supply purchasing/use, and a journal to write entries about any or all of the chickens. 

    One night I was browsing my favorite overseas merchant website and came across these leg bands for fowl that contain an RFID chip. They were about $.27 a piece, so I bought a bunch, and a cheap USB RFID reader too. I created a table of all of the RFID tags, and a table for scanner entries, and linked each chicken to an RFID number, so that when one was scanned the entries table would "know" who the chicken was. Then I needed the scanner to be in a stationary place ready to scan anytime, so I wrote a little Python script that sits and waits for a scan, and when it detects one creates a record in the entries table using the Quick Base API. I decided to put the scanner in the nest box to find out who was laying eggs and when. It's also a confined space where I thought I'd have the most luck with the RFID system, which is the low-frequency passive type (chosen because they're cheap and don't require batteries or charging. The trade off, however, is that they only get scanned when they are close enough to receive power from the scanner).

    Egg, Raspberry Pi Zero W, USB RFID scanner.
    After hiding the scanner under some straw on the side of the nest near where the banded leg would be, the Raspberry Pi was put outside of the nest on a nearby shelf. With everything set up, connected to the network and seemingly working, it was time to put the bands on the chickens:
    RFID leg band
    Over the next few days of anxiously awaiting email notifications of scans, I finally got about 40 one morning over the course of about 45 minutes, all from the same chicken. 

    I've had some luck so far, but have been looking into a more powerful scanner that would ensure scans without the RFID chip needing to be so close to the scanner. (Since putting in the scanner I've also found a couple of bushes the chickens have been laying eggs under since they have the run of the yard in summer, but with winter coming they should be laying more inside). I'd also like to add more scanners in various locations, but that may depend on what can be done to find a scanner that could read at a longer distance. 

    I also need to find a better way to display some of this data, especially if its coming from multiple scanners. I'm thinking a summary type table that would group by location and calculate duration to show how long a chicken was in a given spot over the course of a day. A way to detect if an egg is actually laid, and automatically log that in the egg table for the correct chicken is also a future addition once the best way to do that is figured out. Ultimately, it'd be cool to have scanners that could also track various spots to get an idea of how they spend their days, and know when they're all inside for the evening and automatically close the coop door for the night.

    If anyone has any ideas about any of this, or experience working with RFID or Raspberry Pis and Quick Base, I'd love to hear about it!


    ------------------------------
    steve.
    ------------------------------


  • 2.  RE: Chicken Tracking with QB

    Posted 09-18-2019 09:44
    Steve, that is one of the coolest use cases of Quick Base ever! I wonder if some sort of geofencing could be incorporated around the barn that would more easily scan the RFID tags when the chickens enter and exit the barn or if that would be too cost-prohibitive, depending on the number of beacons you would need?

    Thanks for sharing the details and please keep us posted on how you refine and improve your tracking system. So interesting!

    P.S. I love your chicken names.

    ------------------------------
    Ronda Billings Morra
    ------------------------------



  • 3.  RE: Chicken Tracking with QB

    Posted 09-18-2019 23:12
    Hey thanks Ronda... it's been fun to use Quick Base for something a little different. 

    Using geofencing would be really cool. The tags and scanners need to be really close to each other to read, so it could be more a matter of funneling them through various enter/exit points. Using tags that use bluetooth or wifi and geofencingto determine their location would be really fun to do - maybe end up with a map with little dots moving around in real time. They are a bit more expensive though, and I know that Ginger might not be happy with a bulkier tag. She can be a bit dramatic sometimes, but maybe it'd be worth it to get a couple and figure out a good way to see if it could work.

    ------------------------------
    Steve Davidson
    ------------------------------



  • 4.  RE: Chicken Tracking with QB

    Posted 09-19-2019 12:12
    Steve, I BEG you to keep us updated on your progress with this app.


  • 5.  RE: Chicken Tracking with QB

    Posted 09-19-2019 12:21
    Ginger sounds like my kinds gal. :-)

    Interested to hear any new developments as you test stuff out.

    ------------------------------
    Ronda Billings Morra
    ------------------------------



  • 6.  RE: Chicken Tracking with QB

    Posted 09-19-2019 15:03
    Hi Steve,
      years ago I was very heavily involved with RFID and one of the leading RFID vendors that I worked with was Alien Technology.  I used both their readers and tags and was able to read tags from a few feet away from the readers.  We would place 2 antennas at a doorway and be able to read tagged items with no problem at all.  The tags were passive tags so as you mentioned inexpensive and do not require anything but an antenna.  I'm sure their products are even better today than they were years ago so they may be worth taking a look at

    back then I used the "squiggle" tag https://www.alientechnology.com/products/tags/squiggle/
    and here are some readershttps://www.alientechnology.com/products/readers/

    very cool use case for sure

    Keith

    ------------------------------
    Keith Jusas
    ------------------------------



  • 7.  RE: Chicken Tracking with QB

    Posted 09-28-2019 14:24
    Hi Keith, thanks for the tip! I'm definitely going to look into those links. Do you mind if I ask what you used your readers for? Since starting this project, I've had a lot of other ideas for things to track location and inventory of around here that could be useful, especially if I could get a couple-foot range read out of them!

    ------------------------------
    Steve Davidson
    ------------------------------



  • 8.  RE: Chicken Tracking with QB

    Posted 09-24-2019 15:28
    Edited by Maria Peralta 09-24-2019 15:29
    I am working on almost exactly the same kind of set up for my own little urban chicken coop. Can you tell me more about how you chose your readers and who you got your tags from? Also any roadblocks I should keep an eye out for?
    Chickens


    ------------------------------
    Maria Peralta
    Quick Base
    Cambridge MA
    ------------------------------



  • 9.  RE: Chicken Tracking with QB

    Posted 09-24-2019 23:44
    Hi Maria, fine looking flock! They're so cute at that fluffy stage. And I love your watering system-- what a great way to keep little playful chicks from spilling water all over everything and soaking the bedding!

    Here's a few more details about each piece. 

    The most important thing to look for when looking for readers and scanners is to look at the frequency of them, and make sure they match. There's basically low frequency and high frequency. I got the low frequency (125KHz) because they don't need batteries and are a lot cheaper. The drawbacks are that they need to be real close to the scanner to be read, and information-wise, only hold a number, and can't be reprogrammed. Since this was connecting to quick base, that's not a big deal. There is also low-frequency RFID that operates at 134.2KHz, that would allow you to write information to, and some of which are compatible with the chips that are put in pets for identification, and hold more information.  I stuck with the cheap 125KHz ones, because of cost, and all Quick Base needs to know is a unique value to link it to other information.

    Another really important thing is to pay attention to is the size of the band that goes around the chicken's leg. - specifically, the opening, to make sure it's big enough to fit around the chicken's leg comfortably. My chickens are full-size, and breeds that are on the larger side, so the bands with an inner diameter of about 17-19mm (11/16"-3/4") fit pretty well for them. There were a lot for sale that were very small, made I think for racing pigeons or something, so make sure that the inner diameter is not too small. There are plenty of sellers selling these things on AliExpress where I got them, so just verify that the frequency and the size are what you need before buying. Generally, they're sold in lots of varying size. I ended up getting a lot of 100, for about $27. Smaller lots make the price per each a bit more, but I figured having extra ones to play around with couldn't hurt either.

    As for the readers, the one in the picture I posted is very common all over the place, and is about as basic as it gets. It says "Windows" on it, but works with the Linux that is installed on the Raspberry Pi too.  It's USB, which makes connecting it to the Pi easy, and was  just over $5 on AliExpress. The same exact one sells for as much as $20 in many other places, so shop around until you find a good deal. There are larger scanners out there, which are about 9" x 9", but for some reason are about $170. I've seen some YouTube videos of people making their own, but it gets to be an electronics project very quickly, so the simple USB was good to start with and proof-of-concept it.

    The Raspberry Pi Zero W is the brains of the operation. It's about $15 by itself, or there are kits on Amazon with a power cable and case for about $26. Make sure it's a Pi Zero W, the W means built-in WiFi, which is important because it only has 2 micro USB ports that are used up by the power cable and the RFID scanner.  On the Pi Zero is standard Raspian Jesse operating system.  I'm not so good at Linux yet, so I chose Jesse, which has a GUI like windows, which made setup easier.  I wrote a simple Python script that when a number is typed in, it goes to my Quick Base account using the API and adds a record. It doesn't open a browser window when it does it, just loops back and waits for another number to be entered. Since it was running out in the barn with no keyboard or monitor, there was a setup command to do in Linux to make the python script run at startup. If you were to plug a monitor into it while it runs, you'd see a window with a blinking cursor just sitting there, awaiting input. Probably not the most elegant solution, but it works. I also programmed one of the RFID tags to run a shutdown command if it's scanned, to safely turn off the Raspberry Pi if it needs to be moved.

    This is what I did with mine-- it was pretty much put together as cheap as possible to test the concept. Changes or more additions could be useful, but there are some trade-offs, so at this point if I were to do anything different it would be a bigger scanner. But for the cost of them, as well as the extra electronic wiring work involved, I'm still looking at other options. For a start though, this has been a pretty good setup.

    Hope that helps, I'm not sure about the policy here of posting direct links so I didn't link to anything specific, but the RFID bands and reader was from AliExpress and the Pi was from Amazon.


    ------------------------------
    Steve Davidson
    ------------------------------



  • 10.  RE: Chicken Tracking with QB

    Posted 09-27-2019 16:30
    I love this use case! My mom has a little farm with chickens, turkeys, quail, and ducks - the idea of automating coop door closure is exciting! Their coops are setup to have one entryway, so my brain jumps to a reader in the doorway and once all readers have been scanned to shut the door. Is that what you're thinking? Maybe also then a timed door opening for the morning (or a solar meter to open when daylight is at a certain level)?

    ------------------------------
    Chelsea Carpenter
    ------------------------------



  • 11.  RE: Chicken Tracking with QB

    Posted 09-28-2019 14:20
    Hi Chelsea,

    That's pretty much exactly what I was thinking for that, or maybe having two scanners, close to each other in order to sort of determine a direction of travel of the chickens, to ensure that they're actually in and didn't just stop in the door before wandering back out. Another thought I had was to somehow wire up their roost to detect when all the chickens have gone up to sleep, and use that to ensure that they're all in and ready for the door to be closed. In talking with a couple friends, the ideas of weight sensors on the roost, or even object detection with a camera that's already out there could be a  way too. We have a lot of predators around here, so keeping that coop door closed at night is very important!

    The chickens I have currently are usually in before it's too dark, and I think for them I could probably get away with closing and opening it just on a time schedule, but ultimately it'd be nice to know that nobody gets locked outside accidentally. You're right though, for opening the door, it could be just as simple as even programming in the time based on normal sunrise for that time of year.

    Also, your mom has quail, ducks and turkeys too? I'm very jealous! Ducks and turkeys are a lot of fun!

    ------------------------------
    Steve Davidson
    ------------------------------



  • 12.  RE: Chicken Tracking with QB

    Posted 09-29-2019 23:34
    Thanks so much for the info Steve! We're just finishing the coop build right now and I have a Pi sitting on my kitchen table waiting for this project to move into the automated door stage. The waterer was a fun simple build. It definitely keeps the mess in check. Now if only I could find a feeder style that they don't immediately empty onto the ground... Anyway, there are some things ahead of the RFID bands and scanners. It's a work in progress but the info you shared was a good orientation. Thanks for that! I'll keep you posted on our progress and thanks again for the inspiration!  
    Our coop structure is almost complete.


    ------------------------------
    Maria Peralta
    Quick Base
    Cambridge MA
    ------------------------------



  • 13.  RE: Chicken Tracking with QB

    Posted 01-23-2020 11:29
    Steve,

    I have been working with RFID for 25+ years (even before it was cool) and Trinity develops RFID and barcode scanning solutions in Quick Base for our clients.

    I love your ingenuity and skunk works for doing this for chicken and egg tracking and your focus on keeping it inexpensive. A few comments:

    1. Tracking the time in a coop for a chicken can be done but requires multiple readers. The RFID tag readers need to be offset so one reader reads the tag and then the next reader reads the tag. The two timestamps then determines direction. Then you can calculate when a chicken enters a coop and when they leave. The tag readers you are using now probably do not have the read distance necessary to do this, you will need something more powerful. And no, for others reading this, a more powerful RFID tag reader will not harm the chicken or the eggs.

    As a note for others reading this, tracking direction using RFID tags can be done other ways with just a single reader. Every train railcar is outfitted with two RFID tags at both ends of the railcar. As the train goes by a RFID reader each tag gets read and depending on what tag gets read first determines direction.

    2. Geofencing can work if your coops are far enough apart for differentiation. Geofencing typically uses GPS readings to determine the current location of an item. Typically this is done using Latitude / Longitude and the resolution for this is about 30 feet at best.

    You can deploy other types of equipment that does not use GPS tracking like Bluetooth or other technologies, but resolution will always be an issue depending on how far the coops are apart. Plus, this will greatly increase the cost and size of what the chickens need to wear for tracking each one. They will not be happy.

    3. You may have already figured this out, but when reading a tag you will always get multiple reads at the same time (milliseconds apart) and you will need to filter them down to a single read for that point in time. Some RFID tag readers already account for the software that comes with them but if not, you have to do that programatically so you get 1 read per time block (e.g 5 seconds).

    Looking forward to more about this over time!

    ------------------------------
    Scott Burday, Trinity
    ------------------------------



  • 14.  RE: Chicken Tracking with QB

    Posted 01-23-2020 14:47
    Hey Scott,

    That's some great insight. I'll probably be embarking on the RFID aspect of my coop soon.

    Here's the app so far:

    I can't wait to report back on how it's going. Thanks so much for sharing your expertise!

    Best,

    ------------------------------
    Maria Peralta
    Quick Base
    Cambridge MA
    ------------------------------