This is an old revision of the document!
The baby monitoring system provides a way for parents to track the baby's sleeping environment by tracking the light levels, the sound and the temperature. When a certain threshold is reached the system alerts the parents by email. The system also stores the sensor data and generates weekly reports for the parents.
2 pins are used for the 2 sensors: 4 and 34
#define DHTPIN 4 #define DHTTYPE DHT11 #define SOUND_ANALOG_PIN 34
Sensor reading and writing
void sendSensorData() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
int soundLevel = analogRead(SOUND_ANALOG_PIN);
if (isnan(temp) || isnan(hum)) {
Serial.println("Failed to read from DHT sensor");
return;
}
Serial.printf("Temp: %.1f °C | Humidity: %.1f %% | Sound: %d\n", temp, hum, soundLevel);
Blynk.virtualWrite(V1, temp);
Blynk.virtualWrite(V2, hum);
Blynk.virtualWrite(V3, soundLevel);
Event generation
if (temp > 21) {
Blynk.logEvent("high_temperature", "Temperature too high!");
Serial.println("Temp big enough");
}
if (hum < 30) {
Blynk.logEvent("low_humidity", " Humidity too low!");
}
if (soundLevel > 40) {
Blynk.logEvent("high_noise", "High noise level detected!");
}
}
Blynk is a tool that lets you build and manage your own IoT projects easily. It was used to create custom dashboards on the desktop and mobile app.
With it I added gauges that I dragged onto the screen and use to control or check the devices from anywhere. Blynk connects everything over Wi-Fi, so you get real-time updates and control without needing to mess with complex setups. It was used to alsop send notifications over email and in-app
DHT11 Sensor:
Sound sensor:
Drawio: https://app.diagrams.net/ Blynk: https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk