GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsThree sensors in one stake: a capacitive probe for moisture, a waterproof DS18B20 pushed 10 cm into the soil, and a DHT22 for the air. Soil temperature tells you when it is warm enough to sow; moisture tells you when to water.
Tick anything you already have and the total updates.
Capacitive probe that measures soil moisture without exposed metal, so it does not corrode like resistive probes.
Waterproof stainless-steel probe that reads liquid or soil temperature from −55 to +125 °C (±0.5 °C).
Measures air temperature (±0.5 °C) and relative humidity (±2–5 %) on a single data wire.
Follow the colours: red is power, dark grey is ground, blue is a signal.
wifi_garden_station.inoVerify & upload in Electrolark// Wi-Fi garden station: soil, air and soil temperature
// Geekobot project library · board: ESP32-C3 SuperMini
// Wiring diagram, parts list and build steps: Geekobot project page "wifi-garden-station"
#include <OneWire.h>
#include <DallasTemperature.h>
#include <DHT.h>
#include <WiFi.h>
#include <WebServer.h>
// ---- pins ----
const uint8_t SOIL_PIN = 0;
const uint8_t ONEWIRE_PIN = 10;
const uint8_t DHT_PIN = 7;
const int SOIL_DRY = 2600; // reading in dry air: calibrate
const int SOIL_WET = 1150; // reading in a glass of water: calibrate
OneWire oneWire(ONEWIRE_PIN);
DallasTemperature probes(&oneWire);
DHT dht(DHT_PIN, DHT22);
// ---- latest readings ----
int soilPct = 0;
float probeC = 0;
float tempC = 0;
float humidity = 0;
const char* WIFI_SSID = "YOUR_WIFI_NAME"; // 2.4 GHz network
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";
WebServer server(80);
const unsigned long READ_EVERY_MS = 2000;
unsigned long lastRead = 0;
const char* statusText = "Starting";
const char PAGE[] PROGMEM = R"HTML(<!doctype html><html><head><meta name="viewport" content="width=device-width,initial-scale=1"><title>Garden</title>
<style>body{font-family:system-ui,sans-serif;background:#0d093d;color:#fff;margin:0;padding:20px}h1{font-size:20px;margin:0 0 14px}
.g{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px}.c{background:#1c1866;border-radius:14px;padding:14px}
.l{font-size:12px;opacity:.7}.v{font-size:28px;font-weight:700;margin-top:4px}button{margin-top:14px;padding:12px 18px;border:0;border-radius:10px;font-size:16px;background:#a9c5ea;color:#0d093d}
.s{margin-top:12px;font-size:13px;opacity:.8}</style></head><body><h1>Garden</h1><div class="g" id="g"></div><p class="s" id="s">Connecting…</p>
<script>const F=[["soilPct","Soil","%"],["probeC","Probe","C"],["tempC","Temp","C"],["humidity","Humidity","%"]];
async function tick(){try{const d=await(await fetch('/data')).json();document.getElementById('g').innerHTML=F.map(f=>'<div class="c"><div class="l">'+f[1]+'</div><div class="v">'+(typeof d[f[0]]==='boolean'?(d[f[0]]?'YES':'no'):d[f[0]])+' '+f[2]+'</div></div>').join('');
document.getElementById('s').textContent='Status: '+d.status+' · updated '+new Date().toLocaleTimeString();}catch(e){document.getElementById('s').textContent='Lost connection, retrying…'}}
setInterval(tick,2000);tick();</script></body></html>)HTML";
float readProbeC() {
probes.requestTemperatures();
return probes.getTempCByIndex(0);
}
void handleData() {
String j = "{";
j += "\"soilPct\":"; j += String(soilPct); j += ",";
j += "\"probeC\":"; j += String(probeC, 1); j += ",";
j += "\"tempC\":"; j += String(tempC, 1); j += ",";
j += "\"humidity\":"; j += String(humidity, 0); j += ",";
j += "\"status\":\""; j += statusText; j += "\"}";
server.send(200, "application/json", j);
}
void handleRoot() { server.send(200, "text/html", PAGE); }
void evaluate() {
if (!(probeC > -100 && !isnan(tempC) && !isnan(humidity))) { statusText = "Sensor error"; return; }
statusText = "OK";
}
void setup() {
Serial.begin(115200);
probes.begin();
dht.begin();
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASS);
Serial.print(F("Connecting to Wi-Fi"));
for (int i = 0; i < 40 && WiFi.status() != WL_CONNECTED; i++) { delay(500); Serial.print("."); }
Serial.println();
Serial.print(F("Open this address in your browser: http://"));
Serial.println(WiFi.localIP());
server.on("/", handleRoot);
server.on("/data", handleData);
server.begin();
}
void loop() {
server.handleClient();
if (millis() - lastRead >= READ_EVERY_MS) {
lastRead = millis();
soilPct = constrain(map(analogRead(SOIL_PIN), SOIL_DRY, SOIL_WET, 0, 100), 0, 100);
probeC = readProbeC();
tempC = dht.readTemperature();
humidity = dht.readHumidity();
evaluate();
Serial.print(F("Soil="));
Serial.print(soilPct);
Serial.print(F("%"));
Serial.print(F(", Probe="));
Serial.print(probeC, 1);
Serial.print(F("C"));
Serial.print(F(", Temp="));
Serial.print(tempC, 1);
Serial.print(F("C"));
Serial.print(F(", Humidity="));
Serial.print(humidity, 0);
Serial.print(F("%"));
Serial.println();
}
}
The sketch above runs here on a simulated ESP32-C3. Move the sliders for the sensors and buttons it reads, and watch the Serial monitor, display and outputs change.
Calibrate: note the raw reading in dry air and in water, and put them in SOIL_DRY and SOIL_WET.
The 4.7 kΩ pull-up is missing or DATA is on the wrong pin. Check the yellow wire.
Check the DATA wire and the pull-up. The DHT22 needs at least 2 seconds between reads, so do not poll it faster.
Open the Serial Monitor at 115200 baud and check for messages. Make sure you chose the right board and port in the Arduino IDE.
Close other programs using the serial port, try another USB cable (some are charge-only) and press reset just before uploading.
Not directly; the board serves the page on your local network only. For remote access, send the readings to a cloud service such as MQTT, ThingSpeak or Blynk, or use a VPN into your home network.
No. ESP32-C3 and ESP8266 boards support 2.4 GHz networks only. Most routers broadcast both, so choose the 2.4 GHz name.
7 parts: ESP32-C3 SuperMini Development Board, Capacitive Soil Moisture Sensor – 3.3V/5V Analog Output, DS18B20 Waterproof Temperature Probe – 1m Cable, DHT22 Temperature & Humidity Sensor, Resistor Assortment Kit (30 Values), Solderless Breadboard (830 points) and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 8 steps.
No. This page has the complete, tested code (wifi_garden_station.ino). Install these libraries first: OneWire, DallasTemperature, DHT sensor library and Adafruit Unified Sensor.
Yes. The Run it panel under the code runs this exact sketch on a simulated board. Move the sliders or press the buttons for the sensors it reads, and the Serial monitor, display and outputs react as they will on the real build. It is a simulation, so real readings depend on your parts and wiring.
About ₹602 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
1-Wire bus and pull-up resistors; Calibrating an analog sensor with map(); Single-wire digital sensors and why some sensors need slow polling.
Ideas that reuse this build: Plant monitor with a pump and Soil logger. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.
Connecting to Wi-Fi... Open this address in your browser: http://192.168.1.50 Soil=94%, Probe=26.0C, Temp=26.9C, Humidity=55%
A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.