r/Esphome

Dual-Zone Peltier Cooler Controller (ESPHome / ESP32) - Architecture and Logic Review
▲ 12 r/Esphome+2 crossposts

Dual-Zone Peltier Cooler Controller (ESPHome / ESP32) - Architecture and Logic Review

I am building a dual-zone Peltier wine fridge cooling controller using ESPHome on an ESP32. The system regulates two separate thermoelectric cooling (TEC) modules powered by a 13.0V to 14.4V Solar/LiFePO4 battery bank. A Shelly Gen4 unit handles the high-level power control to the main busbars, and the ESP32 receives dedicated power via a USB-C PD board. I am unfortunately at least 2x the cost to replace the darn thing, but I wanted to run the fridge natively on available DC instead of having the inverter run 24x7 to drive dedicated AC 220v controller boards - and one of the original controller boards was fried and driving the zone down to 2°C continously. The fridge was a gift from a good friend who suddenly passed away last January, so I'm defo keeping it...

The primary goal is independent or synchronized thermal management for two zones, using an OLED display and a physical rotary encoder for local management, paired with an MQTT integration into Home Assistant.

The core hardware configuration, current software design, and roadblocks are detailed below. AI disclosure - I have used Gemini to support coding based on my design and components available.

The Hardware Stack

  • Overall power 13.0-14.4v from LiFEPO4 system
  • Shelly Gen4 handling main power control to busbars
  • ESP32 Power supplied thru USBC PD board
  • ESP32 USBC 38-pin
  • 2x Monster Moto controllers, one for each TEC unit, actively cooled
  • 4x NTC thermistors on inside/outside of TEC plates, 10k pullups
  • 3x Dallas DS18B20 3-wire thermal sensor

Control and Actuation: The brains of the operation is a 38-pin ESP32 development board. Actuation is handled by two Monster Moto controllers (one per TEC module) that are actively cooled.

Power Delivery: The system is strictly configured for cooling only. Polarity switching is not planned. Because TEC modules do not tolerate raw high-frequency PWM well, a downstream low-pass filter consisting of a smoothing coil and a 6800uF capacitor is placed after the Moto controller outputs. The LEDC base frequency is configured to 10kHz.

Sensors: Thermal monitoring relies on two distinct sensor types. Four 10k NTC thermistors with 10k pullup resistors track the internal cold plates and the external warm-side heatsinks for both zones. Three Dallas DS18B20 1-wire sensors handle auxiliary monitoring: two sit directly under the Monster Moto MOSFET chips to monitor driver temperatures, and one monitors ambient air temperature under the chassis.

Logic, Safety Watchdogs, and UI State Machine

The firmware uses the ESPHome native PID climate platform to adjust the LEDC output level, capped at a maximum duty cycle of 80%. To filter out voltage noise on the analog lines, all NTC sensors use a median filter window.

Because a thermal runaway or a frozen controller can quickly destroy the components, the code enforces strict safety limits. The system drops into a hard `ERROR` state and cuts PWM duty cycles to 0% if the warm heatsinks exceed 60°C, the Moto drivers exceed 60°C, or an NTC sensor persistently (3 strikes concept) drops offline. There is also a runaway watchdog: if a zone calls for more than 70% power for 5 minutes straight without achieving at least a 2°C temperature drop, the system trips.

The physical interface uses an SH1106 1.3-inch OLED display driven by an internal state machine (`ui_state`). It manages the transitions between:

  1. NORMAL: Displays alternating zone metrics or synchronized statistics.
  2. SET_MODE: Toggles between independent zone control and `SYNC` mode.
  3. SET_TEMP_Z1 / SET_TEMP_Z2 / SET_TEMP_SYNC: Dedicated target temperature adjustment windows using a rotary encoder.

Problems Overcome and Dead Ends

Building this out highlighted several edge cases that required architectural revisions:

