Files
ESP_Midea/Midea_ESP/SCHEMATIC_ANALYSIS.md
2026-01-06 02:07:54 +02:00

347 lines
11 KiB
Markdown

# Schematic Analysis: Midea AC Controller with BLE Beacon
## Project Overview
**Title:** Midea AC Controller with BLE Beacon
**Date:** 2025-12-28
**Revision:** 1.0
**Purpose:** ESP32-based controller for Midea AC units with Bluetooth Low Energy beacon functionality
---
## 1. Power Supply System
### Power Input
- **Source:** +5V external supply (via J1 connector)
- **Regulator:** AMS1117-3.3 (U1)
- Input: +5V (Pin 3 - VI)
- Output: +3.3V (Pin 2 - VO)
- Ground: Pin 1 (GND)
### Power Distribution
- **+5V Rail:**
- Powers TXB0104PWR level shifter VCCB (Pin 11)
- Powers AC connector J1 (Pin 1)
- Powers +5V power symbols
- **+3.3V Rail:**
- Powers ESP32-WROOM-32E VDD (Pin 2)
- Powers TXB0104PWR level shifter VCCA (Pin 12)
- Powers TXB0104PWR OE (Pin 10) - always enabled
- Powers pull-up resistors (R3, R4)
- Powers LED circuits
### Decoupling Capacitors
- **C1:** 5V input filtering (26.67mm, 39.37mm)
- **C2:** 3.3V output filtering (63.5mm, 39.37mm)
- **C3:** 3.3V input filtering (38.1mm, 39.37mm)
- **C4:** 3.3V output filtering (74.93mm, 39.37mm)
- **C5:** ESP32 VDD decoupling (52.07mm, 81.28mm)
- **C6:** ESP32 VDD decoupling (52.07mm, 88.9mm)
**⚠️ Potential Issue:** Missing decoupling capacitors directly on TXB0104PWR power pins (VCCA and VCCB). Datasheet recommends 100nF ceramic capacitors on each power pin.
---
## 2. ESP32-WROOM-32E Module (U3)
### Power Connections
- **VDD (Pin 2):** +3.3V (with decoupling capacitors C5, C6)
- **GND (Pin 1, 15, 38, 39):** Ground plane
### UART Communication
- **GPIO17 (Pin 25 - TXD0/IO1):** → ESP32_TX label → UART_TX → TXB0104PWR A1 (Pin 1)
- **GPIO16 (Pin 27 - IO16):** → ESP32_RX label → UART_RX → TXB0104PWR A2 (Pin 2)
**Note:** The schematic shows GPIO17 as TX and GPIO16 as RX, but these may need to be configured in software depending on which UART peripheral is used.
### Control Buttons
- **SW1 (Reset Button):**
- Connected to EN pin (Pin 3)
- Pull-up resistor R3 to +3.3V
- When pressed: EN goes LOW, ESP32 resets
- **SW2 (Boot Button):**
- Connected to GPIO0 (Pin 25 - IO0)
- Pull-up resistor R4 to +3.3V
- When pressed: GPIO0 goes LOW, ESP32 enters download mode
### Status LEDs
- **D1:** Connected via R1 (current limiting resistor)
- **D2:** Connected via R2 (current limiting resistor)
- **Note:** LED anodes connect to resistors, cathodes to GND
### Unused Pins
Many ESP32 pins are marked as "NC" (No Connect):
- Pins 17, 18, 19, 20, 21, 22, 32 (NC pins)
- Pins 4, 5 (SENSOR_VP, SENSOR_VN) - unused
- Pins 6, 7 (IO34, IO35) - input-only pins, unused
---
## 3. Level Shifter: TXB0104PWR (U2)
### Purpose
Bidirectional voltage level translation between:
- **A Port (Low Voltage):** 3.3V side (ESP32)
- **B Port (High Voltage):** 5V side (AC Controller)
### Power Connections
- **VCCA (Pin 12):** +3.3V (low voltage side)
- **VCCB (Pin 11):** +5V (high voltage side)
- **GND (Pins 5, 13, 14):** Ground
- **OE (Pin 10):** +3.3V (always enabled)
**⚠️ Issue:** OE is connected directly to +3.3V. While this works, datasheet recommends a pulldown resistor for power-up safety. However, since both supplies come from the same source, this is acceptable.
### Signal Connections
- **A1 (Pin 1):** ESP32 TX → UART_TX
- **A2 (Pin 2):** ESP32 RX → UART_RX
- **B1 (Pin 9):** AC RX → J1 Pin 2
- **B2 (Pin 8):** AC TX → J1 Pin 3
### Unused Channels
- **A3 (Pin 3):** NC
- **A4 (Pin 4):** NC
- **B3 (Pin 7):** NC
- **B4 (Pin 6):** NC
**Note:** Only 2 of 4 channels are used. This is fine - the IC supports partial channel usage.
---
## 4. AC Interface Connector (J1)
### Connector Type
- **Type:** Conn_01x04_Pin (4-pin single-row connector)
- **Footprint:** PinHeader_1x04_P2.00mm_Vertical
### Pin Assignments
- **Pin 1:** +5V (power to AC dongle)
- **Pin 2:** AC_RX (receive from AC, via level shifter B1)
- **Pin 3:** AC_TX (transmit to AC, via level shifter B2)
- **Pin 4:** GND (ground)
### Connection Flow
```
ESP32 GPIO17 (TX) → Level Shifter A1 → Level Shifter B2 → J1 Pin 3 (AC_TX)
ESP32 GPIO16 (RX) ← Level Shifter A2 ← Level Shifter B1 ← J1 Pin 2 (AC_RX)
```
---
## 5. Additional Connector (J2)
### Connector Type
- **Type:** Conn_02x04_Counter_Clockwise (8-pin dual-row connector)
- **Footprint:** PinHeader_2x04_P2.00mm_Vertical
### Purpose
**⚠️ Unclear:** J2 is present in the schematic but connections are not fully visible. This may be:
- Debug/programming connector
- Additional I/O expansion
- Reserved for future use
**Recommendation:** Verify J2 pin assignments and document purpose.
---
## 6. Component Summary
### Active Components
| Ref | Component | Value | Purpose |
|-----|-----------|-------|---------|
| U1 | AMS1117-3.3 | 3.3V LDO | Power regulation |
| U2 | TXB0104PWR | Level Shifter | 3.3V ↔ 5V translation |
| U3 | ESP32-WROOM-32E | MCU | Main controller |
### Passive Components
| Ref | Component | Value | Purpose |
|-----|-----------|-------|---------|
| C1-C6 | Capacitors | Various | Power filtering/decoupling |
| R1-R4 | Resistors | Various | Current limiting/pull-ups |
| D1, D2 | LEDs | Status indicators | Visual feedback |
| SW1, SW2 | Push buttons | Reset/Boot | Control buttons |
### Connectors
| Ref | Type | Pins | Purpose |
|-----|------|------|---------|
| J1 | 1x04 Pin Header | 4 | AC Controller interface |
| J2 | 2x04 Pin Header | 8 | Unknown/Reserved |
---
## 7. Signal Flow Analysis
### UART Communication Path
```
AC Controller (5V) Level Shifter ESP32 (3.3V)
───────────────── ───────────── ────────────
J1 Pin 3 (TX) ────────→ B2 ────────→ A1 ───────→ GPIO17 (TX)
J1 Pin 2 (RX) ←──────── B1 ←──────── A2 ←─────── GPIO16 (RX)
```
### Power Flow
```
External 5V → J1 Pin 1 ──┬──→ U1 (AMS1117) ──→ +3.3V ──→ ESP32 VDD
└──→ U2 VCCB (5V side)
└──→ +5V rail
```
---
## 8. Design Strengths
**Proper Power Regulation:** AMS1117-3.3 provides stable 3.3V for ESP32
**Level Shifting:** TXB0104PWR correctly handles 3.3V ↔ 5V translation
**Bidirectional Communication:** Automatic direction sensing in level shifter
**Reset/Boot Controls:** Proper button implementation with pull-ups
**Decoupling:** Multiple capacitors for power supply filtering
**Status Indicators:** LEDs for visual feedback
---
## 9. Potential Issues & Recommendations
### ⚠️ Critical Issues
1. **Missing Decoupling Capacitors on TXB0104PWR**
- **Issue:** No 100nF capacitors on VCCA (Pin 12) and VCCB (Pin 11)
- **Impact:** Potential signal integrity issues, noise on power rails
- **Fix:** Add C7 (100nF) from VCCA to GND, C8 (100nF) from VCCB to GND
- **Placement:** As close as possible to power pins (<5mm)
2. **OE Pin Connection**
- **Current:** OE directly connected to +3.3V
- **Issue:** No pulldown resistor for power-up safety
- **Impact:** Minor - may cause brief high-impedance during power-up
- **Fix (Optional):** Add 10kΩ pulldown resistor from OE to GND
### ⚠️ Design Considerations
3. **J2 Connector Purpose**
- **Issue:** J2 connections not clearly defined
- **Action:** Document purpose and pin assignments
4. **ESP32 UART Pin Selection**
- **Current:** GPIO17 (TX), GPIO16 (RX)
- **Note:** Verify these are the correct UART peripheral pins
- **Check:** ESP32-WROOM-32E pinout for UART0/UART1/UART2 assignments
5. **LED Current Limiting**
- **Issue:** Resistor values (R1, R2) not specified
- **Recommendation:** Calculate based on LED forward voltage and desired current
- **Typical:** 220Ω-1kΩ for 3.3V supply with standard LEDs
6. **Power Supply Sequencing**
- **Current:** 5V 3.3V (via regulator)
- **Note:** TXB0104PWR requires VCCA VCCB (satisfied: 3.3V 5V)
- **Status:** Acceptable, but ensure proper power-up sequence
### 💡 Recommendations
7. **Add Test Points**
- Consider adding test points for:
- +5V rail
- +3.3V rail
- UART_TX/RX signals
- GND
8. **Add Fuse/Protection**
- Consider adding:
- Input fuse for +5V protection
- TVS diodes on UART lines for ESD protection
9. **Component Values**
- Document all component values:
- Capacitor values (C1-C6)
- Resistor values (R1-R4)
- LED specifications (D1, D2)
---
## 10. PCB Layout Recommendations
### Critical Placement
1. **TXB0104PWR Decoupling:**
- Place 100nF capacitors within 5mm of VCCA and VCCB pins
- Use short, wide traces
2. **ESP32 Decoupling:**
- C5, C6 should be as close as possible to VDD pin
- Use ground plane for return path
3. **Level Shifter Placement:**
- Place TXB0104PWR between ESP32 and J1 connector
- Minimize trace lengths for UART signals
4. **Power Traces:**
- Use adequate trace width for current capacity
- ESP32 can draw up to 500mA peak
- Minimum 0.5mm trace width recommended
5. **Ground Plane:**
- Use continuous ground plane
- Connect all GND pins to ground plane
- Avoid ground loops
---
## 11. Testing Checklist
### Power Supply
- [ ] Verify +5V input voltage
- [ ] Verify +3.3V output from regulator (within ±5%)
- [ ] Check for ripple on power rails
- [ ] Verify power consumption
### Level Shifter
- [ ] Verify VCCA = 3.3V, VCCB = 5V
- [ ] Test bidirectional signal translation
- [ ] Verify OE pin is HIGH (enabled)
- [ ] Check signal integrity on UART lines
### ESP32
- [ ] Verify power-on and boot sequence
- [ ] Test reset button functionality
- [ ] Test boot button (download mode)
- [ ] Verify UART communication
- [ ] Test LED indicators
### AC Interface
- [ ] Verify J1 connector pinout
- [ ] Test UART communication with AC controller
- [ ] Verify signal levels (3.3V 5V translation)
---
## 12. Bill of Materials (BOM) Summary
### Required Components
- 1x ESP32-WROOM-32E module
- 1x TXB0104PWR (TSSOP-14)
- 1x AMS1117-3.3 (SOT-223)
- 6x Capacitors (various values)
- 4x Resistors (various values)
- 2x LEDs
- 2x Push buttons
- 2x Connectors (J1, J2)
### Missing Components (Recommended)
- 2x 100nF capacitors (TXB0104PWR decoupling)
- 1x 10kΩ resistor (OE pulldown - optional)
---
## Conclusion
The schematic shows a well-designed circuit for an ESP32-based AC controller with proper level shifting for 5V communication. The main areas for improvement are:
1. **Add decoupling capacitors** on TXB0104PWR power pins
2. **Document component values** (resistors, capacitors)
3. **Clarify J2 connector** purpose and connections
4. **Verify ESP32 UART pin** assignments match software configuration
Overall, the design is sound and should work correctly with the recommended additions.