03 - ESP32 Lipo

![](https://cdn.shopify.com/s/files/1/0331/9994/7908/files/Pasted_image_20260117082538.png?v=1768606610) # Important The antenna must face the power switch side, and the USB port must face the product name/engraving side. Incorrect orientation will damage your ESP32 board. # Built-in LED The built-in LED on the ESP32 Lipo Dev board is connected to GPIO 22. Setting the pin to LOW (0) turns the LED on, while setting it to HIGH (1) turns it off. Here's a basic Arduino IDE sketch to blink the LED as an example: ``` cpp // Basic LED Blink for ESP32 on GPIO 22 #define LED_PIN 22 // Built-in LED pin void setup() { pinMode(LED_PIN, OUTPUT); // Set the pin as output } void loop() { digitalWrite(LED_PIN, LOW); // Turn LED on (LOW) delay(1000); // Wait 1 second digitalWrite(LED_PIN, HIGH); // Turn LED off (HIGH) delay(1000); // Wait 1 second } ``` # Battery Monitor By soldering the battery monitor pad on the front PCB, you can measure the battery voltage using the ADC via GPIO 36. The ESP32's ADC has a maximum input of 3.3V, but a LiPo battery can reach up to 4.2V, so a voltage divider with two equal-value resistors is used to halve the voltage. As a result, the actual battery voltage is twice the value read from the ADC. Here's a basic Arduino IDE sketch to read and calculate the battery voltage: ![](https://cdn.shopify.com/s/files/1/0331/9994/7908/files/Pasted_image_20251121130735.png?v=1768606614) ``` cpp // Basic Battery Voltage Monitor for ESP32 on GPIO 36 #define BATTERY_PIN 36 // GPIO for battery monitor void setup() { Serial.begin(115200); // Initialize serial communication analogReadResolution(12); // Set ADC to 12-bit resolution (0-4095) } void loop() { int adcValue = analogRead(BATTERY_PIN); // Read ADC value float measuredVoltage = (adcValue / 4095.0) * 3.3; // Convert to voltage (0-3.3V) float batteryVoltage = measuredVoltage * 2.0; // Double it due to voltage divider Serial.print("ADC Value: "); Serial.print(adcValue); Serial.print(" | Measured Voltage: "); Serial.print(measuredVoltage); Serial.print("V | Battery Voltage: "); Serial.print(batteryVoltage); Serial.println("V"); delay(2000); // Wait 2 seconds before next reading } ``` ![](https://cdn.shopify.com/s/files/1/0331/9994/7908/files/Pasted_image_20251121140308.png?v=1768606618) # **Battery Compatibility & Safety ![](https://cdn.shopify.com/s/files/1/0331/9994/7908/files/Pasted_image_20260117083623.png?v=1768606621) - The ESP32 board includes **built-in LiPo charging circuitry**. Always use a **3.7V LiPo battery** (nominal voltage; charges to 4.2V max) that has a **built-in protection circuit** (PCM/BMS for over-charge, over-discharge, short-circuit, etc.). Compatible examples: any standard 3.7V LiPo pouch cell or protected **18650** cell. - **Connector type**: JST **PH 2.0 mm** pitch (2-pin). **Direct connection to ESP32 board (B standard polarity)** - On the ESP32 board itself, the battery connector follows **B standard** polarity: - **Left pin** (when looking at the connector/socket on the board) = **Positive (+)** - **Right pin** = **Negative (-)** - **Critical**: Reversing polarity **will damage** the board and/or battery — double-check before connecting! **Using an expansion / extension board (A standard polarity)** - If your project includes an **expansion board** with features like: - battery power switch - voltage monitoring - PPTC (resettable fuse) protection - additional breakout pins, etc. → Route the battery **through the expansion board** instead of connecting directly to the ESP32. - All common ESP32 expansion boards use **A standard** polarity on their PH 2.0 battery connector: - **Left pin** = **Negative (-)** - **Right pin** = **Positive (+)** (This is the more conventional / "standard" orientation found on many dev boards and batteries.) **Quick Summary – How to Connect Safely** No matter which battery or cable polarity you have, just use a **PH 2.0 connector**: - **Option 1**: Connect battery directly to ESP32 → must match **B standard** (positive on left). - **Option 2**: Connect battery to expansion board → uses **A standard** (positive on right). The expansion board then safely passes power to the ESP32. Always verify polarity with a multimeter before first power-up. Incorrect wiring can destroy the ESP32, battery, or both.