It can even connect to a PC and give you a full "Data-sheet" graph of the discharge and total capacity.
Note that this is my first Arduino project (I am not counting my "blink LED").
Step 1: This is what you can get at the end...(just to get you interested)
Step 2: Lets start at the begining - Arduino
Step 3: Bread board Arduino
most of the information can be found in the Arduino web page :
http://arduino.cc/en/Main/ArduinoBoardDiecimila
They realy have everything you need .
It took me about a week to get it up and running (bootloader / building an ISP cable and an RS232 cable ...) - you can read all about this in the site above .
Step 4: FET with 2.2Ohm load
I connected two A/D pins from the Arduino to the resistor poles and subtracted the values to get the exact volatge drop on the resistor .
Now I samples them every second and acumulated the current (I=DeltaV/R).
I also added a buzzer to indicate when charging was over and stoped the discharge .
Step 5: The SW
Auto detecting battery type by the voltage .
Step 6: Auto Detect Battery tyoe
And then start the discharge cycle.
Step 7: Discharging...
Do you want to use that battery for your air-plain receiver or not ?
This is the diagram of the discharge circuit...
Step 8: Discharge Circuit
Vr=Vbat-Vfet.
Step 9: My SW (free for anyone to use)
#include
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);// initialize the library with the numbers of the interface pins
int sensorPin = 0; // select the input pin for the potentiometer (pin 23)
int sensor2Pin = 2; // select the input pin for the potentiometer (pin 23)
int ledPin = 13; // select the pin for the LED
int SPKPin = 6;
int sensorValue = 0; // variable to store the value coming from the sensor
int sensor2Value = 0; // variable to store the value coming from the sensor
float LiMinThreshold = 2700; // Lithium Minimal Voltage for load removal
float LiMaxThreshold = 4200; // Lithium Max Voltage for load removal
float NmhMinThreshold = 950; // NMH Minimal Voltage for load removal
float NmhMaxThreshold = 1600; // NMH Max Voltage for load removal
float SelectedMinThreshold = 5000;
int i;
int BatVoltage = 5000;
int FetVoltage = 5000;
long TotalCurrent = 0;
boolean done = false;
unsigned long PrevMillis ;
unsigned long MillisPassed ;
void CL2(){
lcd.setCursor(0, 1);// Second line first char
lcd.print(" ");
lcd.setCursor(0, 1);// Second line first char
}
void setup() {
Serial.begin(9600);// start serial port to send data during run to the PC
pinMode(ledPin, OUTPUT);//activation led and enable for FET
pinMode(SPKPin, OUTPUT);//activation led and enable for FET
lcd.begin(24, 2);// set up the LCD's number of rows and columns:
lcd.print("Bat PWR Tester[Active]"); // Print a message to the LCD.
lcd.setCursor(0, 1);// Second line first char
lcd.print("Detecting Bat Type..."); // print voltage value
delay(2000);
lcd.setCursor(0, 1);// Second line first char
lcd.print(" ");
lcd.setCursor(0, 1);// Second line first char
digitalWrite(ledPin, HIGH); // set the LED on
sensorValue = analogRead(sensorPin); // read the value from the sensor:
digitalWrite(ledPin, LOW); // set the LED off
// Detecting battery type
BatVoltage = sensorValue*4.887;
if (BatVoltage > 4500){
lcd.print("Warning high-V! ");
done = true;}
else if (BatVoltage > LiMinThreshold){
lcd.print("Type:Li-Ion Bat ");
SelectedMinThreshold = LiMinThreshold;}
else if (BatVoltage > NmhMinThreshold){
lcd.print("Type:NiMH/Cd Bat ");
SelectedMinThreshold = NmhMinThreshold;}
else{
lcd.print("Unknown Bat V<1 ");
done = true;}
lcd.print("V=");
lcd.print(sensorValue*4.887); // print voltage value
Serial.print("DT[ms]");
Serial.print("\t");
Serial.print("Bat[mV]");
Serial.print("\t");
Serial.print("Fet[mV]");
Serial.println("");
delay(3000);
CL2();
PrevMillis = millis();
}
void loop() {
if (BatVoltage > SelectedMinThreshold && !done) {
digitalWrite(ledPin, HIGH); // set the LED on
sensorValue = analogRead(sensorPin); // read the value from the sensor:
sensor2Value = analogRead(sensor2Pin); // read the value from the FET:
FetVoltage = (sensor2Value*4.887);
BatVoltage = (sensorValue*4.887);
CL2();
lcd.print("V=");
lcd.print(BatVoltage); // print voltage value
lcd.print("mV");
//lcd.print(FetVoltage); // print voltage value
TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6;
lcd.print(" I=");
lcd.print(TotalCurrent/1000);
lcd.print("mAH ");
delay(1000);
MillisPassed = millis()- PrevMillis;
PrevMillis = millis();
Serial.print(int(MillisPassed));
Serial.print("\t"); // prints a tab
Serial.print(BatVoltage);
Serial.print("\t"); // prints a tab
Serial.print(FetVoltage);
Serial.println(""); // prints a tab
CL2();
}
else
{
done=true;
digitalWrite(ledPin, LOW); // set the LED off - stop loading
lcd.setCursor(0, 0);// First line first char
lcd.print("Bat Power Tester [DONE] "); // Print a message to the LCD.
CL2();//clear line 2
sensorValue = analogRead(sensorPin); // read the value from the sensor:
BatVoltage = (sensorValue*4.887);
lcd.setCursor(0, 1);// Second line first char
lcd.print("V=");
lcd.print(BatVoltage); // print voltage value
lcd.print("mV I=");
lcd.print(TotalCurrent/1000);
lcd.print("mAH ");
for (int i=0; i<100 ; i++){
digitalWrite(SPKPin, HIGH);
delay(1);
digitalWrite(SPKPin, LOW);
delay(1);
}
delay(1000);
}
}
Step 10: The schematics ...
you can Also find how to connect standard LCDs on the same site so no need to copy it all here.
Step 11: Please support my work by voting for me !
Thanks you for reading and feel free contacting me with any questions / remarks .
I am now an Arduino expert (naa I am not - 2 weeks XP )
But I have many new project I would like to do .






















































