Go Back   EcoModder Forum > EcoModding > Fossil Fuel Free > Open ReVolt: open source DC motor controller
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 07-22-2009, 11:31 PM   #2061 (permalink)
EcoModding Lurker
 
Join Date: Apr 2009
Location: Maine
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Paul, I don't see where this should be having the problem you are describing; if the code is correct, then at low or no RPM and throttle at 1, then when the current rises, the code should be cutting PWM to keep the equation balanced, but if PWM goes to 1 and current is still too high to keep the equation balanced, the problem is not the equation but rather just not having enough steps to bring PWM small enough.

If you can not increase the number of steps, then a possible workaround would be scale PWM exponentially to the 512 steps the code is able to use, or at least for the first 170 steps and then linear for the last 342 steps. (that would be to keep the high end of the scale from getting to jumpy, yet enable precision where it is needed at the low end.

Edit; thinking about this further, I think the formula for a hyperbola would be ideal to set your 512 scale to for all 512 steps. Hyperbola - Wikipedia, the free encyclopedia



graph upper right, green, minus the offset from 0.

__________________
"Experience is something you get right after you need it !"

http://www.diyelectriccar.com/garage/cars/143

http://www.diyelectriccar.com/forums...tor-32083.html

Last edited by blackpanther-st; 07-22-2009 at 11:55 PM..
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 07-22-2009, 11:34 PM   #2062 (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
Hey David! I somehow missed that. It looks like a very nice idea. I guess we need to measure the voltage, and to input it into an A/D channel. But it has to be isolated. We would need to know the system pack voltage. Right now the controller doesn't take that into account. n

Rollins! I'll take a look at that. Thanks!
__________________
kits and boards
  Reply With Quote
Old 07-23-2009, 12:08 AM   #2063 (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
power = current*pwmDuty.

But the problem is, 500 amps * 0.01v = 5 watts, and 0.01 amp * 500v = 5watt.

When the rpm is 0, the motor is almost a short circuit. So, to allow very very small pwm (very low power) still allows for big current. I don't see how throttle = power allows for control of current at near 0 rpm.
__________________
kits and boards
  Reply With Quote
Old 07-23-2009, 12:18 AM   #2064 (permalink)
Joe
 
Join Date: Feb 2009
Location: phx
Posts: 260
Thanks: 0
Thanked 48 Times in 38 Posts
Testing temperature update!

My probe thing is whacked!

I brought out the rice cooker filled with water and put in a temp probe from my handy clamp meter and the 4th unused probe from my hacked together POS, turned it on and recorded the two values as the water temp rose.

at an actual temp of 58C, my probe read 102C
at an actual temp of 75C, my probe read 152C

I knew it was a little off at lower temperatures, but it's way off at higher temps!

So, firstly, if the top of the mosfet cases are only ~60C, and maybe it's a bit warmer at the junction, that might be ok. It was only a 4 mile trip around the block, so we'll have to see what happens on longer runs or harder accelerations.

secondly, i'd like to fix my frickin code! I didn't necessarily plan my circuit too well and ended up with quite a ridiculous ADC to Temp curve that's 3rd order. Straight from excel, I was using this:

tempfine=0.00000041*(ADC^3) - 0.00055497*(ADC^2) + 0.35803595*ADC - 6.14221231;

where tempfine was initialized as float. I'll admit that I really don't know how this works for microcontrollers - I initially coded it up and loaded it, saw a value that was roughly room temperature, then squeezed a probe in my hand and saw another number that was roughly body temp and concluded it was good! Obviously it isn't!

Any ideas?
__________________
ReVolt AZ testing thread:

http://ecomodder.com/forum/showthrea...ting-9325.html
  Reply With Quote
Old 07-23-2009, 12:43 AM   #2065 (permalink)
EcoModding Lurker
 
Join Date: Apr 2009
Location: Maine
Posts: 26
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by MPaulHolmes View Post
power = current*pwmDuty.

But the problem is, 500 amps * 0.01v = 5 watts, and 0.01 amp * 500v = 5watt.

When the rpm is 0, the motor is almost a short circuit. So, to allow very very small pwm (very low power) still allows for big current. I don't see how throttle = power allows for control of current at near 0 rpm.
yes but this is a problem no mater what formula you use; you simply can not get the PWM short enough (voltage low enough) to keep the current down. what you need is shorter pulse with finer control of PWM at the lower end of the 0 - 100% PWM range. If I remember correctly you are using a fairly high modulation frequency, so it should be easer for you to get that, but you may be limited by the resolution of the micro-controllers PWM control circuit.

I seem to remember reading that many of these micro-controllers have a multiplier for the clock that the PWM circuit uses, perhaps there is something there that you could work with to get the step resolution, without raising the modulation frequency to excessive levels? I don't know enough about the micro-controllers yet to know if that can be done.

Another possibility might be to stager your pulses to get the effect of virtual fractional steps below the real step of 1. the staggering would be done in code by alternating between step 0 and step 1 in the required proportion to achieve the virtual fractional step requested by the throttle code. the timing of the staggering should coincide with the PWM modulation frequency.
__________________
"Experience is something you get right after you need it !"

http://www.diyelectriccar.com/garage/cars/143

http://www.diyelectriccar.com/forums...tor-32083.html

Last edited by blackpanther-st; 07-23-2009 at 11:08 AM.. Reason: changed virtual fractional step for modulation frequency in second paragraph
  Reply With Quote
Old 07-23-2009, 01:36 AM   #2066 (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
I don't think the problem is lack of resolution. The problem is that it's perfectly fine (according to the throttle-power scenario) at zero rpm for the current to go to 500 if the duty is very small, since all that matters is the product of current and duty. There would be no reason in the throttle proportional to power scenario to keep one extreme from happening when the other is the opposite (huge current, tiny pwmDuty or tiny current, huge pwmDuty for tiny throttle). It wouldn't know to make current smaller, since the product would be small.

TEMPERATURE IDEA: How nonlinear are your thermistors? Maybe you could use 2 lookup tables. Make an array of maybe 63 entries (for example). One, 'R', would contain the resistances, and the other, 'T', would contain the corresponding temperatures. The 63 entries would contain the resistances for T1 through T63, where T1 would be the lowest (room temp?) and T63 would be the highest temp resistance ( for 120 degC???). T0 would be a waste since this algorithm would never reach R[0]. hehe.

Then, you could do a binary search:

i = 32;
delta = 16;

while (delta >= 1) {
if (measuredResistance < R[i]) {
i += delta;
}
else if (measuredResistance > R[i]) {
i -= delta;
}
else break;
delta >>= 1;
}
// Now, you know the approximate resistance, so get the corresponding temperature!
measuredTemp = T[i];
// So, you need a lookup table for the resistances, and for the temperatures
////////////////////////////////////////////////////////////////////////////////////
That should give you an accuracy of +/- 2 degC or so. It would be really really fast too. At most 6 if..thens.
__________________
kits and boards
  Reply With Quote
Old 07-23-2009, 05:47 AM   #2067 (permalink)
EcoModding Lurker
 
Join Date: Jun 2009
Location: Australia
Posts: 35
Thanks: 0
Thanked 3 Times in 3 Posts
Quote:
Originally Posted by chapper View Post
mcudogs: Nice work, PCB looks good.

I'd suggest an alteration that seems right, but I'm not sure it's necessary.
On the 1B top layer, the negs of the capacitors are on isolated islands. I'd connect them with a horizontal band at the top edge, about 0.50" so that you have a 5-fingered comb (B-) pointing down, and a 4-fingered comb (B+) pointing up.
Adjust the bottom layer so that you have a 4-fingered comb (B+) pointing down, and a 5-fingered comb (B-) pointing up. You also have the opportunity for 4 more B- vias.

It came to me while considering current balancing-equalizing, and all those opportunities to short B+ and B-.

It seems there should also be a fabrication drawing, with dimensions, hole sizes and conditions, notes, etc.

A question I would pose: Is current flow affected by sharp corners on a PCB trace? I know corners can be an issue with high frequencies. How about high current?

John
Chapper, that's a good idea for the B- mods, but I don't really want to put anymore time into the layout until Jyanof and Paul say that the temperature rise of the FET's is OK. We may have to do a total redesign of the board if there are heat problems.

Don
  Reply With Quote
Old 07-23-2009, 08:18 AM   #2068 (permalink)
EcoModding Lurker
 
Join Date: Jul 2008
Location: Memphis, TN
Posts: 58

2010 Prius - '10 Toyota Prius IV
Last 3: 51.4 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
You are controlling the PWM power via PI loop. But are you controlling the acceleration from one value to the next? In a pump controller I wrote, I wanted to control the acceleration smoothly. Why not add code that slews the current limited by some acceleration value.

Code:
#define RAMP_SPEED			20			// how much to increase the OCR0A value from one step to the next.
...
// This function runs every ms to ramp the actual PWM value from one speed to the next smoothly
	{
		// Read the current PWM value
		TC0_READ_16_BIT_OCR0AB(temp16);			// safe inside an interrupt
		if(requested_speed < temp16)				// is the requested spped less than the current speed?
		{
			// Our requested speed is either higher or lower than what we need
			temp16 -= RAMP_SPEED; 
			TC0_WRITE_16_BIT_OCR0AB( SERVO_CLIP(temp16) );
		}
		else if(requested_speed > temp16)
		{
			temp16 += RAMP_SPEED;
			TC0_WRITE_16_BIT_OCR0AB( SERVO_CLIP(temp16) );
		}
	}
	// ------------------------------------------------End Ramp
  Reply With Quote
Old 07-23-2009, 09:22 AM   #2069 (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
YO YO YO, Jayc! I did almost exactly that with the PI loop that controls current. I limit the rate of change of throttle. I could try it with current too. why not!?
__________________
kits and boards
  Reply With Quote
Old 07-23-2009, 09:39 AM   #2070 (permalink)
EcoModding Lurker
 
Join Date: Aug 2008
Location: Calgary, AB
Posts: 21

Corolla bandit - '05 Toyota Corolla CE
Thanks: 1
Thanked 1 Time in 1 Post
Paul, you're right about needing to know the pack voltage. What if we use the same voltage test hardware to measure the pack voltage while the controller is pre-charging the caps? We should be able to isolate the same way you isolate the undervoltage lockout. I don't believe we need great resolution, so we build the circuit to measure 0-200V, and if the traction pack is 36V we only have 180bits of resolution instead of 1024. Still enough to easily distinguish slow speed, and overspeed.

Slewing unfortunately doesn't help stop the current from going to 500A if the e-brake is on.

  Reply With Quote
Reply  Post New Thread


Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paul and Sabrina's Cheap 3 Phase Inverter (AC Controller) with Field Oriented Control MPaulHolmes Fossil Fuel Free 3480 05-04-2022 05:43 PM
Paul & Sabrina's Cheap EV Conversion MPaulHolmes Fossil Fuel Free 542 11-12-2016 09:09 PM
Three Dirt Cheap DIY Electric Cars - Part 5 SVOboy EcoModder Blog Discussion 0 12-12-2008 04:10 PM



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