Skip to the content
2 layers23 × 47.5 mmSmart poultry edge ai, the printed circuit board in 3D

Smart poultry edge ai

AnonCreed/smart-poultry-edge-ai

whose that pokemon

Size
23 × 47.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
12
Nets
39
Pads
65
Tracks, vias
138, 9
Routed
Yes
KiCad
KiCad 9.0 (file 20241229)
Created
30 Jul 2026
Updated
5 Sep 2026

Overview

Smart poultry edge ai is an open-source printed circuit board by AnonCreed, from the AnonCreed/smart-poultry-edge-ai repository on GitHub, published under the MIT licence. It is a 2-layer board of 23 × 47.5 mm with 12 parts on 39 nets, routed with 138 tracks and 9 vias.

It is built around the DHT22 and BC547. Its parts include 4 ICs, 3 resistors, 2 connectors, 1 diode and 1 transistor.

Main components

2

README

README.md

Edge-AI Based Predictive Closed Control System for Smart Poultry Farming

License: MIT Python Django Platform

Minor Project -- Department of Electronics and Computer Engineering, Thapathali Campus, Institute of Engineering (IOE), Tribhuvan University. Submitted in partial fulfillment of the Bachelor's degree in Electronics, Communication and Information Engineering (August 2026), under the supervision of Er. Anup Shrestha, by Amir Bhattarai, Aviral Adhikari, Balram Sharma Kandel, and Bikash BK.

About

Poultry farming is a major part of Nepal's agricultural sector, and most farms still run open-house systems where the indoor environment tracks whatever the weather outside is doing. During the brooding stage (the first two weeks after hatching) chicks are especially sensitive to temperature swings, humidity, and ammonia buildup from droppings -- conditions farmers today mostly manage by manual observation and experience, which means unfavorable changes can go unnoticed until they've already hurt the flock.

This project came out of discussions around the bird-flu outbreaks in Nepal in 2026. Actually detecting or preventing disease was out of scope for a minor project, but keeping a poultry house's environment inside a safe band is a problem we could tackle directly: continuous IoT sensing, an on-device ML model that forecasts where temperature and ammonia are heading (not just where they are), and automated fan/heater control that reacts before a threshold is crossed rather than after.

That's what this repository is: the full system, not just the dashboard --

  • hardware/esp32/ -- an ESP32 sensor node reading temperature, humidity and ammonia (DHT11 + MQ-137), driving the fan/heater relays.
  • hardware/esp32s3_master/ -- an ESP32-S3 master node that receives those readings over ESP-NOW and runs an on-device TFLite Micro model to forecast the next reading and flag an ammonia-spike probability, before handing everything to the backend.
  • hardware/kicad/ -- the KiCad schematic and PCB for the sensor node.
  • telemetry/ -- the Django backend: ingestion API, server-side rule classifier, and the live dashboard (charts, actuator control, console feed, historical export).
  • docs/ -- the written report and the proposal/final defense decks submitted for the degree.

See Documentation & Reports for the full report and defense decks, and Designs for the PCB.

System at a glance

Django backend, Edge-AI-ready JSON REST API, server-side environmental classifier, a two-board ESP-NOW hardware pipeline (ESP32 sensor node + ESP32-S3 master node running an on-device TFLite Micro forecast/spike model), a standalone sensor simulator for development without hardware, and a standard Bootstrap 5 dashboard (dual-line forecast charts, actuator control, live console feed, historical reports/CSV export; Bootstrap and Chart.js are both vendored locally for air-gapped operation).

Architecture

text
sensor_simulator.py  ──HTTP POST──>  /api/telemetry/submit/
   (Virtual sensor,                     │ validate -> classify -> persist
    5 s cadence,                        ▼
    random walk +               PoultryTelemetry (SQLite, indexed timestamp)
    anomaly injection)                  │
                                        ▼
dashboard (browser)  ──HTTP GET──>  /api/telemetry/historical/?hours=N
   (5 s polling loop feeds metrics grid, charts, audit log)

Physical hardware replaces the simulator with a two-board pipeline (the Django/dashboard side above is unchanged either way):

