# ESP32 Environmental Controller

## Description

ESP32\-WROOM\-32 environmental controller with USB\-C programming, DHT22 input, dual 5 V relay outputs, and a 5 V NeoPixel interface\. Schematic phase includes protected power entry, backfeed\-safe USB isolation, and complete firmware/power documentation\.

## Project Details

- **Owner:** dateca25
- **Created:** 9/8/2026
- **Last Updated:** 9/14/2026
- **Visibility:** Public

## Key Components

### D1 — [B340B\-13\-F](https://flux.ai/adrian95/b340b-13-f~y1g.md)

- Datasheet URL: https://mm\.digikey\.com/Volume0/opasdata/d220001/medias/docus/844/B320B\-B360B\_Rev10\-2\.pdf
- Part Type: Diode
- License: https://creativecommons\.org/licenses/by/4\.0/
- Role: Power Isolation
- Role Details: USB VBUS Schottky feed to logic\-only LDO input; high\-current loads remain on \+5V\_MAIN
- Manufacturer Name: Diodes Incorporated
- Manufacturer Part Number: B340B\-13\-F
- Functional Group: Power Supply,USB\-C and UART

**Pins:**
- A [pin 2]
- K [pin 1]

### D2 — [1N4007RLG](https://flux.ai/jecstronic/1n4007rlg~07j.md)

- Part Type: Diode
- Datasheet URL: https://www\.onsemi\.com/pdf/datasheet/1n4001\-d\.pdf
- Role Details: Across K1 coil, cathode to \+5V\_MAIN
- Role: Flyback Protection
- License: https://creativecommons\.org/licenses/by/4\.0/
- Manufacturer Part Number: 1N4007RLG
- Functional Group: Temperature Relay
- Manufacturer Name: onsemi

**Pins:**
- anode [pin 2]
- cathode [pin 1]

### D3 — [1N4007RLG](https://flux.ai/jecstronic/1n4007rlg~07j.md)

- Part Type: Diode
- Datasheet URL: https://www\.onsemi\.com/pdf/datasheet/1n4001\-d\.pdf
- Functional Group: Mist Relay
- Role Details: Across K2 coil, cathode to \+5V\_MAIN
- License: https://creativecommons\.org/licenses/by/4\.0/
- Manufacturer Part Number: 1N4007RLG
- Role: Flyback Protection
- Manufacturer Name: onsemi

**Pins:**
- anode [pin 2]
- cathode [pin 1]

### D4 — [PESD5V0S1BB,115](https://flux.ai/silicon-yard/pesd5v0s1bbc115~8w.md)

- Datasheet URL: https://assets\.nexperia\.com/documents/data\-sheet/PESD5V0S1BB\.pdf
- Manufacturer Part Number: PESD5V0S1BB,115
- Part Type: Diode
- Manufacturer Name: Nexperia USA Inc\.
- Functional Group: DHT22 Interface
- Role: Protection
- Role Details: 0\.6 pF single\-line ESD clamp on DHT\_DATA
- License: https://creativecommons\.org/licenses/by/4\.0/

**Pins:**
- A1 [pin 1]
- A2 [pin 2]

### D5 — [B340B\-13\-F](https://flux.ai/adrian95/b340b-13-f~y1g.md)

- Datasheet URL: https://mm\.digikey\.com/Volume0/opasdata/d220001/medias/docus/844/B320B\-B360B\_Rev10\-2\.pdf
- Part Type: Diode
- Functional Group: Power Supply
- License: https://creativecommons\.org/licenses/by/4\.0/
- Role Details: External \+5V\_MAIN Schottky leg of logic\-input power OR; prevents USB powering relay/NeoPixel loads
- Manufacturer Name: Diodes Incorporated
- Manufacturer Part Number: B340B\-13\-F
- Role: Reverse Polarity Protection

**Pins:**
- A [pin 2]
- K [pin 1]

### J1 — [1729128](https://flux.ai/adrian95/1729128~gmm.md)

