Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 07-04-2009, 11:22 AM   #131 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,202 Times in 765 Posts
Here's a code sample of what I mean, where pwmDuty is in the range 0-16352. You want it so that it scales to 0-511, not 0-512 (so don't use 0-16383, which is 2^14 - 1). You don't even have to have a separate pwmDuty variable that actually is in the range 0-511. Just change pwmDuty at the end. Let's say you want the current to stay constant at "targetCurrent":


ReadCurrent();

if (current < targetCurrent) {
pwmDuty++;
if (pwmDuty > MAX_PWM_DUTY) {
pwmDuty = MAX_PWM_DUTY;
}
}
else if (current > targetCurrent) {
pwmDuty--;
if (pwmDuty < 0) {
pwmDuty = 0;
}
}

if ((pwmDuty & 31) >= 16) { // round up!
OCR1A = (pwmDuty >> 5) + 1;
}
else {
OCR1A = pwmDuty >> 5;
}

__________________
kits and boards
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 07-05-2009, 05:45 PM   #132 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 48 Times in 38 Posts
nice! i tried the 'finePWM' thing and it works great! I have a pot thats read into the ADC to set the desired current and the program changes the duty cycle until the current reading matches it (after a little scaling).

I did a proportional method that's overdamped - the current just ramps up to the desired current and levels off without any overshoot. I even moved my alligator clips around so that the load resistance reduced to about 1 ohm and the current control was still stable. That should be about right for my pack of 72 cells, but i bet a pack of AGMs would be less. I have a 12V AGM i can test it on - i'm just a little nervous about testing on a battery for whatever reason...

anyway, i could control the current up to 20A and down to 1.5A with the pot. I think my opto-isolation circuitry messes with the low duty cycle output which shouldn't be a problem with a battery (needs a higher dutycycle to overcome the battery's voltage).

here's the part of the control code...
USERcurrent is the setting from the pot, outputcurrent is from the current sensor, and PWMfine is a 16bit variable.

Code:
		currenterror=USERcurrent-outputcurrent;
		deltaPWM = currenterror/2;
		PWMfine=PWMfine+deltaPWM; 

		OCR1A=PWMfine/128;
  Reply With Quote
Old 07-05-2009, 09:42 PM   #133 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,202 Times in 765 Posts
Joe! You and your fancy P loop! hehe. Awesome job! I think you might be right about agms. Very low internal resistance. I can't wait to see if you blow something up! This is so exciting! A charger that can go up to 20 amps isn't cheap. Manzanita 20amp chargers are like $2000 I think. So, if you can keep the DIY parts price below, say... $1500, I would say you are doing a huge service to the EV community! I have a bunch of 220uF 450v ripple caps and high voltage mosfets and igbts that someone sent me, and I want to make a charger like your fancy one! ya!
__________________
kits and boards
  Reply With Quote
Old 07-17-2009, 01:56 AM   #134 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 48 Times in 38 Posts
So. It's been tough splitting my time between this project and installing the new controller from Paul. Pretty much, I work on the car in the evening while it's still light and not so f-in hot, then go in and play around with the charger.