text
hardware/esp32/ (DevKit V1, sensor node)  --ESP-NOW-->  hardware/esp32s3_master/ (ESP32-S3, master node)
   DHT11 + MQ-137 + fan/heater                     TFLite Micro forecast + spike model
              ^                                              |
              `------------ ESP-NOW (classification) <-------'  --WiFi/HTTP--> /api/telemetry/submit/

The master node is the only board that talks to Django; the sensor node only ever exchanges fixed-size binary structs with the master over ESP-NOW. See hardware/esp32/README.md and hardware/esp32s3_master/README.md for the full pipeline, wiring, and the MAC-address pairing procedure the two boards need before they can talk to each other.

ComponentPath
Data model + classification enumtelemetry/models.py
Pure classifier decision framework + spike-risk thresholdtelemetry/classifier.py
API views (submit / historical) + dashboard shelltelemetry/views.py
URL maptelemetry/urls.py, config/urls.py
Virtual sensor client (dev/demo, no hardware needed)sensor_simulator.py
ESP32 sensor-node firmware (DHT11 + MQ-137, ESP-NOW, actuator loop)hardware/esp32/src/main.cpp, hardware/esp32/include/config.h
ESP32-S3 master-node firmware (ESP-NOW receive, TFLite Micro inference, WiFi/HTTP to Django)hardware/esp32s3_master/src/main.cpp, hardware/esp32s3_master/include/config.h
Dashboard templatetelemetry/templates/telemetry/dashboard.html
Console stylesheet / client runtimetelemetry/static/telemetry/dashboard.css, dashboard.js
Unit tests (classifier + API + forecast + spike-risk contracts)telemetry/tests.py

Classifier rules (first match wins)

  1. ammonia_level > 15.0 -> CRITICAL_AMMONIA (dark red background, white text)
  2. temperature > 35.0 (live reading OR the Edge-AI forecast alone) -> HEAT_STRESS_WARNING (orange border, orange text) -- no humidity condition
  3. temperature < 18.0 -> LOW_TEMP_ALERT (deep blue text, light blue accents)
  4. otherwise -> OPTIMAL_ENVIRONMENT (charcoal grid, solid green indicator dot)

Classification is computed server-side at ingestion, before the INSERT, so every stored row is complete and immutable. Thresholds are exposed in the historical API response so the front end never hardcodes them.

API

POST /api/telemetry/submit/

json
{
  "temperature": 29.4,
  "humidity": 61.2,
  "ammonia_level": 8.7,
  "predicted_temperature": null,
  "predicted_ammonia": null,
  "predicted_spike_probability": null
}

Returns 201 with the persisted record including predicted_class.

Forecast channels (predicted_temperature, predicted_ammonia, predicted_spike_probability) are optional and nullable: absent key, explicit null, and numeric value are all accepted, since the ESP32-S3 master node may not be linked yet. When numeric, predicted_temperature/predicted_ammonia are bounds-checked against the same physical envelope as their live counterparts, and predicted_spike_probability (the master's TFLite Micro spike-classifier output) is bounds-checked to [0, 1]. All three serialize back as JSON null when absent, so chart clients can rely on key presence. Classification is always driven by live readings only; forecasts and spike risk are advisory overlays. Payloads with missing live fields, non-numeric values, or readings outside physical/probability envelopes are rejected with 400.

GET /api/telemetry/historical/?hours=24 Returns records in the trailing window, ascending chronologically, plus the active threshold set — ready for direct ingestion by chart libraries.

Running the system

Two terminals.

Terminal 1 — backend and dashboard:

bash
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
# Dashboard (this machine):  http://127.0.0.1:8000/
# Dashboard (other devices, e.g. a phone on the same WiFi): http://<this-machine's-LAN-IP>:8000/

Binding 0.0.0.0 (not the default 127.0.0.1) matters if you're using the physical ESP32-S3 master node -- it needs to reach this over WiFi, and it finds the LAN IP itself via UDP broadcast discovery (see hardware/esp32s3_master/README.md), so there's no IP to hardcode on either side. ALLOWED_HOSTS is left open ("*") in config/settings.py for the same reason -- this is a dev-only server, never expose it beyond a trusted LAN.

Terminal 2 — virtual sensor:

bash
python sensor_simulator.py
# Edge-AI forecast emulation is ON by default so the KPI forecast lines,
# dashed chart series, console (Pred: ...) markers, and the AI spike-risk
# card all have live numbers. To transmit null forecasts/spike-risk
# (matching the deployment state before the ESP32-S3 master node is linked):
python sensor_simulator.py --no-edge-ai

The simulator transmits every 5 seconds using an Ornstein-Uhlenbeck-style random walk (Gaussian step + mean reversion) per channel, and superimposes two anomaly generators: a triangular thermal spike exceeding 37 C every 2 minutes, and an ammonia accumulation ramp that climbs past 30 PPM until a simulated ventilation fan engages and extracts it back to baseline.

Tests

bash
python manage.py test telemetry

Covers classifier rule precedence (ammonia dominance, heat-stress from live reading or forecast alone, low-temperature boundary), ingestion validation, nullable forecast-channel contracts (absent key, explicit null, populated, invalid type), and historical ordering/threshold contracts.

Hardware firmware (two boards: ESP32 sensor node + ESP32-S3 master node)

Two firmware projects ship the physical pipeline; both must be flashed and paired (by MAC address) for the hardware to work end-to-end.

  • hardware/esp32/ -- ESP32 DevKit V1 sensor node. Reads DHT11 on GPIO4 and MQ-137 on GPIO34 every 5 s, and sends the readings over ESP-NOW to the master node (no HTTP, no JSON on this board). Drives an ON/OFF fan relay (GPIO32) and an ON/OFF heater relay (GPIO25) from the classification the master relays back. See hardware/esp32/README.md for the pin map and MQ-137 calibration procedure.
  • hardware/esp32s3_master/ -- ESP32-S3 master node. Receives sensor readings over ESP-NOW, runs an on-device TFLite Micro model to forecast the next temperature/ammonia reading and an ammonia-spike probability, then POSTs the combined record to Django using the same JSON contract the Python simulator uses. Relays Django's classification back to the sensor node over ESP-NOW. See hardware/esp32s3_master/README.md for the model details, the Arduino IDE flashing steps, and the MAC-pairing procedure required before either board can talk to the other.

Quickstart (flash the master first -- you need its printed MAC address to configure the sensor node):

bash
cd hardware/esp32s3_master
# Arduino IDE: install libraries per README.md, edit config_master.h
# (WIFI_SSID, WIFI_PASSWORD, API_BASE_URL, SENSOR_NODE_MAC_ADDR),
# then upload esp32s3_master.ino and note the printed "Receiver MAC".

cd ../esp32
# Edit include/config.h: WIFI_SSID, WIFI_PASSWORD (same network as the
# master), MASTER_MAC_ADDR (from the step above).
pio run                 # Compile
pio run -t upload       # Flash over USB
pio device monitor      # Serial diagnostics at 115200 baud
# Copy this board's printed MAC back into hardware/esp32s3_master/config_master.h's
# SENSOR_NODE_MAC_ADDR and reflash the master.

The virtual simulator and the physical firmware pipeline are contract- compatible: both ultimately POST the same JSON payload shape to Django, so the backend and dashboard cannot tell them apart. The Python simulator remains useful for CI, demos, and development without hardware in the loop.

Views

Two tab-switched views share a single polling loop, so the console tail accumulates in the background even while the user is on the Overview.

Overview Dashboard

  • KPI cards: instantaneous readings with desaturated state accents (colored value text plus a 2px left-border highlight; backgrounds stay untouched). Each forecastable channel shows a muted secondary line beneath the primary value: AI Forecast: 27.8 degC, AI Forecast: 8.4 ppm. When the ESP32-S3 master node's link is inactive the line reads AI Forecast: pending.
  • AI spike risk card: the ESP32-S3 master node's TFLite Micro spike- classifier probability, rendered as a percentage. Escalates ok -> warn -> crit as the probability crosses the calibrated threshold (echoed from the API, never hardcoded twice) and twice that threshold. Reads Master node: pending until the master node is linked.
  • Dual-line charts (full vertical breathing room): solid stroke for live sensor data, dashed light stroke for Edge-AI forecasts (spanGaps: false, so null forecast points render as gaps and a fully-null channel is simply invisible while remaining mounted), plus a dashed threshold baseline.

System Logs Feed

Dedicated full-page console. Append-only tail keyed by record id; each new ingestion appends one line in the format [YYYY-MM-DD HH:MM:SS] INGESTION SUCCESS -> T: 27.4C (Pred: 27.8C) | RH: 60.2% | NH3: 8.1ppm (Pred: 8.4ppm) | STATE: OPTIMAL | SPIKE_RISK: 14% with text tinted by classification. When a forecast channel is null the inline marker reads (Pred: n/a); the SPIKE_RISK segment is omitted entirely (not n/a) when the master node hasn't reported a probability yet. Includes a rolling 200-line buffer and a pause-scroll control. The server emits the same line via the telemetry.ingest logger, so journalctl and the browser can be cross-referenced without translation.

Designs

KiCad schematic + PCB for the ESP32 sensor node live in hardware/kicad/ (kicad.kicad_pro, .kicad_sch, .kicad_pcb, .kicad_prl -- open the .kicad_pro in KiCad 9). It lays out the ESP32 DevKit V1 footprint alongside the DHT11, MQ-137, fan/heater relay drive, and terminal-block wiring described in hardware/esp32/README.md.

KiCad PCB top-copper layout

Documentation & Reports

DocumentPath
Minor project report (full, 81 pages)docs/minor_project_report.pdf
Proposal presentationdocs/presentations/proposal_presentation.pdf
Final defense presentationdocs/presentations/final_presentation.pdf
Hardware & firmware architecture deep-diveHARDWARE_DOCUMENTATION.md

Team

NameRoll No.
Amir BhattaraiTHA080BEI005
Aviral AdhikariTHA080BEI011
Balram Sharma KandelTHA080BEI012
Bikash BKTHA080BEI015

Supervised by Er. Anup Shrestha, Department of Electronics and Computer Engineering, Thapathali Campus, Institute of Engineering, Tribhuvan University.

License

MIT -- see LICENSE.

Parts

12
QtyValueFootprintReferences
112V-inputTerminalBlock:TerminalBlock_MaiXu_MX126-5.0-02P_1x02_P5.00mmJ1
11KResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR4
11N4007Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD1
1200Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR5
1BC547Package_TO_SOT_THT:TO-92_InlineQ1
1Conn_01x03_PinConnector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ2
1DCDC_StepDown_LM2596TerminalBlock:TerminalBlock_MaiXu_MX126-5.0-04P_1x04_P5.00mmU4
1DHT22Sensor:Aosong_DHT11_5.5x12.0_P2.54mmU3
1Fan_4pinConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_VerticalM1
1HeaterTerminalBlock:TerminalBlock_MaiXu_MX126-5.0-02P_1x02_P5.00mmR1
1MQ-137Connector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalU2
1~ESP32_Footprint:ESP32_30pinU1

Similar boards

  • 2 layersCircuit smart soja, the printed circuit board in 3D

    Circuit smart soja

    virgile-tchidehou/smart-soja

    An autonomous IoT-based mobile system for soybean pre-processing, integrating embedded systems, industrial automation, solar energy and cloud connectivity.

    81 parts1MIT
  • 2 layers83.7 × 90.3 mmIncubator Quetta Client, the printed circuit board in 3D

    Incubator Quetta Client

    manhoosbilli1/Incubator_basic_esp32_modular_1_sided

    This contains an incubator pcb i've made for a client. his needs were specific so only added what he needed. a complete and complex version can be found in capibator organization.

    43 parts
  • 2 layers81 × 95.7 mmBRD2, the printed circuit board in 3D

    BRD2

    mFulmini/engineer

    Tutaj znajduje się część pracy inżynierskiej w postaci oprogramowań jednostek brzegowych, rysunków, schematów elektrycznych oraz poglądowych zrzutów ekranu.

    25 parts
  • 2 layers271.8 × 114.3 mmArdumower mega shield svn, the printed circuit board in 3D

    Ardumower mega shield svn

    Ardumower/ardumower

    Develop an open source robotic lawn mower (HW+SW reference platform)

    426 parts282
  • 2 layers104.8 × 72.1 mmSST V2 4, the printed circuit board in 3D

    SST V2 4

    mcbittech/souliss-smart-thermostat-WiFi

    ESP8266 WiFi Smart Thermostat based on Souliss IoT Framework

    53 parts110GPL-2.0
  • 2 layers40.6 × 50.8 mmIot sourdough starter monitor, the printed circuit board in 3D

    Iot sourdough starter monitor

    justinmklam/iot-sourdough-starter-monitor

    Tracking the fermentation of sourdough starter over the cloud.

    7 parts93GPL-3.0
  • 2 layers28 × 13 mmDHT22 pcb, the printed circuit board in 3D

    DHT22 pcb

    MakersAsylumIndia/M19O2

    M19O2 open source hardware Oxygen Concentrator based on the Pressure Swing Adsorption cycle aka Skarstorm cycle

    5 parts68MIT

Questions

How big is the Smart poultry edge ai PCB?

It measures 23 × 47.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Smart poultry edge ai use?

12 parts, built around the DHT22 and BC547. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Smart poultry edge ai KiCad files?

From the AnonCreed/smart-poultry-edge-ai repository on GitHub, at the commit this page was made from: the board is hardware/kicad/kicad.kicad_pcb and its schematic hardware/kicad/kicad.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Smart poultry edge ai design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).