Community project

Wireless Ward Environment Monitor

Photo of Wireless Ward Environment Monitor
Generated with AI

Tinash Sibanda

Published November 27, 2026

This project builds a wireless environmental monitor for hospital wards or care facilities, tracking temperature, humidity, and light levels across multiple sensor stations. The system uses an Arduino Uno with an ESP8266 WiFi shield to create a local access point, displaying real-time readings on an LCD screen and sounding an alarm when conditions drift outside safe ranges.

The guide includes a complete wiring diagram showing how to connect three DHT22 temperature/humidity sensors, three light sensors, a 16x2 I2C LCD display, and a piezo buzzer. Builders will receive the full Arduino firmware with configurable thresholds for temperature, humidity, and light, plus step-by-step assembly instructions for stacking the WiFi shield and integrating all sensors with proper logic-level shifting between the 5V Arduino and 3.3V ESP8266.

Wiring diagram

Wiring diagram for Wireless Ward Environment Monitor
Loading diagram…

Gather all the parts

QtyComponent
1

DHT22

Digital temperature and humidity sensor

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Light Sensor Module V3 (LM393 photoresistor)

Light sensor module with a photoresistor and an LM393 comparator on a small blue board. It outputs an analog light-level voltage on AO and a digital signal on DO that switches low when the light is brighter than the threshold set with the onboard trimmer. It runs from 3.3 to 5 V and connects through a 4-pin 2.54 mm right-angle header (VCC, GND, DO, AO).

1

DHT22

Digital temperature and humidity sensor

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Light Sensor Module V3 (LM393 photoresistor)

Light sensor module with a photoresistor and an LM393 comparator on a small blue board. It outputs an analog light-level voltage on AO and a digital signal on DO that switches low when the light is brighter than the threshold set with the onboard trimmer. It runs from 3.3 to 5 V and connects through a 4-pin 2.54 mm right-angle header (VCC, GND, DO, AO).

1

DHT22

Digital temperature and humidity sensor

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Light Sensor Module V3 (LM393 photoresistor)

Light sensor module with a photoresistor and an LM393 comparator on a small blue board. It outputs an analog light-level voltage on AO and a digital signal on DO that switches low when the light is brighter than the threshold set with the onboard trimmer. It runs from 3.3 to 5 V and connects through a 4-pin 2.54 mm right-angle header (VCC, GND, DO, AO).

1

LCD 16x2 I2C

16x2 character LCD display with I2C backpack

1

Piezo Buzzer

Small passive piezo buzzer (TDK PS1240) for beeps, tones and alerts. It has no built-in oscillator, so drive one lead with a 3-30 V square wave from a microcontroller pin using tone() or PWM and connect the other lead to ground. It is loudest around 4 kHz and works from about 2 to 10 kHz; driving both leads in antiphase roughly doubles the volume.

1

SparkFun ESP8266 WiFi Shield WRL-13287

Stackable ESP8266 AT shield with onboard regulator and level shifting. Set UART switch to SW.

1

BSS138 Logic Level Shifter

Four-channel bidirectional level shifter with individually labeled channels.

Assemble it in 4 steps

1. Stack the Wi-Fi shield

With USB unplugged, align the SparkFun WRL-13287 headers with the Uno and seat the shield. Move its UART switch to SW. The header carries power, ground and the D8/D9 serial signals; do not duplicate these with jumpers.

  • Use the shield with factory 9600 baud AT firmware. A bare ESP8266 is not a drop-in replacement.

2. Wire the three temperature and humidity sensors

Connect each DHT22 to 3.3 V and common ground. Connect its DATA to the matching low-side shifter channel and add its 10 kΩ resistor from DATA to 3.3 V. Connect the matching high-side channels to D2, D3 and D4. Connect shifter LV to 3.3 V, HV to 5 V and GND to ground. Follow sensor labels rather than wire colors.

3. Wire the light sensors

Connect each photoresistor module to 5 V and ground. Connect AO to A0, A1 and A2 for wards 1, 2 and 3. Leave DO unused. Start with short wires and test each station before extending wiring.

4. Connect the display and alarm

Connect LCD SDA to A4 (data), SCL to A5 (clock), VCC to 5 V and GND to ground. Connect the passive piezo SIG to D6 and its other lead to ground. If the LCD lights up but text is faint, adjust the contrast screw on its backpack.

Review all connections

1. Connections between "dht1" and "Arduino"

Functiondht1Arduino
powerVCC3V3
groundGNDGND
dataDATA → BSS138 Logic Level Shifter LV1EXT

2. Connections between "pull1" and "Arduino"

Functionpull1Arduino
powerP13V3
digitalP2 → DHT22 DATAEXT

3. Connections between "ldr1" and "Arduino"

Functionldr1Arduino
powerVCC5V
analogAOGPIO 14
groundGNDGND

4. Connections between "dht2" and "Arduino"

Functiondht2Arduino
powerVCC3V3
groundGNDGND
dataDATA → BSS138 Logic Level Shifter LV2EXT

5. Connections between "pull2" and "Arduino"

Functionpull2Arduino
powerP13V3
digitalP2 → DHT22 DATAEXT

6. Connections between "ldr2" and "Arduino"

Functionldr2Arduino
powerVCC5V
analogAOGPIO 15
groundGNDGND

7. Connections between "dht3" and "Arduino"

Functiondht3Arduino
powerVCC3V3
groundGNDGND
dataDATA → BSS138 Logic Level Shifter LV3EXT

8. Connections between "pull3" and "Arduino"

Functionpull3Arduino
powerP13V3
digitalP2 → DHT22 DATAEXT

9. Connections between "ldr3" and "Arduino"

Functionldr3Arduino
powerVCC5V
analogAOGPIO 16
groundGNDGND

