18650 Battery capacity checker

Some of you know, I really like lithium ion batteries

*shocked*

Shut it!  This is a short post, I don’t need you hamming up the works.

Just wait till I show up in your videos….

You wouldn’t….

Hello….

Oh hell…..

Ok, lets not worry about that now.

I picked up a pretty sweet haul of batteries this week.

 

 

 

 

22lbs.  I counted 107 2cell packs.  214 cells to check out.  This is great, but I have a single opus charger that can do 4 cells at a time.

So 214 cells will take some time to process.  I have done that game.  So I wanted to do more cells.  There are examples online of doing this with arduino’s and what not and since I am big fan of arduino’s anyways I decided to give that a shot.  I built it out initially with an arduino uno.  Using the awesome guidance of Adam Welch.  If you don’t know who Adam is, you gotta check out his work.

Website: http://adamwelch.co.uk/ 
Youtube: https://www.youtube.com/channel/UCm5sG3-BXQZfVy3st2T_XKg

His work I used for this is here.

I modified the code a little as I didn’t have that screen.  I have a 20×4 screen.  I also updated mine to calculate the voltage reference from the internal 1.1v reference.


/*
* Battery Capacity Checker
* Uses Nokia 5110 Display
* Uses 1 Ohm power resister as shunt - Load can be any suitable resister or lamp
*
* YouTube Video: https://www.youtube.com/embed/qtws6VSIoYk
*
* http://AdamWelch.Uk
*
* Required Library - LCD5110_Graph.h - http://www.rinkydinkelectronics.com/library.php?id=47
*/

#include <LiquidCrystal_I2C.h>
#define gatePin 2
#define highPin A0
#define lowPin A1

boolean finished = false;
int interval = 5000; //Interval (ms) between measurements

float mAh = 0.0;
float shuntRes = 1.0; // In Ohms - Shunt resistor resistance

float current = 0.0;
float battVolt = 0.0;
float shuntVolt = 0.0;
float battLow = 2.9;

LiquidCrystal_I2C lcd(0x27,20,4);
unsigned long previousMillis = 0;
unsigned long millisPassed = 0;

void setup() {
analogReference(INTERNAL);
Serial.begin(115200);
lcd.init(); //initialize the lcd
lcd.backlight(); //open the backlight
Serial.println("Battery Capacity Checker v1.1");
Serial.println("battVolt current mAh");

pinMode(gatePin, OUTPUT);
digitalWrite(gatePin, LOW);

lcd.setContrast(68);

lcd.clear();

lcd.print("Battery");
lcd.print("Check");
lcd.print("Please Wait");
lcd.print("AdamWelch.Uk");

delay(2000);
lcd.clear();
}

void loop() {
voltRef = readVcc() / 1024.0;
Serial.print("Volt Ref: ");
Serial.println(voltRef);
battVolt = analogRead(highPin) * voltRef / 1024.0;
Serial.print("Batt Vol: ");
Serial.println(battVolt);

shuntVolt = analogRead(lowPin) * voltRef / 1024.0;
Serial.print("Shunt Val: ");
Serial.println(shuntVolt);
Serial.println();
Serial.println();
/*
Serial.print(battVolt);
Serial.print("\t");
Serial.print(current);
Serial.print("\t");
Serial.println(mAh);
*/
if(battVolt >= battLow && finished == false)
{
digitalWrite(gatePin, HIGH);
millisPassed = millis() - previousMillis;
current = (battVolt - shuntVolt) / shuntRes;
mAh = mAh + (current * 1000.0) * (millisPassed / 3600000.0);
previousMillis = millis();

lcd.setCursor(0,0);
lcd.print("Discharge ");
lcd.setCursor(0,1);
lcd.print("Volt:");
lcd.print(battVolt);
lcd.print("v ");
lcd.setCursor(0,2);
lcd.print("Current:");
lcd.print(current);
lcd.print("a ");
lcd.setCursor(0,3);
lcd.print(mAh);
lcd.print("mAh ");
lcd.print("Running ");



}
if(battVolt < battLow)
{
digitalWrite(gatePin, LOW);

finished = true;



lcd.clear();
lcd.print("Discharge");
lcd.print("Voltage:");
lcd.print(battVolt);
lcd.print("v");

lcd.print(mAh);
lcd.print("mAh");
lcd.setCursor(0,1);
lcd.print("Complete");


}
delay(interval);
}

long readVcc() {
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
return result;
}

Next step is to add a “charging” function with a tp4056 so I can charge then discharge.

 

Amazon – 5 for 6.95

Ebay – 10 for 4.95

Aliexpress – 10 < 2 bucks.

 

Once that is working I should be able to add a couple more modules.  I have been really looking towards doing something with Brett Wattys 8 module charger.  That things is INTENSE!!!

If you want to see all the info check out the secondlifestorage forum.

https://secondlifestorage.com/t-Brett-s-Arduino-8x-Smart-Charger-Discharger

He also has a portal he is setting up to help aggregate some numbers on how many cells the community has recycled.

 

 

Until later!!!

bye!!!!

3dprinted Robot Mower – part 1

 

3dprinted Autonomous Robot Mower – part 1

Welcome to part one of me trying everything I can to not have to mow…. After avoiding mowing for a bit I needed to find a better solution.

In my slightly concussed state I came up with it. A 3dprinted robot mower!!

Using printed and electrical parts from http://www.reprap-windturbine.com/index.php?id=20&L=1 I am building my mower.

My firmware will tie in to my home automation system so the system will control mowing times based on times/weather conditions ect.

 

 

Bike generator for 18650 battery packs – Part 1

Part 2 of the Bike generator for the 18650 battery packs. In this one we build the mounting frame for the treadmill motor, 3dprint an axle connecting sleeve and do some tests with the multimeter to see what kind of voltage we can!. Getting closer to starting to record power generation data to the home automation system!

 

 

Bike generator for 18650 battery packs – Part 1

Welcome to part 1 of the bike generator build.

This build will add a pedal powered bike generator to help charge my 18650 battery packs. This will be in additional to the small solar panel currently in use.

The charge controller and statistics will be build on an arduino controller and tied in to my openhab home automation system for tracking and graphing.

The controller will connect wirelessly using mysensors and an nrf24l01 radio.