You are browsing as a guest. Sign up (or log in) to start making projects!

Grid watcher

Hardware
  • 4 Devlogs
  • 7 Total hours

Grid Watcher uses an ESP32 C6 and ZMPT101B to monitor 50 Hz grid health. Waveform data is streamed to a refurbished old phone running Termux (acting as a local FastAPI broker), then forwarded to a PC hosted ML model that detects pre blackout signatures, voltage sags, and frequency disruptions. Using this data, the phone triggers SMS alerts via its own cellular connection. Future plans include a modular stacked PCB, IR home automation integration, and self improving OTA ML updates.

Open comments for this post

52m logged

i’m back from holiday and man I must say, I missed this, today I must say I was kinda lazy with it right I’ve just come back from being in nature now I must do this? Yeah bro chalk it. Anyhow Deepseek pretty much made the core of the ML Python script which waits for the CSV file the ESP32 generates throughout the day which contains timestamps voltage frequency as well as the outage label (AC on or off) auto cleans the supposed Data from raw numbers to multiple trained models compares them and saves the best one. Nerd mode here btw. when the csv file is detected it uses python’s time and os modules as well as pandas for reading since I might change the format later the script asks for timestamp voltage frequency and label then it does the data cleaning it removes all physically impossible values (voltage must be between 50V and 300V and frequency must be between 45Hz and 65Hz) anything outside those ranges is considered as sensor faults and is dropped and removed. raw sensor readings alone aren’t enough the models need “clues” the script auto makes dozens of features from voltage & frequency (Rolling averages (last 5, 10, 30 samples) – smooths noise and shows trends, Rolling standard deviation – how unstable the signal is, Rolling min / max – worst-case recent values, Difference (rate of change) – how fast voltage is dropping/rising, Lag features – what the value was 1, 2, 3 seconds ago) all these assist in detecting patterns used pandas rolling and shift operations NumPy just chilling in the background. The data is split into two sets: Training set (80%) the model learns from this, Test set (20%) used to evaluate the model on data its never seen. This all prevents “cheating” and gives a more realistic performance estimate scikit-learn is used to handle this. After that the script trains four different machine learning models: Random Forest, XGBoost, LightGBM, and Extra Trees. For each model it uses Optuna to auto-tune hyperparameters like number of trees, tree depth, and learning rate, trying lots of combinations to find the best settings. Then every model gets tested on the 20% hold-out data using metrics like accuracy, precision, recall, and F1 score. The model with the highest F1 score wins and gets saved as best_model.joblib in the models folder along with a feature_names.json file and a latest_report.txt. The whole script keeps watching the incoming_data folder every 5 seconds and whenever a new CSV lands it re-runs the entire pipeline so the prediction model continuously improves without me lifting a finger. This means by the time I have real ESP32 outage logs the system will already be ready to learn my home’s power signature and get smarter every day.

0
0
2
Open comments for this post

2h 50m 23s logged

Devlog 3: GitHub repo and Demo code

Okay today was all about getting my GitHub set up and making a demo code to show off as a demo unit to see how all three devices speak to each other. So far I’ve only gotten the ESP32 (one I had lying on a shelf) and my old phone that runs Termux to speak. Using that opportunity, I’m generating fake sine waves and voltage to test the dashboard (Thanks Deepseek).

I spent most of the day writing the actual README for my GitHub repo (you can find it on the project link now!). I said I was going to find caps for the PCB, I haven’t forgotten about that, nor have I for the PCB design. I think I want to wait for that for when I get my prototype parts, as the datasheets are helpful but not when it comes to footprints (read my GitHub README on why I won’t continue for now😉).

Anyway, I’ll be on holiday for the rest of the week and I’ll only be back on Monday, so I won’t be posting devlogs due to the 15 minutes of Hackatime. But I’ll be brainstorming and reading more in that time. As soon as I’m back I’ll post a devlog. Here are some pictures of the dashboard and the GitHub repo.

0
0
2
Open comments for this post

2h 23m logged

