Arnov Sharma
Published © MIT

Li-ion Cell Charger with TP4056 and XIAO ESP32S3

Made a Li-ion 18650 Cell charger with onboard Voltage monitoring setup powered by XIAO ESP32S3 and SSD1306 Display

BeginnerFull instructions provided1 hour610
Li-ion Cell Charger with TP4056 and XIAO ESP32S3

Things used in this project

Hardware components

Seeed Studio XIAO ESP32S3 Sense
Seeed Studio XIAO ESP32S3 Sense
×1

Software apps and online services

Fusion
Autodesk Fusion
Arduino IDE
Arduino IDE

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Custom parts and enclosures

Fusion360File

Schematics

SCH

Code

code

C/C++
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>

#define OLED_WIDTH 128
#define OLED_HEIGHT 64

#define OLED_ADDR   0x3C

Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);

float input_volt = 0.0;
float temp=0.0;
float r1=100000.0;    //r1 value
float r2=10000.0;      //r2 value


void setup() {
  display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
  display.clearDisplay();
  Serial.begin(9600);
}

void loop() {
  int analogvalue = analogRead(D0);
    temp = (analogvalue * 0.8) / 1024.0;  // FORMULA USED TO CONVERT THE VOLTAGE
    input_volt = temp / (r2/(r1+r2));
    if (input_volt < 0.1) 
    {
      input_volt=0.0;
    } 

 
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
  display.println("Voltage=");
 // display.display();
  display.setTextSize(2);
  display.setTextColor(WHITE);
  display.setCursor(0, 20);
  display.println(input_volt);
  display.display();
  
  display.clearDisplay();
  
  
 delay(300);

}  

Credits

Arnov Sharma
340 projects • 346 followers
Just your average MAKER
Contact

Comments

Please log in or sign up to comment.