Visit Our Store »
Go Pro Today »




For the discharge current I need A0 of the UNO. The OPamp is TLC2262 (Rail-to-Rail), the N-Fet is a Low-Level with small Ron.
i have changed the device, now it's possible to discharge 1 to 4 batteries and the discharge current is adjustable from 10 mA to about 1A withe a potentiometer .
I changed the device:
- it's possible to discharge 1 to 4 (5max) batteries parallel
- it's possible to discharge NiMH/NiCd or Lion batteries
- the discharge current is adjustable between about 10mA to about 1A
- it has a 132x164 ? cheap Color GLCD (Siemens S65) to display the discharge voltage over time (max 300min) and in text form the battery voltage and the discharged energy (mWh).
- it used the ATMega328P with Arduino Libs (S65) (runtime board or Arduino UNO / Duemilanove)
mausi_mick
A0 is going to the + of the Akkumulator/Battery, A2 to the Drain of the N-Fet, different from the schema. Normally Power FET's have Drain on Pin2 (in the mid).
I try to rebuild it with a Color GLCD-Display , perhaps from the Simens S65 Phone.
LOG
Hello gentlemens!
theme - Super Joule Ringer 2.0 in overdrive! http://www.youtube.com/watch?v=homZvbKZHlU&feature=relmfu
how to purchase (ICH) OP45224-KIT I understood - http://www.surplussales.com/Inductors/FerPotC/FerPotC-2.html
please indicate me - where can I buy two devices to it black and blue color? what kind of devices and their specifications? give me a link ... please! vadim.vadimuh@gmail.com
Would it be possible to alter the load to be a variable resistance that it say also programmable with the kit, if not what is the lowest resistance value that could be used on that particular circuit?
I am asking this as I have a collection of batteries from China that have huge power claims, but in reality they are not anywhere near that claim. the reason being is the way they are tested. If they are tested on a small load (high resistance) then the response curve provides a far better result than if used on a low resistance load.
What I want to do is to make somethig that will give me a good graph of the battery characteristics under real usage loads. I am talking from the 0.8 Ohm to a 3.5Ohm load on them.
1) purchasing an icharger, they're a nice middle ground of graphing and capable chargers, but not being too expensive. You have have them discharge at high loads by discharging into the power source, which you have be a big lead acid battery.
2) Look into "celllog halogen light discharger" or "watt meter halogen discharger." You can make a good dischargre using halogen lights.
3) You can modify this project to open gates to more resistors in parallel. I am not a huge fan of this method. I think the cost will be similar to either of the above, with out benefit.
4) If you bought a bunch of 18650 from ebay, or any shady aliba-style site, you're screwed. Most 18650 sold from cheap sellers is shit, and you still have to be worried about higher priced but inscrupable sellers (like tenergy). If we're talking LiPo, thats a different story, and there are both legit and bad sellers from low-cost chinese suppliers.
A friend is just about to develop a custom battery with Tenergy - they look like a decent company .
Do you have bad experience with them ?
Pls send me any info you have about them .. he is about to send them many K$ very soon.....
Thanks
That said, ***I have not had first-hand experience with their lithium batteries***.
However, they're not anything cutting edge in the realm of lithium, which is dominated by really big players, and they seem to have fallen out.
Even though I'm not a battery expert, I have a bit of knowledge, and I could probably make some recommendations for your friend if you give me more details about the application and scale. Not to clutter the thread, or just to keep it public domain, you can either PM me or just reply to this comment.
There are several lithium chemistries, and exactly the choice you'd make depends on several variables. My experience comes from electric bikes, and the folks at endless-sphere.com, but luckily electric bikes kind of run the gamut of applications, from low power 1C rates to high power 20C rates. A generalalized summary:
LiFePO4, the traditional "safe" chemistry. If you're using a low power system (discharging over 1-2 hours, but not faster), you can buy from a suitable chinese seller, like Ping-batteries. They typically use BMS. The high power brand is "A123" whose batteries have very recently been showing up on the gray market at a low price. I'd choose these guys if you're making a less volume sensitive large pack (LiFePO4 is gravimetrically reasonably dense, but volumetrically noticeably less dense than the other chemistries). They have 20Ah pouchs, better than tiny 2ah cells, a great product, and recently a very sweet pricepoint.
LiPo: LiPo (Lithum Polymer) is a variant method of constructing LiCo (lithium cobalt). They're designed for extremely high rate discharge, often used in the RC toy world. Not a great cycle life, but if treated right, a good price point for a very lightweight semi-short range Ebike. You have to know how to use them though, because their danger is substantially higher than other chemistry.
LiCo, 18650. These are designed for the Laptop world. Low Power, but very dense energy. Leave them in the Laptop world. They're poorly suited for other applications, unless you really are scavenging and know what you're doing and make a massive pack.
LiMn: These are slightly older, well known as being sourced from Konion LiMn tool packs, but also available elsewhere. They for a long time were a nice middle ground between LiFePO4 and LiCo in terms of performance and density and safety. With the likes of A123 high power LiFePO4 and advancements in LiPo and NMC, they've largely fallen out of favor. It might also do with the fact I don't think there have been manufacturers producing this chemistry on a large scale recently. A nice plus is they effectively self-balance, no BMS needed.
LiNMC: This is the newest chemistry, at least in quality form now. There are sellers of crappy version of this chemistry (like Allcell), but thats because they're repacking the ones in 18650 format designed for laptops (the largest lithium market). For most non-laptop applications you want to be looking at the beautiful cells from EIG, Dow Kokam, or Lg Chem. They're pretty hard to find though, because they don't really sell to hobbyists. You can buy the Dow Kokam guys (sweet cells, but EIG and Lg Chem are a bit better) from FFRTrikes, a random bike company (they made a bulk order and resell batteries since they also do electric bikes.) These are about twice to thrice the cost of A123 on the graymarket, though, in part because they're newer and in part because A123 has very recently plummeted in cost on the gray market.
Hey! I apologize! I just went off on a semi-useless battery rant. But as this might be useful fodder, I'll leave it up.
I cannot name any use these days for NiMh, unless you're recovering from an old Prius pack or otherwise have a unique source for it (or you're dealing with an old system and MUST use NiMh). Basically there's a lithium chemistry for any application of NiMh, and the costs are comparable or lower, because Lithium dominates the economy of scale.
But I would gain hours to get these curves for four batteries at the same time. Do you think it is possible to modify it this way?
fixed the code after a long night. i can get the setup to start up and the lcd turns on. it will then pick up what type of battery is connected and will measure the voltage and current of the battery, but the led wont illuminate which leads me to believe the mosfet is not switching on. im using a irf540a with a rds on of .052 ohms. any ideas?
Ive been using a 1.3v 1200mah AA rechargeable battery nimh.
any ideas?
thanks
i copied the code above directly into ardunio 0022 program. i have the duemilanove clone.
it comes up with the following errors:
dunkbat.cpp:3:10: error: #include expects "FILENAME" or
dunkbat:3: error: 'LiquidCrystal' does not name a type
dunkbat.cpp: In function 'void CL2()':
dunkbat:23: error: 'lcd' was not declared in this scope
dunkbat.cpp: In function 'void setup()':
dunkbat:31: error: 'lcd' was not declared in this scope
dunkbat.cpp: In function 'void loop()':
dunkbat:76: error: 'lcd' was not declared in this scope
dunkbat:99: error: 'lcd' was not declared in this scope
any ideas im a complete noob
thanks
paul
This is because the include file is not mentioned at the start. if you do: Sketch> Import Library>liquidcrystal , it will add the necessary header file to the sketch and compile correctly.
The FET voltage terminal is seems don't have connection to the drain circuit, how it's can give analog input (FET voltage) to arduino?
its a fantastic circuit and ive started to build it. have you by any chance got a higher resolution of the diagram above i cant zoom in enough? thanks
Isn't that the power of Instructables?
Pin "fetVoltage[plus]" on discharge circuit is left floating around. Could you confirm this? Thanks for great work anyway.
i will then alter it to work with 36v 14ah lithium polymer batteries somehow :-) if you have any ideas that would be great
$ diff my.cpp orig.cpp
7,8c8,9
< int ledPin = 8; // select the pin for the LED
< int SPKPin = 9;
---
> int ledPin = 13; // select the pin for the LED
> int SPKPin = 6;
18c19
< int FetVoltage = 0;
---
> int FetVoltage = 5000;
66,67d66
< Serial.print("\t");
< Serial.print("Capacity[mAH]");
75c74
< if ( (BatVoltage-FetVoltage) > SelectedMinThreshold && !done) {
---
> if (BatVoltage > SelectedMinThreshold && !done) {
86c85
< TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/10/3.6;
---
> TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6;
98,99d96
< Serial.print("\t"); // prints a tab
< Serial.print(TotalCurrent/1000);
Should this statement:
"if (BatVoltage > SelectedMinThreshold && !done) {"
be replaced with this:
"if ( (BatVoltage-FetVoltage) > SelectedMinThreshold && !done) {"
Thanks for the great instructable. I just finished building your design!
It has been a while a go and I dont remember exactly but as far as I do I connected two points on the battery as the voltage on the Bat is the difference between them (or was that over the resistor) .
Pls check if the voltage is not clearly just over the battery - If I got it wrong then there may have been a mistake yet the voltage drop over a good FET (< 40mohm) could be neglected- o that may be the reason .
TotalCurrent=TotalCurrent+MillisPassed/1000*(BatVoltage-FetVoltage)/2.2/3.6;
Copy paste into excel and make a graph for it .