Devlog 2: More design

Okay, lots more done today. I got my PCB into a more breakable version that splits in two after manufacturing. It has slits that you can cut/break, and it becomes two boards.

The bottom of the board contains all the power supplies and high-voltage stuff (ZMPT101B, HLK-10M05, MT3608 module) just to keep it separated. Think of it as a hotswap modular system where you can swap out parts and keep it all in the same design to upgrade for future access or easy repair. This is the same reason I’ve added a step-up module for devices that run on higher than 5V, for future-proofing.

Then, the upper module houses the FireBeetle 2 ESP32-C6. Right now, it’s very empty, but that’s what’s great about these modules. I don’t have to completely redo the entire power supply because a wrong-rating resistor is on I just need to update the ESP module instead of the entire thing, saving costs later down the road when doing proper R&D.

Because of this design choice, you can also add different modules, like a relay chain, as I mentioned in Devlog #1. Something like an M5Stack or D1 Mini hat. And that’s where I’ve hit a small “roadblock”. I can easily add extra pins on top of the ESP module, as it goes PSU → ESP → etc., but after a few devices, it gets large and tall. That won’t be too fun for a “discrete” device that’s just supposed to measure the frequency of the grid to predict power outages later in the project.

The ESP32 hat is looking bland. Yes, it’s not supposed to be flashy, but it feels like I’m wasting the potential of the FireBeetle by just using one for AC sensing and voltage. Yes, it has a built-in BMS that I’ll be using, yet it still feels like a waste. I have many great ideas about this project already, but I need to contain myself, as the core of the project hasn’t even been done yet.

I’ve been quoted $5 for the PCB and $80 for assembly. I might have to go with through-hole as I originally wanted, but I’m still sourcing the caps I need, so that’s what I will mainly focus on tomorrow, as well as making the first part of the server.

Closer towards the end of the month, I’ll get funds for the first perf-board prototype. Super excited for that, as it will be the first working proof of concept, so I can hopefully get some sponsors. If not, that’s fine—it will just take longer.

TODO List
-Source the 1µF ceramic capacitors locally
-Finalize the decision between through-hole and SMD assembly for the PCB
-Secure funds for the first perf-board prototype build
-Start coding the first part of the FastAPI server on my PC
-Wait for the parts to arrive from Micro Robotics
-Assemble the physical proof-of-concept and record the first live SMS test

Ive also found some old pictures of the very first version that i started in late may early june i didnt record much of it but did take photos for my instagram insta and phtos of old versions attached
@o.nly_mason

0
0
1
Open comments for this post

1h 0m logged

Devlog #1: The PCB PivotI ’m busy designing the PCB for testing right now. I’ve already made a fully functioning PCBA prototype, but I was quoted $220 for the assembly… Yeah, no. I’m not paying that. So, I’m switching to a design where I can hand-solder everything. Most of it will come as pre-built modules that I just solder onto the board, along with some SMD circuits for the smaller stuff. That layout might change depending on sourcing—I might just get a PCBA done for the tiniest caps and resistors, because those are a nightmare to source here in South Africa without paying a premium for an entire reel.Honestly, I’m toying with the idea of a stacked design. Keep the high-voltage stuff on the bottom layer, and the ESP on top. I’m using the ESP32-C6 FireBeetle 2 because of its built-in battery charger and IR blaster—I think it’s cooler to have it talk to other FireBeetles or IR devices around the room. I actually have an old TV box running Linux that needs an IR remote, which seems like a fun integration.Anyway, I’m getting out of hand. I might design a PCB that physically breaks off, allowing me to stack expansion cards on the upper deck—kind of like an M5Stack or D1 Mini shield. But the main focus right now is just waiting for payday so I can order the prototype parts and at least get a proof-of-concept running. I’ll carry on with the design tomorrow. I would have kept going tonight, but I have work in the morning. It’s 1:20 AM by me right now, so… GG’s. pic of well ending PCB design not as pretty as my second model but i learned the hard way of what a pretty board costs.

0
0
26

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…