Skip to content
Home > Components > Power Components > Li-ion Battery

Li-ion Battery

A standard 3.7V Lithium-ion battery cell used for powering portable and high-current projects.

Component Preview

Li-ion Battery18650 Cell

Lithium-ion batteries offer incredible energy density, making them the standard choice for portable robotics, drones, and IoT devices. A single cell operates nominally at 3.7V, peaking at 4.2V when fully charged and dropping to around 3.0V when empty.

Power ComponentsEnergyPortable

Overview

Unlike standard 1.5V alkaline AA batteries, Li-ion cells provide enough voltage (3.7V) to power 3.3V logic systems natively (like ESP32 or 3.3V Arduino boards) using a simple linear regulator, and they can deliver massive amounts of current for motors.

Pin Reference

PinTypeDescription
VCC (+)powerPositive terminal. Outputs the current battery voltage (3.0V - 4.2V).
GND (-)powerNegative terminal. Ground reference.

Configurable Attributes

AttributeTypeDefaultDescription
capacityMahnumber2000Total maximum charge capacity of the battery in mAh.
currentChargeMahnumber2000The current remaining charge in the battery in mAh.
nominalVoltagenumber3.7The nominal voltage rating of the cell.

Working Principle

In the simulator, the Li-ion battery acts as an ideal voltage source that drops its voltage dynamically as the currentChargeMah depletes, matching a typical Li-ion discharge curve. If it drops below 3.0V, it stops providing useful power until recharged.

Wiring Diagram

Wiring Diagram

Example Arduino Code

cpp
// Reading the battery voltage via a voltage divider (assuming a 1:2 divider on A0)
const int batteryPin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int rawADC = analogRead(batteryPin);
  
  // Calculate voltage: (ADC / 1023) * 5.0V * 2 (multiplier for the 1:2 divider)
  float voltage = (rawADC / 1023.0) * 5.0 * 2.0; 
  
  Serial.print("Battery Voltage: ");
  Serial.print(voltage);
  Serial.println(" V");
  
  if(voltage < 3.2) {
    Serial.println("WARNING: Low Battery!");
  }
  
  delay(1000);
}

Simulation Notes

  • You can simulate a charging circuit by providing a higher voltage to the VCC pin (e.g., via the TP4056 charger module component), which will slowly increase currentChargeMah over time.
  • The battery tracks the current draw of all components connected to it and depletes appropriately in real time.

Released under the MIT License.