Persistent Boot Loops: Storing the system state in persistent global memory introduced a dangerous edge case. If the system crashed due to a critical hardware fault (like a disconnected NTC sensor), it would reboot, attempt to initialize the PID loop in the last known active state, immediately fault out, and restart again. This was resolved by intercepting the boot sequence using a custom `on_boot` lambda. If an `ERROR` flag is detected in flash memory, the standard initialization bypasses the operational loops entirely, keeping the PWM lines firmly locked at zero until a manual reset is triggered.

Circuit Protection Deficiencies: Early iterations exposed the vulnerability of the switching components to voltage spikes generated by inductive feedback. Inductive loads on the driver outputs required proper flyback protection. Implementing dedicated diode protection across the output paths resolved the risk of punching holes through the switching hardware.

Level Shifter Assumptions: Initial designs factored in hardware level shifters for the LEDC outputs to the driver boards. Bench testing proved that the ESP32 pins (GPIO4 and GPIO13) can trigger the logic gates cleanly without the added latency and complexity of unnecessary shifting components.

The Error State Trap: Once the watchdog tripped into an `ERROR` mode, the system locked down. Originally, clearing this required an MQTT command or a full power cycle. This was fixed by mapping a multi-purpose physical hardware escape route via the `Run Mode` button logic. If the system is bricked in an error state, a physical press acts as a diagnostic reset, clearing the global error code back to 0 and restoring `STANDBY` mode.

Current Status and Areas for Input

The MQTT reporting and remote target configurations work correctly for individual zones. The local display properly switches between languages and states based on user interaction arrays.

I am looking for feedback on a few areas:

  1. PID Tuning: The current tuning constants are `kp: 0.02`, `ki: 0.0005`, and `kd: 0.03`. Given the high thermal mass of the cooler chassis combined with the filtering lag of the low-pass LC network, what are the best practices for tuning ESPHome's PID component to minimize overshoot without causing cyclic hunting?
  2. State Machine Optimization: Managing five distinct UI states and dual-loop sync logic purely inside ESPHome lambdas is getting dense. Are there cleaner ways to structure conditional menus and button-hold actions without writing excessive inline C++ within the YAML file?
  3. Failsafe Operation: What other failsafe concepts can I add to ensure that the system can operate unattended for days, reporting back regularly to my Home Assistant system on health and overall operation. I am most concerned about thermal runaway and/or a fried component staying in the "on" state - hence using the multiple kill switches and Shelly Gen4 as a last resort.

Looking forward to hearing your thoughts or seeing similar control loops you have built. I can share the HA ESPHome YAML separately or DM if you are interested. Edit - formatting.

u/800ASKDANE — 7 hours ago
▲ 226 r/Esphome+1 crossposts

I overengineered an air quality sensor because the commercial options didn't cut it for me. Custom PCB, open source hardware ;)

I built a custom 4-layer PCB with SCD41, SGP41, SHT40 and BMP280, running ESPHome. Sensor fusion, air quality score, configurable thresholds, three isolated power rails. Making it public in case anyone wants to build one.

https://github.com/roepkefeller/air-quality-sensor

Usually I don't show my projects online (IP/industry stuff, the kind of hardware I am developing is pretty closed source..), so I'm very interested in some thoughts! If anyone builds this board please let me know haha. I'm also happy to answer some questions!

u/carloroepke — 1 day ago

Connecting HA to a TUF-2000M flow meter with ESPHome

Hey all - brand new to ESPHome and hoping someone can point me in the right direction.

Also brand new to Home Assistant, which is what brought me to ESPHome.

I have managed to flash my ESP-32 with ESPHome, and connected the ESP-32 to the TUF-2000M flow meter with a MAX3485 TTL to RS485 Converter Module. I also have it connected to Home Assistant but only one of my sensors is getting data I can make sense of. I am getting good readings on the flow rate, but not on the Positive accumulator.

Here is what I coded and below that are the MODBUS register descriptions from the manual.

Is my problem related to the value_type in the sensor and that the flow meter is splitting the value into an integer part and a decimal part? I likely need the entire value including the decimal portion. Is this more of a Home Assistant question?

Hope I am using the correct terms - I am 100% unfamiliar with most of this! 😂