- Package or Case Code: 1729128
- Functional Group: Power Supply
- Manufacturer Name: Phoenix Contact
- Part Type: Connector
- Datasheet URL: http://www\.phoenixcontact\.net/product/1729128
- Role: Power Input
- Role Details: 5 V DC input, 3 A peak budget, 17\.5 A connector rating
- License: https://creativecommons\.org/licenses/by/4\.0/
- Manufacturer Part Number: 1729128

**Pins:**
- 1 [pin 1]
- 2 [pin 2]

### J2 — [USB4215\-03\-A](https://flux.ai/adrian95/usb4215-03-a~kg3.md)

- Role Details: USB 2\.0 device port with CC sink resistors
- Datasheet URL: https://gct\.co/files/specs/usb4215\-spec\.pdf
- Part Type: USB C
- Role: External Connector
- Symbol Style: parametric\-v1
- Package or Case Code: GCT\_USB4215\-03\-A\_REVA
- License: https://creativecommons\.org/licenses/by/4\.0/
- Manufacturer Name: GCT
- Functional Group: USB\-C and UART
- Manufacturer Part Number: USB4215\-03\-A

**Pins:**
- CC1 [pin A5]
- CC2 [pin B5]
- DN1 [pin A7]
- DN2 [pin B7]
- DP1 [pin A6]
- DP2 [pin B6]
- GND\_A [pin A1\_B12]
- GND\_B [pin B1\_A12]
- SBU1 [pin A8]
- SBU2 [pin B8]
- SHIELD [pin SH1]
- SHIELD [pin SH4]
- SHIELD [pin SH2]
- SHIELD [pin SH3]
- VBUS\_A [pin A4\_B9]
- VBUS\_B [pin B4\_A9]

### J3 — [DB126V\-5\.0\-3P\-GN](https://flux.ai/jharwinbarrozo/db126v-5p0-3p-gn~6j.md)

- License: https://creativecommons\.org/licenses/by/4\.0/
- Manufacturer Name: DIBO
- Role Details: 3V3, GND, DHT\_DATA
- Datasheet URL: https://datasheet\.lcsc\.com/lcsc/1912111437\_DIBO\-DB126V\-5\-0\-3P\-GN\_C395850\.pdf
- Role: Sensor Connector
- Manufacturer Part Number: DB126V\-5\.0\-3P\-GN
- Functional Group: DHT22 Interface
- Part Type: Connector

**Pins:**
- PIN1 [pin 1]
- PIN2 [pin 2]
- PIN3 [pin 3]

### J4 — [1868076](https://flux.ai/silicon-yard/1868076.md)

- Compliance: Green
- Mount: Screw
- Manufacturer Part Number: 1868076
- Manufacturer Name: Phoenix Contact
- Part Type: Connector
- Functional Group: Temperature Relay
- Role: Load Connector
- Role Details: Relay K1 COM and NO, 630 V 32 A terminal rating
- Datasheet URL: https://www\.phoenixcontact\.com/en\-us/products/printed\-circuit\-board\-terminal\-mkds\-5\-2\-762\-1868076?type=pdf

**Pins:**
- 1 [pin 1]
- 2 [pin 2]

### J5 — [1868076](https://flux.ai/silicon-yard/1868076.md)

- Compliance: Green
- Mount: Screw
- Manufacturer Part Number: 1868076
- Manufacturer Name: Phoenix Contact
- Part Type: Connector
- Role Details: Relay K2 COM and NO, 630 V 32 A terminal rating
- Functional Group: Mist Relay
- Datasheet URL: https://www\.phoenixcontact\.com/en\-us/products/printed\-circuit\-board\-terminal\-mkds\-5\-2\-762\-1868076?type=pdf
- Role: Load Connector

**Pins:**
- 1 [pin 1]
- 2 [pin 2]

### J6 — [DB126V\-5\.0\-3P\-GN](https://flux.ai/jharwinbarrozo/db126v-5p0-3p-gn~6j.md)

