Battery + USB Power
We wanted to make the Metro board easy to power both when connected to a computer as well as via battery.
There's three ways to power this microcontroller:
- You can connect with a USB cable (just plug into the jack) and the board will regulate the 5V USB down to 3.3V.
- You can also connect a 4.2/3.7V Lithium Polymer (LiPo/LiPoly) or Lithium Ion (LiIon) battery to the JST jack. This will let the board run on a rechargeable battery.
- You can connect a 6-12V power supply to the barrel jack. It requires a 5.5mm/2.1mm center-positive DC connector, which is the most common available.
When the USB or DC power is connected, it will automatically switch over, as well as start charging the battery (if attached). If both are connected, it will use whichever is highest. The switchover happens "hot-swap" style so you can always keep the LiPoly connected as a "backup" power that will only get used when USB or DC power is lost.
The above shows the USB C jack (left), the LiPoly JST jack (top right), as well as the 3.3V regulator and changeover diode (towards the center), and the LiPoly charging circuitry (around the JST jack).
There's also a CHG LED below the JST connector, which will light up amber while the battery is charging. This LED might also flicker if the battery is not connected, it's normal.
You have a lot of power supply options here!
We have the 3.3V pin which has the output from the 3.3V regulator. We use a 500mA peak regulator. While you can get 400mA from it, you can't do it continuously from 5V as it will overheat the regulator.
There is also the VHI pin. This pin is usually marked 5V on Arduinos, and when USB or DC is plugged in, it will in fact provide 5V. However, if you have the Metro on LiPo battery power, it will be powered from the battery and thus between 3.7V to 4.2V . When powered from USB or DC it is regulated to 5V, when powered from battery only, it's not regulated, but it is high-current, great for driving servos and NeoPixels.
The VIN pin is the higher of the DC jack or USB voltage. So if the DC jack is plugged in and 9V, VIN is 9V. If only USB connected, this will be 5V.
Measuring Battery
If you're running off of a battery, chances are you wanna know what the voltage is at! That way you can tell when the battery needs recharging. LiPoly batteries are 'maxed out' at 4.2V and stick around 3.7V for much of the battery life, then slowly sink down to 3.2V or so before the protection circuitry cuts it off. By measuring the voltage you can quickly tell when you're heading below 3.7V.
The Metro ESP32-S3 comes with a MAX17048 I2C battery monitor build right in. You can connect to it and read the battery info.
To read the battery data in CircuitPython, run the following program, and connect to the serial console.
# SPDX-FileCopyrightText: Copyright (c) 2022 ladyada for Adafruit Industries # # SPDX-License-Identifier: Unlicense import time import board import adafruit_max1704x i2c = board.I2C() # uses board.SCL and board.SDA # i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller max17 = adafruit_max1704x.MAX17048(i2c) print( "Found MAX1704x with chip version", hex(max17.chip_version), "and id", hex(max17.chip_id), ) # Quick starting allows an instant 'auto-calibration' of the battery. However, its a bad idea # to do this right when the battery is first plugged in or if there's a lot of load on the battery # so uncomment only if you're sure you want to 'reset' the chips charge calculator. # print("Quick starting") # max17.quick_start = True while True: print(f"Battery voltage: {max17.cell_voltage:.2f} Volts") print(f"Battery state : {max17.cell_percent:.1f} %") print("") time.sleep(1)
To read the battery data in Arduino, upload the following sketch, and open the serial monitor.
#include "Adafruit_MAX1704X.h" Adafruit_MAX17048 maxlipo; void setup() { Serial.begin(115200); while (!Serial) delay(10); // wait until serial monitor opens Serial.println(F("\nAdafruit MAX17048 simple demo")); while (!maxlipo.begin()) { Serial.println(F("Couldnt find Adafruit MAX17048?\nMake sure a battery is plugged in!")); delay(2000); } Serial.print(F("Found MAX17048")); Serial.print(F(" with Chip ID: 0x")); Serial.println(maxlipo.getChipID(), HEX); } void loop() { float cellVoltage = maxlipo.cellVoltage(); if (isnan(cellVoltage)) { Serial.println("Failed to read cell voltage, check battery is connected!"); delay(2000); return; } Serial.print(F("Batt Voltage: ")); Serial.print(cellVoltage, 3); Serial.println(" V"); Serial.print(F("Batt Percent: ")); Serial.print(maxlipo.cellPercent(), 1); Serial.println(" %"); Serial.println(); delay(2000); // dont query too often! }
For more details, check out the main guide.
The three primary ways for powering the Metro are a 3.7/4.2V LiPo battery plugged into the JST port, 6-12V DC power, or a USB power cable.
If you want a mobile option for your Metro, where you don't want a LiPoly, use a USB battery pack!
Here's what you cannot do:
- Do not use alkaline or NiMH batteries and connect to the battery port - this will destroy the LiPoly charger and there's no way to disable the charger.
- Do not use 7.4V RC batteries on the battery port - this will destroy the board.
Page last edited January 22, 2025
Text editor powered by tinymce.