From 25de50d88d176affeab26bd3460d661e2096bf08 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Sun, 22 Feb 2026 22:06:09 +0100 Subject: [PATCH] readme cleanup --- README.md | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cff1cb3..d68d3bc 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,14 @@ # ESP32 Dual Machine Activity Notifier -This project turns an ESP32 into a smart device that monitors two machines (e.g., washer and dryer) using light sensors and sends notifications when a cycle starts and finishes. It also displays the current status on an OLED display. +This project transforms an ESP32 into a smart monitoring device. It uses two light sensors to track the activity of machines like a washer and dryer, sending notifications to your phone or desktop when a cycle starts and finishes. A local OLED display provides real-time status at a glance. ## Features - **Dual Light Sensing:** Monitors two separate devices using two BH1750 light sensors. -- **Status Display:** Shows real-time sensor data and device status on a small OLED display. -- **Notifications:** Sends start and stop notifications to a `ntfy.sh` topic. +- **Real-time Status Display:** Shows current sensor data and machine status on a 128x64 SSD1306 OLED display. +- **Push Notifications:** Sends instant start and stop notifications via a self-hostable `ntfy.sh` topic. - **WiFi Connectivity:** Connects to your local WiFi network. +- **Non-Blocking Logic:** Uses `millis()` for timing, ensuring the device remains responsive. ## Hardware Requirements @@ -16,18 +17,29 @@ This project turns an ESP32 into a smart device that monitors two machines (e.g. - SSD1306 128x64 OLED display (I2C) - Breadboard and jumper wires -## Pinout +## Wiring and Connections + +All components use the I2C communication protocol, which conveniently allows them to share the same data (SDA) and clock (SCL) lines. + +### I2C Address Configuration + +To use two BH1750 sensors on the same I2C bus, they **must** have different addresses. This is a critical step. + +- **Sensor 1 (Address `0x23`):** Connect the `ADDR` pin to `GND`. This sets the address to the default `0x23`. +- **Sensor 2 (Address `0x5C`):** Connect the `ADDR` pin to `3.3V`. This changes its I2C address to `0x5C`. + +### Pinout Table | Component | Pin on ESP32 | Notes | | ------------------- | ------------ | ----- | -| I2C SCL (OLED, Sensors)| GPIO 22 | Shared bus | -| I2C SDA (OLED, Sensors)| GPIO 21 | Shared bus | +| I2C SCL (OLED, Sensors)| GPIO 22 | Shared I2C Clock Line | +| I2C SDA (OLED, Sensors)| GPIO 21 | Shared I2C Data Line | ### Wiring Diagram ``` +-----------------+ +-----------------+ +-----------------+ -| ESP32 Dev Board | | BH1750 Sensor | | OLED Display | +| ESP32 Dev Board | | BH1750 Sensors | | OLED Display | +-----------------+ +-----------------+ +-----------------+ | 3.3V |---------->| VCC |----->| VCC | | GND |---------->| GND |----->| GND | @@ -58,8 +70,11 @@ This project turns an ESP32 into a smart device that monitors two machines (e.g. - Click the upload button. 4. **Deploy the Device:** - - Place Sensor 1 inside the first machine (e.g., Washer) to detect internal light. - - Place Sensor 2 inside the second machine (e.g., Dryer) to detect internal light. + - Make the connections according to the wiring diagram, which is quite simple. All 3 peripheral devices communicate over I2C, which lets them share the same 4 wires. + - Place Sensor 1 & 2 on the respective machines such that they only detect light when the device is running. This is specific to each monitored device. The "Start/Stop" button LED is a great candidate for this. + - Make sure to block off any ambient light that might interfere with whatever you're monitoring (e.g. by using a tape). + - Tip: wire the sensors using connectors, so that you can later disconnect the main unit (e.g. for a firmware update) without having to remove the sensors from the monitored machines. + - Tip: use a power socket with a switch to enable/disable the monitoring as needed ## Code Explanation