BOM using Digikey mylist:
Link:
https://www.digikey.in/en/mylists/list/TSIVIDT023
1. Physical Assembly
Step 1 – Prepare breadboard & power
- Place the Arduino UNO R4 WiFi on your workbench and connect the USB Type-C cable for programming.
- Place the OLED display, DHT11 sensor, and Soil Moisture sensor on the breadboard.
- Connect all common grounds (GND) together.
- Connect all positive (VCC/5V) lines together.
Step 2 – Hook up sensors
Soil Moisture Sensor (Capacitive type):
- VCC → 5V
- GND → GND
- AO (Analog Output) → A0
DHT11 Sensor:
- VCC → 5V
- GND → GND
- DATA → D2
OLED Display (SSD1306, I²C):
- SDA → Arduino SDA
- SCL → Arduino SCL
- VCC → 5V
- GND → GND
Step 3 – Connect the Relay Module
- Relay VCC → 5V (Arduino Uno R4 WiFi)
- Relay GND → GND (Arduino Uno R4 WiFi)
- Relay IN → D3 (Arduino Uno R4 WiFi)
Step 4 – Connect the Pump & Power
- Use a separate power supply for the pump (match the pump’s rated voltage, e.g., 5V to 12V).
- Connect the pump negative (−) → Pump power supply negative (−) connect the pump power supply negative (−) to Arduino Uno R4 WiFi GND (common ground).
- Connect pump positive (+) → Relay COM terminal.
- Connect the pump power supply positive (+) → Relay NO terminal.
Step 5 – Safety Checks
- Verify the relay rating is equal or higher than your pump current.
- For mains/AC pumps, use a proper AC-rated relay or SSR and ensure full electrical isolation.
Insulate all exposed terminals with heat-shrink or electrical tape.
2. Software / Uploading Code
Open Arduino IDE and select Arduino UNO R4 WiFi as your board.
Install required libraries (if not already installed):
- WiFiS3
- PubSubClient
- DHT Sensor Library
- Adafruit GFX
- Adafruit SSD1306
Paste the final Arduino code (relayPin = D3, soil sensor = A0).
Update your WiFi SSID and password, as well as your ThingsBoard token.
Upload the sketch.
Open Serial Monitor (9600 baud) to check debug messages.
3. Calibrate Soil Sensor & Set Threshold
- Place the sensor in dry air → Note the analog value (near 1023).
- Place the sensor in wet soil → Note the analog value (around 300–400).
- Choose one moistureThreshold of these two.
- Example: Dry = 950, Wet = 300 → Threshold ≈ 600–700.
- Update this line in code:
const int moistureThreshold = XXX;
- Re-upload the sketch.
4. Verify Pump Control
- Open the Serial Monitor and watch the soil moisture value.
- Remove the sensor from the soil (simulate dryness).
The pump turns ON using a relay.
Insert the sensor into moist soil.
Pump turns OFF using a relay.
- Use a multimeter to confirm relay NO/COM switching.
5. OLED Pump ON/OFF Display
- The OLED shows:
- Soil Moisture
- Temperature (°C)
- Humidity (%)
- Raw Value
6. Troubleshooting Checklist
- Relay clicks, but the pump doesn’t run → The Pump supply is not connected properly.
- Pump runs when not expected → Threshold set incorrectly. Adjust moistureThreshold.
- OLED blank → Check I²C wiring (SDA=A4, SCL=A5) and address (0x3C).
- DHT shows nan → Bad wiring or missing pull-up resistor.
.jpg)
[Soil Moisture Sensor]
|
(A0)
|
[Arduino UNO R4 WiFi]-----------(D2)---[DHT11 Sensor]
| |
[Relay Module] (SDA/SDA, SCL/SCL)
| |
| [OLED SSD1306]
|
|__[Pump Power/Relay Output]---[Water Pump]
|
|__[Dedicated Pump Supply (Common Ground)]