- License: https://creativecommons\.org/licenses/by/4\.0/
- Manufacturer Name: DIBO
- Datasheet URL: https://datasheet\.lcsc\.com/lcsc/1912111437\_DIBO\-DB126V\-5\-0\-3P\-GN\_C395850\.pdf
- Functional Group: NeoPixel Interface
- Manufacturer Part Number: DB126V\-5\.0\-3P\-GN
- Role: LED Connector
- Role Details: \+5V\_MAIN, GND, NEOPIXEL\_DIN for up to 30 pixels
- Part Type: Connector

**Pins:**
- PIN1 [pin 1]
- PIN2 [pin 2]
- PIN3 [pin 3]

### K1 — [SRD\-05VDC\-SL\-C](https://flux.ai/vasy_skral/srd-05vdc-sl-c~go1.md)

- Manufacturer Part Number: SRD\-05VDC\-SL\-C
- Role Details: Heater contact switching; COM and NO exposed, NC unused
- Functional Group: Temperature Relay
- Manufacturer Name: Ningbo Songle Relay
- Datasheet URL: https://www\.circuitbasics\.com/wp\-content/uploads/2015/11/SRD\-05VDC\-SL\-C\-Datasheet\.pdf
- Role: Relay
- Part Type: Relay

**Pins:**
- A1 [pin A1]
- A2 [pin A2]
- COM [pin COM]
- NC [pin NC]
- NO [pin NO]

### K2 — [SRD\-05VDC\-SL\-C](https://flux.ai/vasy_skral/srd-05vdc-sl-c~go1.md)

- Manufacturer Part Number: SRD\-05VDC\-SL\-C
- Role: Relay
- Role Details: Mist contact switching; COM and NO exposed, NC unused
- Manufacturer Name: Ningbo Songle Relay
- Datasheet URL: https://www\.circuitbasics\.com/wp\-content/uploads/2015/11/SRD\-05VDC\-SL\-C\-Datasheet\.pdf
- Part Type: Relay
- Functional Group: Mist Relay

**Pins:**
- A1 [pin A1]
- A2 [pin A2]
- COM [pin COM]
- NC [pin NC]
- NO [pin NO]

### Q1 — [S8050](https://flux.ai/adrian95/s8050~wjp.md)

- License: https://creativecommons\.org/licenses/by/4\.0/
- Part Type: Transistor
- Role Details: Cross\-coupled DTR/RTS pull\-down stage for EN
- Functional Group: MCU and Boot
- Role: Auto Program
- Manufacturer Part Number: S8050
- Datasheet URL: https://pdf1\.alldatasheet\.com/datasheet\-pdf/view/33773/WINGS/S8050\.html
- Manufacturer Name: MDD

**Pins:**
- B [pin 1]
- C [pin 3]
- E [pin 2]

### Q2 — [S8050](https://flux.ai/adrian95/s8050~wjp.md)

- License: https://creativecommons\.org/licenses/by/4\.0/
- Part Type: Transistor
- Role: Auto Program
- Functional Group: MCU and Boot
- Manufacturer Part Number: S8050
- Datasheet URL: https://pdf1\.alldatasheet\.com/datasheet\-pdf/view/33773/WINGS/S8050\.html
- Role Details: Cross\-coupled DTR/RTS pull\-down stage for GPIO0
- Manufacturer Name: MDD

**Pins:**
- B [pin 1]
- C [pin 3]
- E [pin 2]

### Q3 — [2N2222AUB](https://flux.ai/jecstronic/2n2222aub~0jf.md)

- Part Type: Transistor
- License: https://creativecommons\.org/licenses/by/4\.0/
- Role Details: Saturated NPN switch for 71\.4 mA Songle coil
- Datasheet URL: https://www\.ttelectronics\.com/TTElectronics/media/ProductFiles/Datasheet/2N2222AUB\.pdf
- Functional Group: Temperature Relay
- Manufacturer Part Number: 2N2222AUB
- Role: Relay Driver
- Manufacturer Name: TT Electronics/Optek Technology