10. Connections between "lcd" and "Arduino"

FunctionlcdArduino
powerVCC5V
groundGNDGND
i2cSDAGPIO 18
i2cSCLGPIO 19

11. Connections between "piezo" and "Arduino"

FunctionpiezoArduino
pwmSIGGPIO 6
groundGNDGND

12. Connections between "wifi" and "Arduino"

FunctionwifiArduino
power5V5V
groundGNDGND
uartTXGPIO 8
uartRXGPIO 9

13. Connections between "shift" and "Arduino"

FunctionshiftArduino
powerLV3V3
powerHV5V
groundGNDGND
dataHV1GPIO 2
dataHV2GPIO 3
dataHV3GPIO 4

Deploy the firmware

#include <Arduino.h>
#include <DHT.h>
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>

// Demo limits; adjust after measuring normal conditions at each station.
constexpr int TEMP_MIN=18, TEMP_MAX=28, RH_MIN=30, RH_MAX=65;
constexpr int LIGHT_MIN=150, LIGHT_MAX=950; // raw analog counts, not lux
constexpr char SSID[]="WardMonitor";
constexpr char PASSWORD[]="WardDemo8266"; // change before deploying outside a bench demo
DHT dht[]={{2,DHT22},{3,DHT22},{4,DHT22}};
const uint8_t lightPins[]={A0,A1,A2};
LiquidCrystal_I2C lcd(0x27,16,2);
SoftwareSerial wifi(8,9); // Shield SW: Uno RX D8, Uno TX D9.
struct Reading { int t,h,l; bool valid,alarm; } readings[3];
char shown[2][17];
bool online=false;

bool waitFor(const char *token, uint16_t timeout) {
  uint32_t start=millis();
  size_t n=0;
  while(millis()-start<timeout) {
    if(!wifi.available()) continue;
    char c=wifi.read();
    n=(c==token[n])?n+1:(c==token[0]?1:0);
    if(!token[n]) return true;
  }
  return false;
}
void drain() { while(wifi.available()) wifi.read(); }
bool command(const __FlashStringHelper *cmd) {
  drain(); wifi.println(cmd); return waitFor("OK",700);
}
bool startWifi() {
  if(!command(F("AT")) || !command(F("ATE0")) || !command(F("AT+CWMODE=2"))) return false;
  drain(); wifi.print(F("AT+CWSAP=\"")); wifi.print(SSID); wifi.print(F("\",\""));
  wifi.print(PASSWORD); wifi.println(F("\",6,3"));
  if(!waitFor("OK",1800) || !command(F("AT+CIPMUX=0"))) return false;
  command(F("AT+CIPCLOSE"));
  return command(F("AT+CIPSTART=\"UDP\",\"192.168.4.255\",4210,4210,0"));
}
void publish() {
  char packet[180];
  int used=snprintf(packet,sizeof(packet),"ward,temp_C,rh_pct,light_adc,status\n");
  for(uint8_t i=0;i<3;i++) {
    const Reading &r=readings[i];
    if(r.valid) used+=snprintf(packet+used,sizeof(packet)-used,"%u,%d,%d,%d,%s\n",i+1,r.t,r.h,r.l,r.alarm?"LIMIT":"OK");
    else used+=snprintf(packet+used,sizeof(packet)-used,"%u,,,%d,FAULT\n",i+1,r.l);
  }
  Serial.print(packet);
  if(!online) return;
  drain(); wifi.print(F("AT+CIPSEND=")); wifi.println(used);
  if(!waitFor(">",350)) { online=false; return; }
  wifi.print(packet);
  online=waitFor("SEND OK",500);
}
void line(uint8_t row,char *text) {
  size_t len=strlen(text);
  while(len<16) text[len++]=' ';
  text[16]=0;
  if(strcmp(shown[row],text)) {
    lcd.setCursor(0,row); lcd.print(text); strcpy(shown[row],text);
  }
}
void setup() {
  Serial.begin(115200); wifi.begin(9600);
  lcd.init(); lcd.backlight();
  for(auto &s:dht) s.begin();
  lcd.print(F("Starting..."));
  delay(2200);
}
void loop() {
  static uint32_t last=0,retry=0;
  static uint8_t ward=0;
  static bool first=true;
  uint32_t now=millis();
  if(!first && now-last<3000) return;
  last=now;
  bool alarm=false;
  for(uint8_t i=0;i<3;i++) {
    float h=dht[i].readHumidity(), t=dht[i].readTemperature();
    Reading &r=readings[i];
    r.valid=isfinite(h)&&isfinite(t);
    if(r.valid){ r.h=lround(h); r.t=lround(t); }
    r.l=analogRead(lightPins[i]);
    r.alarm=!r.valid || t<TEMP_MIN || t>TEMP_MAX || h<RH_MIN || h>RH_MAX || r.l<LIGHT_MIN || r.l>LIGHT_MAX;
    alarm|=r.alarm;
  }
  if(alarm) tone(6,2400,250);
  const Reading &r=readings[ward];
  char a[17],b[17];
  if(r.valid) snprintf(a,sizeof(a),"W%u %dC %d%%",ward+1,r.t,r.h);
  else snprintf(a,sizeof(a),"W%u DHT fault",ward+1);
  snprintf(b,sizeof(b),"L:%d %s %s",r.l,r.alarm?"!":"OK",online?"WiFi":"--");
  line(0,a);line(1,b);
  ward=(ward+1)%3;
  if(first || (!online && now-retry>=30000)) { retry=now; online=startWifi(); }
  if(first || now-retry==0) Serial.println(online?F("UDP ready"):F("WiFi unavailable; check AT and SW switch"));
  first=false;
  publish();
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik