Skip to the content
2 layers119 × 103.5 mmCustom shield, the printed circuit board in 3D

A birdcage automation system based on Arduino UNO R4 WiFi

Size
119 × 103.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
29
Nets
49
Pads
123
Tracks, vias
142, 35
Pours
9
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
24 May 2025
Updated
28 Sep 2026

Overview

Custom shield is an open-source printed circuit board by SoF4rAway, from the SoF4rAway/birdcage-automation-system repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 119 × 103.5 mm with 29 parts on 49 nets, routed with 142 tracks and 35 vias.

It is built around the DHT11 and TIP120. Its parts include 10 connectors, 4 resistors, 3 capacitors, 2 ICs and 2 diodes. It belongs with the radio and wireless boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

2

README

README.md

Smart Bird Cage Automation System

DOI License: CC BY-SA 4.0 Microcontroller: Arduino Uno R4 WiFi Platform: Arduino IoT Cloud

Open-source firmware, circuit schematics, and mechanical integration for an autonomous IoT bird cage management system. This platform consolidates solid feed dispensing, liquid water monitoring and replenishment, and a single-axis linear brush-and-spray tray cleaning mechanism orchestrated by an Arduino Uno R4 WiFi.


Publication Reference

If you use this system, codebase, or hardware design in academic work, please cite the original peer-reviewed publication:

M. F. Rahman, M. K. Anam, N. F. Arfa, F. Husnayain, and R. Suwandi, "Integration of Sensor-Based IoT Automation for Feeding and Cleaning in Smart Bird Cage Systems," Jurnal Otomasi Kontrol dan Instrumentasi, vol. 18, no. 1, pp. 83–92, 2026. DOI: 10.5614/joki.2026.18.1.7

bibtex
@article{rahman2026smartbirdcage,
  title     = {Integration of Sensor-Based IoT Automation for Feeding and Cleaning in Smart Bird Cage Systems},
  author    = {Rahman, Muhammad Farid and Anam, Muhammad Khoirul and Arfa, Nuril Fathara and Husnayain, Faiz and Suwandi, Rifki},
  journal   = {Jurnal Otomasi Kontrol dan Instrumentasi},
  volume    = {18},
  number    = {1},
  pages     = {83--92},
  year      = {2026},
  doi       = {10.5614/joki.2026.18.1.7},
  url       = {https://doi.org/10.5614/joki.2026.18.1.7}
}

System Overview & Architecture

Conventional avian care systems focus solely on feeding or employ mechanically complex conveyor belts that struggle with dried waste. This architecture introduces three key improvements:

  1. Differentiated Sensing: An ultrasonic sensor measures dry feed, while a non-contact capacitive strip tracks water depth—bypassing acoustic distortion in humid, confined spaces.
  2. Integrated Mechanical Sanitation: A lead-screw-driven linear brush paired with a water spray routine dislodges adhered droppings.
  3. Hybrid Scheduling & Failsafes: Operates via Arduino IoT Cloud telemetry while retaining high-precision offline schedule execution through an onboard DS3231SN Real-Time Clock (RTC).
mermaid
flowchart TD
    subgraph Layer1["Physical Layer (Cage, Sensors & Actuators)"]
        HC["HC-SR04 Ultrasonic Sensor<br/>(Solid Feed Level)"]
        CAP["Grove Capacitive Sensor (10 cm)<br/>(Water Reservoir Level)"]
        DHT["DHT11 Sensor<br/>(Ambient Temp & Humidity Telemetry)"]
        RTC["DS3231SN RTC Module<br/>(I2C Offline Clock)"]
        
        SERVO["MG996R Servo Motor<br/>(Food Gate Flap)"]
        SOL1["ZE-4F180 Solenoid Valve 1<br/>(Cleaning Tray Flush Water)"]
        SOL2["ZE-4F180 Solenoid Valve 2<br/>(Drinking Water Replenishment)"]
        STEPPER["NEMA 17 Stepper + A4988<br/>(Linear Cleaning Brush)"]
    end

    subgraph Layer2["Control & Processing Layer"]
        MCU["Arduino Uno R4 WiFi<br/>(RA4M1 Core + ESP32-S3 Coprocessor)"]
    end

    subgraph Layer3["Network & Cloud Layer"]
        CLOUD["Arduino IoT Cloud Broker<br/>(REST / MQTT over TLS)"]
    end

    subgraph Layer4["Application Layer"]
        DASH["Web Dashboard & Mobile App<br/>(Remote Monitor & Overrides)"]
    end

Hardware Bill of Materials (BOM)

ComponentModel / SpecPurpose in System
MicrocontrollerArduino Uno R4 WiFiCore processing, 5V I/O logic, onboard ESP32-S3 Wi-Fi coprocessor
Solid Feed SensorHC-SR04 UltrasonicNon-contact distance measurement for seed level
Water Level SensorGrove Capacitive Water Sensor (10 cm)Segmented non-contact capacitive detection (5 mm resolution)
Ambient SensorDHT11 ModuleAmbient temperature and humidity monitoring (telemetry stream)
Real-Time ClockDS3231SN (I2C)Battery-backed high-accuracy offline timing
Feed ActuatorTowerPro MG996R ServoHigh-torque mechanical hatch gate opening/closing
Water Flush ActuatorZE-4F180 Solenoid Valve (12V)Cleaning tray water flush control (SOL_1)
Water Refill ActuatorZE-4F180 Solenoid Valve (12V)Drinking water replenishment control (SOL_2)
Actuator DriverTIP120 Darlington TransistorCurrent amplification & 12V solenoid isolation
Cleaning ActuatorNEMA 17 Stepper (17HS3401)Linear axis lead-screw actuation for bristle brush
Stepper DriverA4988 ModuleStepper current limiting, direction, and step sequencing
Cleaning BrushCustom Rigid Bristle AssemblyWaste tray scraping surface
Power Supply12V DC / 5A Buck SystemSplit rail supply (12V for actuators, 5V for logic)

[!NOTE] The custom PCB shield includes footprints and pull-ups for the DHT11 sensor. While DHT11 readings are captured and streamed to the Arduino IoT Cloud dashboard for ambient climate telemetry, the automation control logic (feeding and cleaning cycles) operates strictly based on ultrasonic, capacitive, and RTC time inputs as presented in the paper.


Software Flow & Control Logic

The firmware runs a deterministic, cyclic state-machine loop incorporating safety timeouts inspired by critical software engineering principles (e.g., NASA "Power of Ten" Rule #2).

mermaid
flowchart TD
    Start([System Start / Loop]) --> ReadSensors[Read Sensors:<br/>HC-SR04, Capacitive Strip, DHT11 & RTC]
    ReadSensors --> SyncCloud[Push Telemetry to Arduino IoT Cloud]

    SyncCloud --> CheckFood{Food Level <= 25%?}
    CheckFood -- Yes --> OpenFoodGate[Move MG996R Servo to 180°]
    OpenFoodGate --> FoodLoop{Food Level > 95%<br/>OR Timeout > 10s?}
    FoodLoop -- Yes --> CloseFoodGate[Return Servo to 0°]
    FoodLoop -- No --> WaitFood[Loop Read Food Sensor] --> FoodLoop
    CloseFoodGate --> CheckWater
    CheckFood -- No --> CheckWater{Water Level <= 25%?}

    CheckWater -- Yes --> OpenWaterValve[Energize SOL_2 Refill Valve]
    OpenWaterValve --> WaterLoop{Water Level > 95%<br/>OR Timeout > 10s?}
    WaterLoop -- Yes --> CloseWaterValve[De-energize SOL_2 Refill Valve]
    WaterLoop -- No --> WaitWater[Loop Read Water Sensor] --> WaterLoop
    CloseWaterValve --> CheckRTC
    CheckWater -- No --> CheckRTC{Hour == 15:00<br/>AND Hour != LastChecked?}

    CheckRTC -- Yes --> RunCleaning[Execute Linear Cleaning Routine:<br/>Energize SOL_1 + Run Stepper back-and-forth<br/>8200 steps x cleaner_rep]
    RunCleaning --> CycleEnd([End of Loop Cycle])
    CheckRTC -- No --> CycleEnd

    CycleEnd -->|Yield / Loop Delay| Start

Safety Failsafe

Every automated refill subroutine is bound by a strict 10-second timeout ceiling. If a sensor reading fails, detaches, or experiences boundary chattering, the valve/servo forces closed automatically after 10 seconds to avoid overflow or seed spilling.


Calibration and Sensor Metrics

1. Solid Feed Level Calibration (Ultrasonic HC-SR04)

The sensor is mounted orthogonally at the top center of the seed container:

  • Empty Distance ($D_{max}$): 18 cm $\rightarrow$ 0%
  • Full Distance ($D_{min}$): 0 cm $\rightarrow$ 100%
  • Trigger Threshold (25%): 13.5 cm
  • Shut-off Threshold (95%): 0.9 cm

$$\text{Feed Level (%)} = \left( \frac{18 - D_{\text{measured}}}{18} \right) \times 100%$$

2. Water Level Calibration (Capacitive Grove Sensor)

The 10 cm capacitive sensor provides discrete height sensing over internal sensing segments:

  • Resolution: 5 mm per segment step.
  • Conversion: Scaled by a 5% step factor per active segment.
  • Eliminates the sound-speed shifts and corrosion common to immersed acoustic sensors in high-humidity micro-climates.

Experimental Validation & Performance

The prototype was tested under controlled conditions ($27^\circ\text{C}$, 65% RH) across four validation axes:

mermaid
pie title Dynamic Refill Failure Rates (n = 5 trials each)
    "Grove Capacitive Sensor (0% Failure)" : 100
    "HC-SR04 Ultrasonic Sensor (20% Failure)" : 20
    "HC-SR04 Successful Refills" : 80
  1. Water Reservoir Accuracy:

    • Mean Absolute Error: 0.38 cm (maximum error $\le$ 0.5 cm).
    • Refill Failure Rate: 0% (0 / 5 trials).
  2. Food Dispenser Accuracy:

    • Mean Absolute Error: 0.75 cm.
    • Refill Failure Rate: 20% (1 / 5 trials) due to echo bounce and signal chattering near the 25% threshold boundary. (Resolved by adding a debounce window in firmware).
  3. Sanitation & Waste Removal Efficiency:

    • Evaluated across 100 discrete test sectors ($10 \times 10$ surface matrix) on dried bird droppings.
    • Quantitative waste removal efficiency reached 94% within a single cleaning cycle ($E_C = \frac{100 - 6}{100} \times 100%$).

Repository Structure

text
├── pcb-design/
│   ├── Fab/                     # Manufacturing gerbers & drill files
│   ├── components/              # KiCad 3D models & footprints
│   ├── exports/                 # PDF schematics and board plots
│   ├── custom-shield.kicad_sch  # KiCad 8 schematic design
│   ├── custom-shield.kicad_pcb  # KiCad 8 PCB layout
│   └── custom-shield.kicad_pro  # KiCad project file
├── src/
│   ├── src.ino                  # Main Arduino Uno R4 WiFi firmware
│   ├── arduino_secrets.h.example# Template for Wi-Fi credentials
│   └── thingProperties.h       # (Generated by Arduino IoT Cloud, git-ignored)
├── system-flowchart.png         # System flow chart diagram
├── CITATION.cff                 # GitHub native citation metadata
├── references.bib               # BibTeX citation entry
├── LICENSE                      # Creative Commons License
└── README.md                    # Project documentation

Setup & Getting Started

1. Hardware Connections

  • HC-SR04 Ultrasonic: VCC $\rightarrow$ 5V, GND $\rightarrow$ GND, TRIG $\rightarrow$ Pin D7, ECHO $\rightarrow$ Pin D8
  • DHT11 Sensor: VCC $\rightarrow$ 5V, GND $\rightarrow$ GND, DATA $\rightarrow$ Pin D13
  • Grove Capacitive Sensor: Connect to I2C lines (SDA $\rightarrow$ A4 / SDA, SCL $\rightarrow$ A5 / SCL)
  • DS3231SN RTC: Connect to common I2C bus (SDA, SCL)
  • MG996R Servo: Signal $\rightarrow$ Pin D11, Power $\rightarrow$ External 5V rail
  • ZE-4F180 Solenoid 1 (SOL_1, Cleaning Flush): Driven via TIP120 through Pin D3
  • ZE-4F180 Solenoid 2 (SOL_2, Drinking Refill): Driven via TIP120 through Pin D4
  • A4988 Stepper Driver: STEP $\rightarrow$ Pin D5, DIR $\rightarrow$ Pin D6, powered by 12V supply

2. Secrets & Wi-Fi Configuration

  1. Copy the secrets template in src/:
    bash
    cp src/arduino_secrets.h.example src/arduino_secrets.h
  2. Open src/arduino_secrets.h and provide your local network credentials:
    cpp
    #define SECRET_SSID "YOUR_WIFI_SSID"
    #define SECRET_OPTIONAL_PASS "YOUR_WIFI_PASSWORD"

3. Arduino IoT Cloud Configuration

[!IMPORTANT] src/thingProperties.h is automatically generated by the Arduino IoT Cloud environment and is intentionally excluded from Git tracking to avoid credential/Thing ID collisions.

  1. Create an account on Arduino IoT Cloud.
  2. Create a new Thing and associate your Arduino Uno R4 WiFi device.
  3. Configure the following cloud variables within the Thing dashboard:
Variable NameTypeDeclarationPurpose
food_lvintRead-only (Periodic 3s)Seed container level percentage
w_lv_valueintRead-only (Periodic 3s)Drinking water depth percentage
tempfloatRead-only (Periodic 3s)Ambient temperature (°C) via DHT11
humifloatRead-only (Periodic 3s)Ambient relative humidity (%) via DHT11
food_critboolRead-only (On Change)Critical low food flag
wtr_critboolRead-only (On Change)Critical low water flag
isCleaningboolRead-only (On Change)Cleaning cycle active indicator
cleaner_repintRead/Write (On Change)Configurable brush cycle repetitions
man_cleaningboolRead/Write (On Change)Manual dashboard override to trigger cleaning
  1. When editing or deploying via the Arduino Cloud Web Editor or Arduino IDE with the Cloud plugin, thingProperties.h will be auto-populated and linked to your sketch. Flash src/src.ino to the board.

License

This project and associated documentation are distributed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Parts

29
QtyValueFootprintReferences
4MountingHole_PadMountingHole:MountingHole_2.2mm_M2_DIN965_PadH1, H2, H3, H5
3100uCapacitor_Tantalum_SMD:CP_EIA-6032-28_Kemet-C_Pad2.25x2.35mm_HandSolderC3, C4, C5
210kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR3, R4
21N4001Diode_THT:D_DO-41_SOD81_P10.16mm_HorizontalD1, D2
21kResistor_SMD:R_0805_2012Metric_Pad1.20x1.40mm_HandSolderR1, R2
2LM2596_DCDCLM2596:YAAJ_DCDC_StepDown_LM2596U1, U2
2TIP120Package_TO_SOT_THT:TO-220-3_VerticalQ1, Q2
1Arduino_Uno_R4_WiFi_ShieldPCM_arduino-library:Arduino_Uno_R4_WiFi_ShieldA1
1Barrel_Jack_SwitchBarrel Jack:CUI_PJ-002AJ11
1DC-PUMP_RELConnector_JST:JST_PH_S3B-PH-K_1x03_P2.00mm_HorizontalJ4
1DHT_11Connector_JST:JST_PH_S3B-PH-K_1x03_P2.00mm_HorizontalJ8
1Pololu_Breakout_A4988Module:Pololu_Breakout-16_15.2x20.3mmA2
1RTC_MODULEConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_HorizontalJ10
1SERVO_MTRConnector_JST:JST_PH_S3B-PH-K_1x03_P2.00mm_HorizontalJ9
1SOL_CTRL1Connector_JST:JST_PH_S2B-PH-K_1x02_P2.00mm_HorizontalJ2
1SOL_CTRL2Connector_JST:JST_PH_S2B-PH-K_1x02_P2.00mm_HorizontalJ3
1STP_MTRConnector_JST:JST_PH_S4B-PH-K_1x04_P2.00mm_HorizontalJ1
1ULT_SNRConnector_JST:JST_PH_S4B-PH-K_1x04_P2.00mm_HorizontalJ5
1W_LV_SENSORConnector_JST:JST_PH_S4B-PH-K_1x04_P2.00mm_HorizontalJ6

Similar boards

  • 2 layersMain automatic manifold, the printed circuit board in 3D

    Main automatic manifold

    Febriyandi12/Desain_PCB

    Kolaborasi untuk update desain pcb yang telah di research

    59 parts1
  • 2 layers364.4 × 167.3 mmRedherring, the printed circuit board in 3D

    Redherring

    dcpedit/redherring

    Red Herring Keyboard PCB and case files

    226 parts253CC-BY-4.0
  • 2 layers148.8 × 132.2 mmUsbflashprog, the printed circuit board in 3D

    Usbflashprog

    robsonsmartins/usbflashprog

    A memory device programmer (Flash/EPROM/E2PROM) board and software, connected to PC by USB port.

    125 parts36
  • 2 layers489.6 × 170.7 mmMission control, the printed circuit board in 3D

    Mission control

    dcpedit/mission-control

    Modern replacement PCB for the IBM Model M 122

    286 parts31CC-BY-4.0
  • 2 layers168 × 123 mmV2 - 2, the printed circuit board in 3D

    V2 - 2

    RudgeLab/FluoPi

    Code and teaching materials for UC/BackyardBrains raspberry pi "macro" scope.

    131 parts26
  • 2 layersCatozap, the printed circuit board in 3D

    Catozap

    jones139/catocam

    Uses a custom trained YoloV8 model on a Raspberry Pi to Detect Cats in CCTV images and Unleash a Cat Deterrent

    3 parts18GPL-3.0
  • 2 layers32.5 × 21.2 mmTaptap, the printed circuit board in 3D

    Taptap

    dcpedit/taptap

    TapTap is a solenoid breakout board for those who are interested in adding a solenoid to their existing project. All you need are the following components, and an extra data pin on your microcontroller.

    9 parts13CC-BY-4.0

Questions

How big is the Custom shield PCB?

It measures 119 × 103.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Custom shield use?

29 parts, built around the DHT11 and TIP120. 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 Custom shield KiCad files?

From the SoF4rAway/birdcage-automation-system repository on GitHub, at the commit this page was made from: the board is pcb-design/custom-shield.kicad_pcb and its schematic pcb-design/custom-shield.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Custom shield design in my own project?

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