**Pins:**
- B [pin 1]
- C [pin 2]
- E [pin 3]

### Q4 — [2N2222AUB](https://flux.ai/jecstronic/2n2222aub~0jf.md)

- Part Type: Transistor
- License: https://creativecommons\.org/licenses/by/4\.0/
- Datasheet URL: https://www\.ttelectronics\.com/TTElectronics/media/ProductFiles/Datasheet/2N2222AUB\.pdf
- Manufacturer Part Number: 2N2222AUB
- Manufacturer Name: TT Electronics/Optek Technology
- Role Details: Saturated NPN switch for 71\.4 mA Songle coil
- Role: Relay Driver
- Functional Group: Mist Relay

**Pins:**
- B [pin 1]
- C [pin 2]
- E [pin 3]

### SW1 — [TS\-1088\-AR02016](https://flux.ai/lcsc/ts-1088-ar02016~e3n1.md)

- Manufacturer Name: XUNPU\(讯普\)
- Role Details: Momentary GPIO0 to GND bootloader button
- Datasheet URL: https://storage\.googleapis\.com/graviton\-electric\-symbols/document\_assets/lcsc/2409302330\_XUNPU\-TS\-1088\-AR02016\_C720477\.pdf
- JLCPCB Part Class: Extended Part
- Functional Group: MCU and Boot
- Manufacturer Part Number: TS\-1088\-AR02016
- Product Info Url: https://lcsc\.com/product\-detail/Tactile\-Switches\_XUNPU\-TS\-1088\-AR02016\_C720477\.html
- LCSC Part Number: C720477
- Part Type: Tactile Switches
- Package or Case Code: SW\-SMD\_L3\.9\-W3\.0\-P4\.45
- Role: User Input

**Pins:**
- 1 [pin 1]
- 2 [pin 2]

### SW2 — [TS\-1088\-AR02016](https://flux.ai/lcsc/ts-1088-ar02016~e3n1.md)

- Functional Group: MCU and Boot
- Role: User Input
- Manufacturer Name: XUNPU\(讯普\)
- Datasheet URL: https://storage\.googleapis\.com/graviton\-electric\-symbols/document\_assets/lcsc/2409302330\_XUNPU\-TS\-1088\-AR02016\_C720477\.pdf
- JLCPCB Part Class: Extended Part
- Role Details: Momentary EN to GND reset button
- Manufacturer Part Number: TS\-1088\-AR02016
- Product Info Url: https://lcsc\.com/product\-detail/Tactile\-Switches\_XUNPU\-TS\-1088\-AR02016\_C720477\.html
- LCSC Part Number: C720477
- Part Type: Tactile Switches
- Package or Case Code: SW\-SMD\_L3\.9\-W3\.0\-P4\.45

**Pins:**
- 1 [pin 1]
- 2 [pin 2]

### U1 — [ESP32\-WROOM\-32](https://flux.ai/vasyl/esp32-wroom-32~siz.md)

- Manufacturer Part Number: ESP32\-WROOM\-32
- Part Type:  RF module 
- Manufacturer Name: Espressif Systems
- Role Details: ESP32 environmental control and communications
- Datasheet URL: https://www\.espressif\.com/sites/default/files/documentation/esp32\-wroom\-32\_datasheet\_en\.pdf
- Role: Controller
- Functional Group: MCU and Boot

