Beginners Guide to Processing 18650 Cells | Cell Database


Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
All new design with intelligent control
#31
Keep the work up m8 Smile
Follow me! >> YouTube / Forum system setup / My webpage  Diy Tech & Repairs

Current: 10kW Mpp Hybrid | 4kW PIP4048 | 2x PCM60x | 83kWh LiFePo4 | 10kWh 14s 18650 |  66*260W Poly
Upcomming: 14S 18650~30kWh | Automatic trip breakers, and alot more
Reply


#32
I have two more difficult versions of the code running and it works fine ( I got help from the good people over at EEV Blog) but I am having a hard time with the "simple code." Daromer, I thought you were good at this stuff, why is it you refuse to help with this project?
Reply
#33
I have not refused to help. When did I say that?

I would love to help in most of the projects but honestly I hardly got time to do my own Smile If i get more time to spare further onward I will lend a hand as well.
Follow me! >> YouTube / Forum system setup / My webpage  Diy Tech & Repairs

Current: 10kW Mpp Hybrid | 4kW PIP4048 | 2x PCM60x | 83kWh LiFePo4 | 10kWh 14s 18650 |  66*260W Poly
Upcomming: 14S 18650~30kWh | Automatic trip breakers, and alot more
Reply
#34
(08-03-2017, 06:33 AM)Inverted 18650 Wrote: Hey All,

I received a new order so I have been testing cells for hours on end and replying in other posts but haven't made an videos yet. The good news is I did film a bunch of footage just have to edit and upload it. I did have a couple issues with the Arduino program because I kinda suck at it so expect more analog additions..until I learn more C/C++. If there are some coding wizs here that would like to help me out, id be stoked...having a bit of trouble with the 'while boolean' to turn off fets & counter but still save the mAh reading..trying to keep it simple only makes it harder..lol

Post the code. Point out the 'simple while boolean' parts that are a problem. Would like to help.
Runs with low voltage
Reply
#35
Will do.. it's all crazy right now..I have been trying to learn a little about "state machines" in the last few hours and that may be the solution... once I get back to the laptop I'll screenshot the "simple" one that I am having a hell of a time with..in short, I can't get the mosfet to turn off and stay off with the micro..it goes back into the loop and the batt voltage bounce s back up and the cycle restarts...the pin thats analogWrite (PWM), won't stay off after the digitalWrite, LOW whenever batt voltage goes below 3.0V.
Reply
#36
/*
this is not the orignal "simple" sketch, its lost int he mix of the 20 other tries on the laptop dashboard. but this is what i am trying to do. keep the coding very simple, if possible, and dont add anything else to the board, so we can measure 6 cells at once. I have a few differnt sketches that work fine but this "simple" one is kicking my ass.
Thanks for all the help..if youmeasure the voltage over the load resistr here it should be exactly a 1V drop, hence 1Amp over the 1 ohm resistor. Again this is not my original but ill find it and get it up too. I can add external compenonets, but that takes up PIN space, and I can add analog sensing but some people arent good with that stuff.

Thank to everyone that plays with this and helps, once it all working you be stoked to have a badass little SIX cell tester that works well and is easy to make.
 
Code:
*/

# define off_voltage 3.00//stops test when cell gets down to 3.0V
# define VRef 4.72//measured voltage at "REF" pin, adjust this to match your board
const int Mosfet_Enable = 3;//turns mosfet on and off
const int Batt_1_Voltage = A7;//voltage sensor
bool Discharge_1;// is test running
float measuredVoltage_1;//stores raw volts
unsigned long mAh;//stores final mAh

void setup(){
 
  Serial.begin(9600);//start monitor
  pinMode(Mosfet_Enable, OUTPUT);// PIN D3 is now an OUTPUT
  digitalWrite(Mosfet_Enable, LOW);//starts in the off position
  pinMode(Batt_1_Voltage, INPUT);//can read V
  }
