Livestock farming is a business of details. Knowing which animal received its last vaccination, when it was born, who owns it, and what its health history looks like — this information is critical for farmers, veterinarians, and livestock inspectors. Yet in most small to mid-scale farms, these records live in handwritten notebooks, spreadsheets, or simply memory.
Misidentification is a real risk. An animal treated twice for the same condition, or worse, one that slips through a health check because there's no reliable way to confirm its identity at the gate — these are not edge cases.
This project solves that with a handheld RFID scanner built around the ESP32, paired with an SSD1306 OLED display for instant on-device feedback and a PHP/MySQL web dashboard for record management and history tracking.
The IdeaEach animal wears a passive RFID tag — the same kind used for access cards — attached to a collar or ear tag. When a farmer or vet scans the animal, the device reads the tag's unique ID, queries a database over Wi-Fi, and displays the animal's full profile on the OLED screen within seconds.
If the tag is unregistered, an error is shown, and a buzzer alerts the operator. Successful scans trigger an LED indicator and log the event to the server.
The web dashboard lets farm managers add new animals, update records, and review scan history — all from a browser.
How It WorksSystem Flow
The firmware runs a main loop that continuously polls the MFRC522 for a tag. When one is detected:
- The UID is read and converted to a hex string.
- An HTTP GET request is sent to the PHP backend with the UID as a parameter.
- The server checks the MySQL database and returns the animal's name, species, age, vaccination status, and owner.
- The OLED displays this information.
- The green LED lights up, and the buzzer gives a short beep.
If the tag UID is not found in the database, the OLED shows "Unknown Animal", the red LED activates, and the buzzer gives a long error beep.
Holding the register button before a scan puts the device in registration mode — the next tag scanned is queued for registration via the web dashboard rather than looked up.
Firmware — ESP32 (Arduino / C++)The firmware is written using the Arduino ESP32 framework. Key libraries:
MFRC522— RFID communicationAdafruit_SSD1306— OLED renderingWiFi.h+HTTPClient.h— Wi-Fi and HTTP POST/GETArduinoJson— Parsing JSON responses from the PHP server
The server side runs on XAMPP (Apache + MySQL) and exposes two endpoints:
lookup.php— Takes a UID, queries the database, and returns JSON.register.php— Accepts new animal data and UID from the dashboard form.log.php— Records every scan event with a timestamp.
The management dashboard is a PHP/HTML frontend served by Apache. It allows farm staff to:
- Add a new animal and link it to an RFID tag UID
- Edit animal records (update vaccination status, age, notes)
- Delete deregistered animals
- View scan history — timestamped log of every RFID scan
The dashboard uses a simple HTML table with PHP-rendered rows from the MySQL database, styled for readability on both desktop and mobile browsers.
Notification SystemAfter every successful scan, the PHP backend can trigger an owner notification using the contact information stored in the database. This is implemented using PHP's built-in mail() function, which can be connected to an SMTP relay for reliable delivery.
The enclosure is a custom 3D-printed wedge-shaped desktop unit — designed to sit on a stable surface at a scanning station rather than be carried around the field. The angled front face tilts all controls and indicators toward the operator, making them easier to use when animals are brought to the scanning point.
The front face houses five openings, the main ones being:
- OLED window — a rectangular cutout at the top of the angled face for the SSD1306 display, recessed slightly so the screen sits flush and protected.
- Two small circular holes — positioned below the OLED for the green (success) and red (error) LEDs, angled with the face so they're clearly visible to the operator.
A USB port cutout is moulded into the bottom of the enclosure, allowing the device to be powered continuously from a wall adapter or a USB power supply at the scanning station without opening the case.
The body uses rounded corners and chamfered edges throughout, keeping the exterior smooth and easy to wipe down — important in a livestock environment. All components mount internally to a simple printed bracket, and the lid clips or screws onto the base for easy access during assembly and maintenance.
ResultsManaging livestock shouldn’t depend on paperwork, guesswork, or trying to remember which animal was checked last. This project proves that with affordable hardware and a relatively simple setup, it’s possible to build a dependable identification system that works in real farm conditions while keeping accurate digital records of every animal in the herd.
Using roughly $30–45 worth of components, the system delivers instant feedback the moment a tag is scanned.
What makes this project especially practical is its simplicity. The design avoids proprietary platforms and hard-to-source components, making it easier for developers to repair or customize the system without specialized training.
The challenges faced in livestock management are common across many farms and regions, and open, adaptable solutions help the wider hardware and maker community move forward together.













_3u05Tpwasz.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)
Comments