milk vending iot

an automated milk dispensing system built around the esp32. the idea came from watching how milk distribution works in local dairy setups — mostly manual, often inconsistent, hard to track.

the hardware side: flow sensors to measure exactly how much milk gets dispensed, solenoid valves to control the flow, and a small lcd display showing the transaction status. getting food-safe components was harder than expected. most off-the-shelf flow sensors aren't rated for dairy, so finding ones that wouldn't contaminate the product took some research.

payment works through qr codes. customer scans, selects quantity, pays — and the system dispenses. the backend runs on firebase, handling authentication, transaction logging, and real-time sync between the vending unit and the monitoring dashboard.

the monitoring dashboard shows live data. how much milk has been dispensed, remaining stock, transaction history, any sensor anomalies. built it as a simple web interface that the dairy operator can check from their phone.

connectivity was one of the bigger challenges. these units sit in areas where wifi isn't always reliable. had to implement offline queueing — the esp32 stores transactions locally and syncs when connection comes back. also dealt with power fluctuations, which meant adding proper voltage regulation and a small ups circuit.

designed a 3d-printed enclosure for the electronics. needed to keep water and dust out while still allowing access to the display and qr scanner. went through three iterations before getting the fit right.

the circuit design went through several revisions too. separating the high-current solenoid control from the sensitive sensor readings, proper grounding, debouncing the flow sensor signal. the kind of things that don't matter on a breadboard prototype but become critical when you're deploying for actual use.

deployed a test unit in a local dairy context. watching real users interact with it taught me more about embedded system design than any tutorial could.