https://anneryeo.github.io/DS169_IOT/ -- DHT11 Sensor Dashboard Visualization
- For breadboards...
- Each row is 123, each column is A to J, from center trench.
- When there is a wire plugged in A-1, B to J-1 will be electrically connected.
- ESP32-WROOM-32 - 3.3V logic
- DHT-11 Sensor - 3.3V
- MQ135 - 5V (derive from micro-USB/C from VIN/5V/VU pin from ESP32 board)
When using a breadboard, which I am, it will be female-male jumper wires connected to the corresponding row of the male pin of the ESP32 board. What I did was to color-code the wires for its purposes. Which means, GND wires = black, or something.
| DHT11 Pin | Wire to ESP32 Pin | Purpose |
|---|---|---|
| VCC(or +) | 3V3 (Power) : Red | Provides 3.3V power. |
| GND(or -) | GND (Ground) : Blue | Completes the circuit. |
| DATA(or OUT) | GPIO 4 (D/P 4) : Green | Sends the digital temperature/humidity signal. |
| MQ135 Pin | Wire to ESP32 Pin | Purpose |
|---|---|---|
| VCC | VIN (or 5V) : Red | Provides the 5V needed for the heating element. |
| GND | GND : Blue | Completes the circuit. |
| A0(Analog Out) | GPIO 34 (D/P 34) : Yellow | Sends the raw analog voltage based on gas concentration. |
| D0(Digital Out) | Leave Disconnected | Only used for simple high/low triggers; we need the raw analog data for$eCO_2$math. |
- Go to Sketch -> Include Library -> Manage Libraries
- DHT Sensor Library by Adafruit
- Install all dependencies (like Adafruit Unified Sensor)
- Board = DOIT ESP32 DEVKIT V1
- Tools -> Port; Select COM port according to your USB-C
- Set Serial Monitor to 115200 baud
- Use test.ino in \backend
- Upload test.ino code
- When connecting, click Boot (not EN)
- Error 1: Change Upload Speed from Tools -> Upload Speed -> 921600 to 115200
- Cause the cheap duplicate ESP32-WROOM can't handle the massive amount of data transfer at the speed that Arduino can do.
- Unplug MQ-135 5V Wire if error during test upload. This happens sometimes because of the power hunger of the sensor.
- "ERROR: Write failed, written flash region is empty." : Change Board to ESP32 Dev Module -> Change Flash Mode to DIO from default QIO; double check upload speed to still be 115200.
- Unplug 5V if persistent invalid header error when all settings, wires are correct. Sometimes it's just a power supply problem.
- Error 1: Change Upload Speed from Tools -> Upload Speed -> 921600 to 115200
This replaces the old MQTT → Node-RED pipeline with a direct ESP32 → Google Sheets approach.
ESP32 (Ambify_GoogleSheets.ino)
│ HTTPS GET with sensor params
▼
Google Apps Script (GoogleAppsScript.gs)
│ Appends row to spreadsheet
▼
Google Sheets ("Ambify Sensor Data")
│ Also serves as a JSON API
▼
React Native App (useSensorData hook)
│ Polls every N minutes
▼
MainDashboard / ProductivityScreen
- Create a new Google Sheet — name it "Ambify Sensor Data"
- Add headers in Row 1:
A B C D Timestamp Temperature (°C) Humidity (%) CO₂ (ppm) - Go to Extensions → Apps Script
- Delete default code, paste entire contents of
backend/GoogleAppsScript.gs - Deploy → New deployment
- Type: Web app
- Execute as: Me
- Who has access: Anyone
- Copy the deployment URL (looks like
https://script.google.com/macros/s/XXXX/exec)
- Open
backend/Ambify_GoogleSheets.inoin Arduino IDE - Fill in at the top:
WIFI_SSID— your WiFi network nameWIFI_PASSWORD— your WiFi passwordGOOGLE_SCRIPT_URL— the deployment URL from step 1.6
- Adjust
LOG_INTERVAL_MINUTES(default: 2 minutes) - MQ135 simulation is ON by default (
SIMULATE_MQ135 = true)- Edit
SIMULATED_CO2_VALUES[]to demo any ppm levels - Set to
falsewhen you have a working MQ135
- Edit
- Upload: Board = ESP32 Dev Module, Flash Mode = DIO, Upload Speed = 115200
- Open
src/utils/sensorData.ts - Set
GOOGLE_SCRIPT_URLto the same deployment URL - Adjust
POLL_INTERVAL_MSif needed (default: 2 minutes) - That's it —
MainDashboardandProductivityScreenwill auto-switch to live data
| Where | What | How |
|---|---|---|
.ino line ~68 |
SIMULATED_CO2_VALUES[] |
Add/edit ppm values the ESP32 cycles through |
.ino line ~78 |
SIM_TEMPERATURE / SIM_HUMIDITY |
Override DHT11 for desktop demo |
.ino line ~43 |
LOG_INTERVAL_MINUTES |
Change logging frequency (1–5 min) |
ProductivityScreen.tsx |
PRACTICE_LEVELS array |
Demo values when no live data |
MainDashboard.tsx |
PRACTICE_LEVELS array |
Demo CO₂ values when no live data |
co2Utils.ts |
getCO2UIData() thresholds |
Change color/label breakpoints |
- After uploading to ESP32, open Serial Monitor (115200 baud)
- You should see WiFi connection, then readings + HTTP 200 responses
- Check your Google Sheet — new rows should appear every N minutes
- In the app, the circle (MainDashboard) and bento cards (ProductivityScreen) will update from the sheet