esphome:
  name: esphome-web-268a5c
  friendly_name: ESPHome 001
  min_version: 2026.4.0
  name_add_mac_suffix: false

esp32:
  variant: esp32
  framework:
    type: esp-idf

# Enable logging
logger:

# Enable Home Assistant API
api:

# Allow Over-The-Air updates
ota:
- platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: TUF2000M Fallback Hotspot
captive_portal:

uart:
  id: uart_1
  tx_pin: 16
  rx_pin: 17
  baud_rate: 9600
  stop_bits: 1
  parity: NONE

modbus:
  id: modbus_1
  uart_id: uart_1
  send_wait_time: 1000ms

modbus_controller:
  id: tuf2000m
  address: 0x1
  modbus_id: modbus_1
  setup_priority: -10
  update_interval: 10s

  # Individual sensors
sensor:
  - platform: modbus_controller
    modbus_controller_id: tuf2000m
    name: flowmeter
    id: flow
    register_type: holding
    address: 0x1
    register_count: 2
    response_size: 2
    accuracy_decimals: 3
    value_type: FP32
    unit_of_measurement: m³/h
  - platform: modbus_controller
    modbus_controller_id: tuf2000m
    name: Positive_Accumulator
    register_type: holding
    address: 0x9
    register_count: 2
    value_type: FP32
    device_class: water
    state_class: measurement
    unit_of_measurement: m³

Here is what I think is related info from the manual...

MODBUS registers

Notes from end of MODBUS registers table

reddit.com
u/Microfiche62 — 1 day ago
▲ 10 r/Esphome

Anyone using Fable 5 or GPT 5.6 against Tuya firmware dumps to make them ESPHome flash-able with tools like Cloudcutter?

Fable 5 an GPT 5.6 are relatively new, but wanted to ask if anyone had experimented with using SOTA LLM models to identify exploits for tools like Cloudcutter?

Hoping the community can liberate more of these Realtek/Becken chips to ESPHome.

Here are some firmware dumps.

reddit.com

Noob ESP32 flashing problems

Hi. I have ESP32-C3 And I'm able to successfully flash it over USB and connect to Wi-Fi using https://esphome.io/projects/

But then when I install ESPHome Device Builder and want to flash it over USB with basic settings just to connect to the Wi-Fi it's not finding network.

I'm using a mac with Tahoe OS

Yaml:

https://paste.ofcode.org/RRSFjGWvx4iDi8xMXAVxFD

Flash log:

https://paste.ofcode.org/7WMHGaUTncXnUCc5H9hvvb

Init log:

https://paste.ofcode.org/iVLHHEr4e3XFhtWTPU6QFF

What am I doing wrong? Please help. Thank you

▲ 98 r/Esphome

Auto start stop eliminator

I refuse to pay 50 bucks for something that has less than five star reviews, when I can build it at home. The output of this relay gets wired parallel to the mechanical push button on the dashboard that cancels my auto start stop function. Bonus part is the ds18b20 sensor that will monitor my temperature while my car is warming up in the driveway during winter months. This temperature controls LED lights in my living room and den that indicate the car's temperature while it is running.

u/duckredbeard — 4 days ago
▲ 95 r/Esphome+1 crossposts

We built a flower-shaped ESP32 light sensor that automatically adjusts monitor brightness 🌼

My sister and I have been working on a small open-source project built around an ESP32.

The idea was simple: instead of another tiny black ambient light sensor on the desk, why not turn it into something that actually looks like part of the workspace?

So we built LumaBloom.

The light sensor is hidden in the center of the flower and continuously measures ambient light, while the desktop application adjusts the brightness of all connected monitors over USB.

My sister wrote the firmware and desktop software, while I designed the hardware and the fully 3D printable enclosure.

Current features:
• ESP32-based
• USB connection
• Ambient light sensing
• Automatic brightness adjustment
• Supports multiple monitors
• Fully 3D printable enclosure
• Customizable petal and pot colors
• 100% open source

We're still adding new features and would love to hear ideas from the ESP32 community.

If you were building something like this:
- Which light sensor would you choose?
- Would you add wireless connectivity (Wi-Fi/BLE) or keep USB-only?
- Any features you'd like to see?