void loop(){
measuredVoltage_1=(analogRead(Batt_1_Voltage) * (VRef/1023));//convert raw to analog V
 
 if (analogRead(Batt_1_Voltage > off_voltage)){  //if the battery voltage is above 3.0V, start test
    analogWrite(Mosfet_Enable, 180); //send PWM signal and applies ~3.5V to mosfet gate to allow 1V to flow from Drain to Source
    Discharge_1 = true;  //yep, were testing a cell now
    mAh = (millis()/3600000);/* need more HELP with this for sure!! i see others use previousMillis- currentMillis. Its a constant 1Amp load so 1000ma shoud flow every h, hence mAh.
     need the counter to stop counting once the test is done AND store the final counted mAh. remember we cant measure the current an waste an input pin( we can but dont want to).
    instead, if you measure 1V flowing over the resistor, you know you have 1A being pulled from the cell, or you can break the cicruit and measure amps in series on fet pin 2.*/
  }
 else if (measuredVoltage_1 < off_voltage){
   digitalWrite(Mosfet_Enable, LOW);
   Discharge_1 = false;
   pinMode(Mosfet_Enable, INPUT); /* this worked and turned everything off for a while, now I get an upload error- it Must be turned totally off becasue when discharging
  stops, the measured cell voltage will rise back up once the cell is no longer under load, and then the loop starts FET again..battery pulses up and down and never stops.*/
  }
  
Serial.print("V1 = ");   // label for 'cell 1'
Serial.print(measuredVoltage_1); // prints 'cell 1' voltage to monitor
Serial.print("\t");//prints blank space
Serial.print("mAh1 = ");// capcity cell 1
Serial.print(mAh); //total capacity
Serial.print("\t");//prints space
Serial.println();// makes the data on monitor form a nice neat line
}
Reply
#37
I haven't studied your code too closely to figure exactly what it's trying to do, but I did see a couple of possible issues:

