Public Project Sharing
U1)LM2596_ONOFF net through GPIO23 so the LM2596T-5.0 (U2) can be disabled/enabled by firmware.Table
| Function | ESP32 Pin | Schematic Net | Connected To | Direction | Notes |
|---|---|---|---|---|---|
| LM2596 off/on control | GPIO23 / U1:IO23 | ESP32_LM2596_OFF_CTRL → R1 → LM2596_ONOFF | U2:~ON-OFF and R2 pull-down | Output | LOW = regulator ON; HIGH = regulator OFF. R2 holds ON by default. |
| ESP32 enable | U1:EN | ESP32_EN | R3 pull-up + C2 delay | Input | Hardware boot support; firmware does not drive this pin. |
| ESP32 supply | U1:VDD | 3V3_ALWAYS_ON | Always-on 3.3V rail | Power | ESP32 must stay powered if it needs to turn LM2596 back on. |
| Ground | U1:GND pins | GND | Common ground with LM2596 | Power | Required shared reference for GPIO control. |
platformio.iniIni
[env:esp32dev] platform = espressif32 board = esp32dev framework = arduino monitor_speed = 115200
src/main.cppCpp
#include <Arduino.h> #include <WiFi.h> // From schematic: U1 IO23 -> R1 -> LM2596_ONOFF -> U2 ~ON-OFF #define LM2596_OFF_CTRL_PIN 23 // LM2596T-5.0 ON/OFF truth table from TI datasheet: // ON/OFF LOW or open = regulator ON // ON/OFF HIGH = regulator OFF void lm2596SetEnabled(bool enabled) { digitalWrite(LM2596_OFF_CTRL_PIN, enabled ? LOW : HIGH); } void setup() { Serial.begin(115200); delay(200); pinMode(LM2596_OFF_CTRL_PIN, OUTPUT); // Safe default: keep the 5V regulator ON at boot. lm2596SetEnabled(true); Serial.println("ESP32 LM2596 control firmware started"); Serial.println("Commands: '1' = LM2596 ON, '0' = LM2596 OFF"); } void loop() { if (Serial.available() > 0) { char cmd = Serial.read(); if (cmd == '1') { lm2596SetEnabled(true); Serial.println("LM2596 enabled: ON/OFF driven LOW"); } else if (cmd == '0') { lm2596SetEnabled(false); Serial.println("LM2596 disabled: ON/OFF driven HIGH"); } } }
Bash
pio run pio run -t upload pio device monitor
3V3_ALWAYS_ON, not from the LM2596 output it is controlling, otherwise it will turn itself off and cannot turn the regulator back on without an external reset/power cycle.Platform & Toolchain
Pin Mapping
`platformio.ini`
Complete Firmware Source — `src/main.cpp`
Build & Flash
Important Bring-Up Note