GitHub:
https://github.com/mkdsfm/LumaBloom

u/Ok_Stress3654 — 4 days ago
▲ 209 r/Esphome

Made This Device to Convert Existing Cordless Shades to esp32 Based Motorized Ones

Hi all, this is my take on a way to automate regular old cordless shades as cheaply as possible. It's based around a cheap aliexpress brushless motor and an esp32. It is capable of accurate positioning and uses a reed switch at the top to reestablish home each time the shade is fully opened.

The total cost of this thing ends up around $25 if you buy stuff in bulk and build 4-5. If you are interested, here is the project page on makerworld.

https://makerworld.com/en/models/2995199-motorized-roller-shade-for-esphome#profileId-3362226

Let me know what you think!

u/acornboy1937 — 5 days ago

I'm thinking of making my blinds smart using a NEMA 17 stepper motor and an ESP32. My blinds are controlled by a beaded chain (thread with beads).Can anyone recommend a good DIY project, GitHub repository, Thingiverse/Printables model.

reddit.com
u/Resident_Cranberry_6 — 5 days ago
▲ 42 r/Esphome+3 crossposts

Ich habe eine Home Assistant Integration für mein Hydroponik-Setup gebaut — kein YAML nötig

Hey,

ich betreibe zuhause einen hydroponischen Tower Garden und habe immer wieder
die gleichen Automationen geschrieben — Bewässerungstimer, Lichtplan,
Trockenlaufschutz wenn der Tank leer wird, Leckerkennung... Das wurde
schnell unübersichtlich.

Also habe ich eine richtige Home Assistant Integration gebaut, die das alles
über die UI erledigt. Kein YAML, kein AppDaemon, kein Node-RED. Einfach über
HACS installieren, Pumpen-Steckdose, Licht und Sensoren auswählen — fertig.

**Was sie kann:**
- Bewässerungszyklus (Pumpe X Min an / Y Min aus), live anpassbar
- Licht-Photoperiode mit automatischer Mitternachts-Behandlung
- Trockenlaufschutz — Pumpe läuft nie wenn der Tank leer ist
- Überschwemmungs-/Leckerkennung mit sofortigem Pumpen-Stopp
- Wassertemperatur-Überwachung mit optionaler Lüfter-/Heizungssteuerung
- Pumpenfehler-Erkennung (prüft echten Stromverbrauch nach dem Einschalten)
- Modi: Automatik, Manuell, Wartung (läuft nach 2h automatisch ab), Urlaub

Funktioniert mit jeder Hardware — Tuya, Zigbee, ESPHome, MQTT, WLAN.
Die Integration liest einfach deine vorhandenen HA-Entitäten, du brauchst
keine spezielle Hardware.

GitHub: https://github.com/DDA1010/hydroponic-control

Freue mich über Feedback, besonders von Leuten die NFT, DWC oder Tower
Garden Setups betreiben. Fragen gerne!

u/FaithlessnessBig9458 — 5 days ago
▲ 20 r/Esphome

ESP E-Ink Display for weather and sensors on Home assistant

u/cowreto — 5 days ago

Regarding the inability to connect the TUYA device, please use ESPhome instead.

As the title says, I found this smart socket while organizing my warehouse, but it can't be paired successfully. It seems to be unauthorized. I remember it used to work, but it doesn't work now. Is there any way to fix it?
Do you think it's feasible to link ESPhome with HA? Do you have any suggestions or solutions?

u/DenseVictory8375 — 6 days ago
▲ 1.5k r/Esphome+3 crossposts

Samsung to Charge Users $5 per month for API Access - Home Assistant Integration Affected

Power users who built SmartThings integrations using webhook-based SmartApps for their own homes are getting caught in this including the Home Assistant integration.

These aren't apps being sold or shared. Samsung already removed the ability for personal SmartApps to be shared with other users, so these integrations are tied to a single account and exist solely to automate that user's own devices.

Now the new plan is $5/month from individual users for something that does maybe 1,000 API calls a month.