I think the line
 if (analogRead(Batt_1_Voltage > off_voltage)){  //if the battery voltage is above 3.0V, start test
Should be
 if (measuredVoltage_1 > off_voltage)){  //if the battery voltage is above 3.0V, start test

Also, maybe it is intentional, but you have not catered for the condition where measuredVoltage_1 is exactly equal to off_voltage.
i.e. use >= in one condition or <= in the other.
Reply
#38
Ohhhh, I see your problem! You left out a semicolon Tongue
Inverted 18650 likes this post
Proceed with caution. Knowledge is Power! Literally! Cool 
Knowledge is Power; Absolute Knowledge is Absolutely Shocking!
Dollar Shave Club. Best Razor I've ever used
Certified 18650 Cell Reclamation Technician
Reply
#39
Watts,

You're right, good catch, but still need to solve the bigger problems. If you read the notes beside each line, I tell you where the main problems are...I think I have a fix, but it involves ending the simplicity..

You can use the sketch as is and just time the cells and watch the serial monitor, when the voltage hits 3.0V, just write down the mah ( because the counter will keep going up even after you take the cell out) & remove the cell..once all cells are done, and your ready for the next batch, push reset.

But using it like that sucks...I got some tips from the EEV Blog page too and I'm trying to sort it out, hopefully resolve it today.
Reply
#40
If you're trying to get the code to stop once it drops below 3V I would suggest something like the following:

Initialise Discharge_1 to true at startup:
change
Code:
 bool Discharge_1;// is test running
to
Code:
 bool Discharge_1 = true;// is test running

then change the line I mentioned in the previous post to:
Code:
   if ( ( measuredVoltage_1 > off_voltage && Discharge_1 == true )  //if the battery voltage is above 3.0V, start or continue the test

Also, move the Serial.print stuff into the above condition block so it stops printing when complete.

Also you asked about more help with the millis() thing.  Note that this example will only work (or to be more precise, will only correctly calculate mAh) immediately after a power up or reset, because you are calling millis() which is the number of milliseconds since the processor started running.  So if you wanted to, say, wait until the user pressed a button before starting, you will need to note the millis() at the start of the event and then deduct it from the current millis() during execution.

And finally, the line:

Code:
    pinMode(Mosfet_Enable, INPUT); /* this worked and turned everything off for a while, now I get an upload error- it Must be turned totally off becasue when discharging
looks a bit suspicious to me.  Unless you have a pull-up or pull-down resistor on that mosfet signal, then setting that pin back to an input will leave the signal to the mosfet floating and therefore in a unknown state.
I would have expected:
Code:
digitalWrite(Mosfet_Enable, LOW);
to have worked just fine.
Inverted 18650 likes this post
Reply


Who read this thread?
88 User(s) read this thread:
kazbach (08-15-2017, 06:40 PM), John.Siler (07-20-2017, 07:44 PM), Xander52 (07-18-2017, 01:57 PM), fr333n3rgy (07-18-2017, 02:52 PM), Terry (08-04-2017, 03:08 PM), Eric Koshinsky (08-19-2017, 10:37 AM), colishere (08-24-2017, 05:36 AM), Eric Snyder (08-05-2017, 05:24 PM), benjaminjohnsonquinones (07-30-2017, 07:22 AM), Robert Crawley (08-11-2017, 07:53 AM), Stew Mohr (08-07-2017, 10:47 AM), brafi (08-08-2017, 03:52 PM), Stefaan De Ridder (08-20-2017, 11:39 AM), maxmusmaarleyy3751 (07-16-2017, 04:15 AM), TomTinkerDIY (07-26-2017, 10:48 PM), Chiptosser (08-13-2017, 02:00 AM), Power Up (07-18-2017, 02:54 PM), systemtm (08-05-2017, 04:49 AM), Inverted 18650 (09-08-2017, 02:28 PM), BlueSwordM (08-07-2017, 02:57 PM), Happy Camper Homesteader (07-13-2017, 02:51 PM), Brownie (07-31-2017, 03:09 AM), KtB (08-26-2017, 02:21 PM), Jon (08-24-2017, 07:08 AM), brdashulze6965 (08-21-2017, 05:34 AM), floydR (08-27-2017, 04:04 AM), ebaugh (08-25-2017, 02:27 PM), horizon69 (09-05-2017, 04:05 PM), jrobida (09-06-2017, 04:12 AM), Gerard Achternaam (09-18-2017, 11:51 AM), David Parkes (09-14-2017, 05:12 PM), nautal (09-19-2017, 12:05 AM), climax85 (09-17-2017, 05:49 AM), Morgan Jones (08-19-2017, 03:14 AM), Pyro (08-08-2017, 10:35 PM), mayson14 (08-10-2017, 04:42 AM), Travis Watson (08-07-2017, 03:13 PM), Seedser (08-09-2017, 10:10 PM), LordGarak (08-10-2017, 04:19 PM), ktgohdt125 (08-10-2017, 01:53 PM), hexi (08-10-2017, 09:22 PM), iceisfun (08-28-2017, 05:03 AM), Geek (08-29-2017, 05:55 AM), SemaJG (09-15-2017, 10:57 AM), hbpowerwall (08-30-2017, 11:21 PM), Korishan (08-26-2017, 11:12 AM), A + A (08-26-2017, 03:36 PM), FERCSA (08-23-2017, 10:26 PM), Batrium (07-31-2017, 03:42 AM), Wattsup (07-14-2017, 11:52 AM), Scepterr (08-16-2017, 10:06 AM), BobinTN (09-07-2017, 05:34 PM), egam (08-04-2017, 04:39 PM), Alec_J (08-20-2017, 10:42 PM), ruby2 (08-27-2017, 01:42 AM), anishkgt (09-08-2017, 10:57 AM), AZ_Tekkie (07-30-2017, 02:33 AM), daromer (08-23-2017, 07:17 PM), FiremanDIYPowerwall (08-06-2017, 06:39 AM), mike (08-12-2017, 01:44 AM), PaulKennett (08-04-2017, 10:53 AM), Joaquinsfy (08-23-2017, 05:55 AM), owitte (08-12-2017, 10:24 PM), opus40 (08-05-2017, 02:18 AM), Majorphill (07-14-2017, 04:43 AM), badamaspetrovy3728 (08-05-2017, 01:57 AM), jdeadman (08-27-2017, 02:28 AM), watts-on (08-26-2017, 11:27 AM), Dan Lim (08-09-2017, 10:10 AM), jesusangel (08-26-2017, 08:42 AM), BamBamsBatteries (08-13-2017, 03:11 AM), Daggerzz (08-23-2017, 10:55 PM), Hanssing (08-26-2017, 07:54 PM), MetalFang (08-03-2017, 08:43 PM), kot (07-17-2017, 06:08 PM), Joost2 (08-22-2017, 05:14 PM), rebelrider.mike (08-21-2017, 05:02 AM), kktuo (07-22-2017, 11:36 AM), monsted (09-07-2017, 09:40 AM), crud (07-23-2017, 08:11 PM), 2146 (07-20-2017, 09:53 PM), wim (08-26-2017, 11:58 AM), frnandu (08-26-2017, 11:23 AM), typ49 (08-21-2017, 08:06 AM), bgegorasjnr1337 (07-25-2017, 11:22 PM), Jeremy Choy (08-23-2017, 08:04 PM), 1958 greyhound (09-24-2017, 11:43 AM), ismaildoganw (08-19-2017, 09:52 AM)

Forum Jump:


Users browsing this thread: 1 Guest(s)