**Pins:**
- EN [pin 3]
- GND [pin 39]
- GND [pin 15]
- GND [pin 38]
- GND [pin 1]
- IO0 [pin 25]
- IO12 [pin 14]
- IO13 [pin 16]
- IO14 [pin 13]
- IO15 [pin 23]
- IO16 [pin 27]
- IO17 [pin 28]
- IO18 [pin 30]
- IO19 [pin 31]
- IO2 [pin 24]
- IO21 [pin 33]
- IO22 [pin 36]
- IO23 [pin 37]
- IO25 [pin 10]
- IO26 [pin 11]
- IO27 [pin 12]
- IO32 [pin 8]
- IO33 [pin 9]
- IO34 [pin 6]
- IO35 [pin 7]
- IO4 [pin 26]
- IO5 [pin 29]
- NC [pin 32]
- RXD0/IO3 [pin 34]
- SCK/CLK [pin 20]
- SCS/CMD [pin 19]
- SDI/SD1 [pin 22]
- SDO/SD0 [pin 21]
- SENSOR\_VN [pin 5]
- SENSOR\_VP [pin 4]
- SHD/SD2 [pin 17]
- SWP/SD3 [pin 18]
- TXD0/IO1 [pin 35]
- VDD [pin 2]

### U2 — [LD1117S33TR](https://flux.ai/adrian95/ld1117s33tr~s0.md)

- Manufacturer Part Number: LD1117S33TR
- Datasheet URL: https://www\.st\.com/content/ccc/resource/technical/document/datasheet/99/3b/7d/91/91/51/4b/be/CD00000544\.pdf/files/CD00000544\.pdf/jcr:content/translations/en\.CD00000544\.pdf
- Functional Group: Power Supply
- Manufacturer Name: STMicroelectronics
- Part Type: Integrated Circuit
- Role Details: 3\.3 V rail, 800 mA rated; thermal review required
- License: https://creativecommons\.org/licenses/by/4\.0/
- Role: Regulator

**Pins:**
- GND [pin 1]
- IN [pin 3]
- OUT [pin 2]
- OUT [pin 4]

### U3 — [CH340K](https://flux.ai/lcsc/ch340k~fevo.md)

- Manufacturer Name: WCH\(南京沁恒\)
- Role Details: USB\-UART bridge powered from isolated USB VBUS
- Operating Temperature: \-20℃\~\+70℃
- Datasheet URL: https://storage\.googleapis\.com/graviton\-electric\-symbols/document\_assets/lcsc/2403131131\_WCH\-Jiangsu\-Qin\-Heng\-CH340K\_C968586\.pdf
- JLCPCB Part Class: Extended Part
- Package or Case Code: ESOP\-10\_L4\.9\-W3\.9\-P1\.00\-LS6\.2\-BL\-EP
- Symbol Style: parametric\-v1
- Voltage Supply: 3\.3V , 5V
- LCSC Part Number: C968586
- Part Type: USB ICs
- Functional Group: USB\-C and UART
- Manufacturer Part Number: CH340K
- Product Info Url: https://lcsc\.com/product\-detail/USB\-ICs\_WCH\-Jiangsu\-Qin\-Heng\-CH340K\_C968586\.html
- Role: Interface

**Pins:**
- \~\{CTS\} [pin 5]
- \~\{DTR\} [pin 4]
- \~\{RTS\} [pin 6]
- EP [pin 11]
- GND [pin 3]
- RXD [pin 9]
- TXD [pin 8]
- UD\- [pin 2]
- UD\+ [pin 1]
- V3 [pin 10]
- VCC [pin 7]

### U4 — [USBLC6\-2SC6](https://flux.ai/vasy_skral/usblc6-2sc6~g1b.md)

- Functional Group: USB\-C and UART
- Manufacturer Part Number: USBLC6\-2SC6
- Role: Protection
- Role Details: Low\-capacitance USB 2\.0 ESD array
- Symbol Style: parametric\-v1
- License: https://creativecommons\.org/licenses/by/4\.0/
- Part Type: Protection
- Manufacturer Name: STMicroelectronics
- Datasheet URL: https://www\.st\.com/content/ccc/resource/technical/document/datasheet/06/1d/48/9c/6c/20/4a/b2/CD00050750\.pdf/files/CD00050750\.pdf/jcr:content/translations/en\.CD00050750\.pdf
- LCSC Part Number: C7519