Paying $60/year just to receive webhook events from my own smart home has to be one of the dystopian decisions only samsung can come up with. Literally a FUCK YOU CHARGE

"Why am I paying $60 a year for webhooks?"

Samsung: "Because fuck you, that's why."

https://community.smartthings.com/t/a-new-enhanced-smartthings-api-experience/309947

UPDATE: The post seemed to have triggered some bots, Comments are getting downvoted potentially to hide them. Please make sure to read and upvote other user's comment if you feel they are raising valid concerns and points.

u/argorain — 9 days ago
▲ 24 r/Esphome

Wall mount for 10.1-inch Guition Esp32 JC8012P4A1

“She may not look like much, but she’s got it where it counts, kid.”

Just wanted to share the wall mount I made for the 10.1-inch Guition Esp32 Screen, just press fit the screen in, it's got a cable hole and screw holes for mounting. If anyone tries it and has feedback, I'd love to hear from you. Thanks!

Link

u/hometechgeek — 6 days ago
▲ 105 r/Esphome

Custom modal for lights and blinds in espcontrol

I've just add modal views for lights and covers, planning on adding more in the coming weeks to espControl, a no code, super easy to configure smart home controller for home assistant...

  • New modal controls: Added dedicated modals for lighting and covers, so all controls can be access from a single card. Content and tab orders are customisable, and will match your device capabilities.
  • Voice support improvements: Expanded media codec handling, voice services settings, clearer microphone status icons, and a sound when voice input is not recognized (thanks salnajjar)
  • Improved time handling: Now supports Home Assistant auto timezone, so devices can follow the active Home Assistant timezone more reliably (thanks nebulight)
  • Improved cover art behavior: Smoother interactions, fixes for artwork refreshes, touch dismissal timing, transition blanking, replacement flicker, and Home Assistant proxy errors.
  • Translation improvements: Expanded coverage and Modern Greek glyph support added (thanks konikos).
  • Improved alarm arming screens: Countdown visible, use clearer colors and lots small fixes (thanks hunter-nl)

EspControl supports a range of screens from the cheap but great £20 S3 4inch screen, to P4 based 4inch7inch and 10inch screens. 

Thanks to everyone trying it, filing bugs and sharing ideas for improvement. All feedback is appreciated. Cheers!

Docs / Github / Installer

u/hometechgeek — 9 days ago
▲ 62 r/Esphome+1 crossposts

I replaced my dumb light switch with a DIY Scene Switcher... With 4 buttons, a rotary encoder and presence sensor :)

So we all know the dilemma where you install a smart bulb in your living room everything seems to be awesome until someone flips the physical switch and turns of power to the smartbulb. So you have to turn it back on and set it from your phone etc.

I built a Scene Switcher to replace my light switch to have full control over both the light and the switch. I also added a presence sensor to make my room really smart and automate based on presence.

I can automate the 4 buttons as I like. For example the first button is to turn on and off the tv. Second button is for guest mode, third is for sleep mode and 4th button is to announce that dinner is ready :)

The main wheel controls the main light. so one push is toggle on and off. Turning the wheel changes the brightness. (turns on and off also with turning the wheel) Pushing the button AND turning the wheel gets you into color mode and you can change the color. Release and it goes back to brightness control mode to default. Double click turns it back to white.

I wanted to print dedicated icons to the buttons but I wasn't sure which will be doing what :) but that is also an option. First I have to put my printer into maintenance as you can see the prints are not that good.

So the parts I used are;

  • ESP32-S3 N16R8
  • KY-040 Rotary encoder (with screw body and button)
  • 4x simple push buttons
  • 1x toggle switch
  • 1x 220V to 5V AC/DC converter.

I'm in the EU so we have these prebuilt-in holes for switches and outlets. So the bigger parts go into that and the device itself can be as thin as an esp board. Design could be better of course :) Not a pro here.

But I like how it turned out. What do you think?

As always the build process is here; https://www.youtube.com/watch?v=jDEeNjR3Npw

STL files and code will be uploaded in short time.

u/rgnyldz — 9 days ago