I finally worked up the guts to hook it up to a battery, so I grabbed the 12v atm out of my ecar (it's all torn apart anyway while I install the controller) and connected the alligator clips. I did a couple tests at low current to see how the current sensor was working. Even down below an amp, the output was filtered enough by the cap I have on the adc input to be constant. Then, enabled the control loop in the code and let her rip! No problems. The control loop held the current constant without a hitch. I only went up to 8 amps since I knew the battery was already fairly charged.

Next step is voltage measurement and programing it all into some sort of charge algorithm.
  Reply With Quote
Old 07-17-2009, 02:03 AM   #135 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,202 Times in 765 Posts
This is awesome!!! I was really wondering how different it would be on a real battery. Oh ya!!! I'm excited about the charging algorithm. I need to make one of these buggers! Awesome Job!!!!!

YOU CAN'T TEACH THAT, IT'S INSTINCT!!!

EDIT: You took an ATM out of your car? Did you take it from a bank? Can I have some of the money?
__________________
kits and boards
  Reply With Quote
Old 07-17-2009, 11:33 AM   #136 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 48 Times in 38 Posts
Quote:
Originally Posted by MPaulHolmes View Post
EDIT: You took an ATM out of your car? Did you take it from a bank? Can I have some of the money?

i did! it's awesome! my car is a spontaneous ATM generator, so ya i'll send some your way!

oops, i meant agm...
  Reply With Quote
Old 07-22-2009, 02:35 PM   #137 (permalink)
EcoModding Lurker
 
Join Date: Mar 2009
Location: Seattle, WA
Posts: 57
Thanks: 0
Thanked 2 Times in 2 Posts
anyone knows the updated total price to build this or purchase this fully assembled?
__________________
EV59rag

Parting out my EV.
ES-31C D&D Motor
Alltrax 7245 Controller
Paul & Sabrina's Controller (never used)
  Reply With Quote
Old 07-22-2009, 07:07 PM   #138 (permalink)
EcoModding Lurker
 
Join Date: Jul 2009
Location: Seattle
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
I'm really interested in building my own charger. This thread rocks!!! I was thinking that it might be almost as simple to use a buck/boost regulator instead of a voltage doubler and then a buck and then the pack voltage capability would be pretty much anything people could want (I'm shooting for a 360V nominal pack in my car). Am I missing something that would make this technically infeasible assuming a PIC is used to control the PWM and the charger algorithm? This is pretty much what I'm thinking of:
Attached Thumbnails
Click image for larger version

Name:	concept.jpg
Views:	95
Size:	23.5 KB
ID:	3898  
  Reply With Quote
Old 07-23-2009, 03:40 PM   #139 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 48 Times in 38 Posts
Quote:
Originally Posted by ev59rag View Post
anyone knows the updated total price to build this or purchase this fully assembled?
Unfortunately, I've been adding things to the circuit without really keeping track. The biggest chunk of the cost is probably the power components. Of course, all the little things add up quick - I think I had an estimate of 300-400 for everything so far. Depends on how crazy you want to get with a box and switches and everything. It'd be nice to add an LED display or something, but that adds more cost. I think if we're under 500 for something very functional, it's a winner. I think I also mentioned that lower voltage/lower amperage would be easier and cheaper to do.

At some point, when this design gets to a full prototype, it'll be easier to put together a bill of materials. as of now, all i have are estimates.
__________________
ReVolt AZ testing thread:

http://ecomodder.com/forum/showthrea...ting-9325.html
  Reply With Quote
Old 07-23-2009, 03:48 PM   #140 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 48 Times in 38 Posts
Quote:
Originally Posted by vwdevotee View Post
(I'm shooting for a 360V nominal pack in my car). Am I missing something that would make this technically infeasible assuming a PIC is used to control the PWM and the charger algorithm?
nope! So what I have so far is just a buck stage, but adding a boost stage would allow for higher voltages. My test on a 12V battery was from 120VAC, while I'd have to run off of 240AC to charge my 144V pack. A boost stage would eliminate that.

Actually, instead of a simple boost stage, what I really want to do is add a PFC stage. It'll act a boost stage and boost any input voltage from 120 to 240AC to ~400VDC, but do so such that there is close to unity power factor. So it'll act as a boost stage, allow the user to plug into any outlet without having to flip a switch or something (maybe lower the power), and could charge higher voltage packs.

I think it'll be easy to add that later (famous last words) after the buck stage and charging algorithms are figured out.

__________________
ReVolt AZ testing thread:

http://ecomodder.com/forum/showthrea...ting-9325.html
  Reply With Quote
Reply  Post New Thread


Tags
ev charger



Similar Threads
Thread Thread Starter Forum Replies Last Post
Electric car conversion: Project ForkenSwift MetroMPG Fossil Fuel Free 1041 07-28-2014 09:19 AM
Any interest in developing an open source fuel economy gauge/computer? MetroMPG OpenGauge / MPGuino FE computer 182 06-25-2010 07:00 AM
Open source PCB design dcb OpenGauge / MPGuino FE computer 39 04-25-2010 09:18 PM
Open Source electric conversion information bennelson Fossil Fuel Free 8 02-14-2009 11:23 AM
Open Source LEV Controller FrankG Alternative Transportation 1 03-24-2008 03:10 AM



Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com