**Pins:**
- GND [pin 2]
- I/O1 [pin 6]
- I/O1 [pin 1]
- I/O2 [pin 3]
- I/O2 [pin 4]
- VBUS [pin 5]

### U5 — [PC817X2NSZ9F](https://flux.ai/lcsc/pc817x2nsz9f~p27u.md)

- Role: Isolation
- Product Info Url: https://lcsc\.com/product\-detail/DIP\-Optocouplers\_Sharp\-Microelectronics\-PC817X2NSZ9F\_C390734\.html
- Manufacturer Name: SHARP\(夏普\)
- Role Details: PC817\-family logic interface; shared supply/ground means no system galvanic isolation
- Part Type: Optocouplers \- Phototransistor Output
- Manufacturer Part Number: PC817X2NSZ9F
- Datasheet URL: https://www\.lcsc\.com/datasheet/lcsc\_datasheet\_1912111437\_Sharp\-Microelectronics\-PC817X2NSZ9F\_C390734\.pdf
- LCSC Part Number: C390734
- Package or Case Code: DIP\-4\_L6\.4\-W4\.6\-P2\.54\-LS7\.6\-BL
- JLCPCB Part Class: Extended Part
- Functional Group: Temperature Relay

**Pins:**
- Anode [pin 1]
- Cathode [pin 2]
- Collector [pin 4]
- Emitter [pin 3]

### U6 — [PC817X2NSZ9F](https://flux.ai/lcsc/pc817x2nsz9f~p27u.md)

- Product Info Url: https://lcsc\.com/product\-detail/DIP\-Optocouplers\_Sharp\-Microelectronics\-PC817X2NSZ9F\_C390734\.html
- Role Details: PC817\-family logic interface; shared supply/ground means no system galvanic isolation
- Manufacturer Name: SHARP\(夏普\)
- Functional Group: Mist Relay
- Role: Isolation
- Part Type: Optocouplers \- Phototransistor Output
- Manufacturer Part Number: PC817X2NSZ9F
- Datasheet URL: https://www\.lcsc\.com/datasheet/lcsc\_datasheet\_1912111437\_Sharp\-Microelectronics\-PC817X2NSZ9F\_C390734\.pdf
- LCSC Part Number: C390734
- Package or Case Code: DIP\-4\_L6\.4\-W4\.6\-P2\.54\-LS7\.6\-BL
- JLCPCB Part Class: Extended Part

**Pins:**
- Anode [pin 1]
- Cathode [pin 2]
- Collector [pin 4]
- Emitter [pin 3]

### U7 — [SN74AHCT125QDRQ1](https://flux.ai/lcsc/sn74ahct125qdrq1~7m46.md)

- Package or Case Code: SOIC\-14\_L8\.7\-W3\.9\-P1\.27\-LS6\.0\-BL
- Role Details: AHCT channel buffers GPIO21 to 5 V NeoPixel DIN
- Manufacturer Part Number: SN74AHCT125QDRQ1
- Manufacturer Name: TI\(德州仪器\)
- Functional Group: NeoPixel Interface
- Role: Level Shifter
- LCSC Part Number: C2867044
- Part Type: Buffers / Drivers

**Pins:**
- \~\{1OE\} [pin 1]
- \~\{2OE\} [pin 4]
- \~\{3OE\} [pin 10]
- \~\{4OE\} [pin 13]
- 1A [pin 2]
- 1Y [pin 3]
- 2A [pin 5]
- 2Y [pin 6]
- 3A [pin 9]
- 3Y [pin 8]
- 4A [pin 12]
- 4Y [pin 11]
- GND [pin 7]
- VCC [pin 14]

*The full schematic, PCB layout, bill of materials, and interactive design are available at [https://flux\.ai/dateca25/esp32\-environmental\-controller\~ns](https://flux.ai/dateca25/esp32-environmental-controller~ns).*

---

*Generated from [https://flux\.ai/dateca25/esp32\-environmental\-controller\~ns](https://flux.ai/dateca25/esp32-environmental-controller~ns)*