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 02-09-2009, 10:19 AM   #371 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 17 Times in 14 Posts
Paul,

generally i try to design PI control in excel... but you may have better luck with a simple circuit to test it. Doing it "quickly" in excel is best for linear systems - yours is not.

Make a circuit that has a button and does a sudden switch from 0v to 1v. Have this output go to your throttle input. Tie your scope "trigger" lead to the button and the other lead to the current sensor. Push the button, see what happens.

If you wanted to get fancy about it, make your code examine itself. Instead of reading the throttle line, read a variable. On startup, make a 1 second timer, when it expires, set your variable to the equivalent of half throttle or full throttle and set a flag. When the PI loop sees the flag is set, have it start storing its output and input values in an array. Copy that array to the computer and you can examine your system response. With that, you could even tune your P and I values in excel without trial an error.

too much? Sorry, just brainstorming solutions...

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 02-09-2009, 06:50 PM   #372 (permalink)
EcoModding Apprentice
 
order99's Avatar
 
Join Date: Oct 2008
Location: Newport NC
Posts: 247
Thanks: 21
Thanked 47 Times in 27 Posts
A little something to go with all these Open Source Controller and Charger projects popping up:

Desulfator for 12V Car Batteries, in an Altoids Tin

Not mine (sadly, i'm just not that bright) but the creator has declared his Altoids-tin BMS as Open Source. What next, an Open Source DIY EV-capable motor? Not that I wouldn't give it a whirl...now where's that fire extinguisher?
  Reply With Quote
Old 02-10-2009, 03:17 AM   #373 (permalink)
EcoModding Lurker
 
Join Date: Jan 2009
Location: Russia
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by order99 View Post
What next, an Open Source DIY EV-capable motor?
I'm working around it - see page 18.
  Reply With Quote
Old 02-10-2009, 09:16 AM   #374 (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
Quote:
Originally Posted by MazdaMatt View Post
Paul,

generally i try to design PI control in excel... but you may have better luck with a simple circuit to test it. Doing it "quickly" in excel is best for linear systems - yours is not.

Make a circuit that has a button and does a sudden switch from 0v to 1v. Have this output go to your throttle input. Tie your scope "trigger" lead to the button and the other lead to the current sensor. Push the button, see what happens.

If you wanted to get fancy about it, make your code examine itself. Instead of reading the throttle line, read a variable. On startup, make a 1 second timer, when it expires, set your variable to the equivalent of half throttle or full throttle and set a flag. When the PI loop sees the flag is set, have it start storing its output and input values in an array. Copy that array to the computer and you can examine your system response. With that, you could even tune your P and I values in excel without trial an error.

too much? Sorry, just brainstorming solutions...
These are wonderful ideas! Not too much! Thank you! Hmm... Store results in an array, and copy it to the computer. I love that idea. I've never tried that. Is that what the EEProm is for? If I stored the array in standard memory, is it lost when the power is cut? I bet it is. I need to figure out how to use the PROM.

-Paul
__________________
kits and boards
  Reply With Quote
Old 02-10-2009, 09:36 AM   #375 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 17 Times in 14 Posts
Paul, you don't really need to do that if you can set up some serial communication to the board. It is generally very easy to do that. At work we generally use a USB to TTL converter from FTDI Chip Home Page. The TTL end of it connects directly to the cpu.

So here's the plan:
1 - set up a 1 second timer, a large array (as large as you can with that chip) and a fake_throttle variable set to 0.
2 - when the 1 second timer expires, set the fake_throttle = whatever 1V input would be read by the ADC.
3 - when the fake_throttle value != 0, put the control system output into the next spot in the array.
4 - when you have reached the end of the array, shut down your pwm and begin a serial communication routine that will spit out the whole array from the serial port.
5 - on your PC use some kind of port monitor, these are a good way of getting a stream of data in a copy/paste-able form, then drop it into excel for analysis.

For this data to be worthwhile, you need to be sure that your PI control is happening at a known interval, not just in the main loop. It is completely impossible to tune a PI controller that executes in the main loop because timing will always be different.

I hate to say that i'm too busy, but i am... i am really looking forward to punching some code on my own motor control - there is a set of "scrap" boards here at work that are basically just a coldfire processor with a bunch of IO. (really, i want to use them to make an AC motor control, but the PI could be transferable)
  Reply With Quote
Old 02-10-2009, 09:44 AM   #376 (permalink)
Deadly Efficient
 
Tango Charlie's Avatar
 
Join Date: Jun 2008
Location: Goshen, Indiana
Posts: 1,234

Olivia - '03 Pontiac Vibe base
90 day: 36.01 mpg (US)

R2-D2 - '00 Honda Insight
90 day: 58.81 mpg (US)
Thanks: 134
Thanked 176 Times in 91 Posts
Quote:
Originally Posted by MPaulHolmes View Post
It's like 625 pounds! Why the crap is a dang glorified drill press 625 pounds? Whatever. It's all good. My engine hoist can hoist 2000 pounds. So, if Oprah... Nevermind.
D'oh!
Mosfets, PI loops, triggers, eeprom...I dunno what the heck you guys are talking about, but Oprah jokes I GET!
NEVER pull up short on an Oprah joke!
__________________
-Terry
  Reply With Quote
Old 02-10-2009, 10:05 AM   #377 (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
Quote:
Originally Posted by Tango Charlie View Post
D'oh!
Mosfets, PI loops, triggers, eeprom...I dunno what the heck you guys are talking about, but Oprah jokes I GET!
NEVER pull up short on an Oprah joke!
I place full blame on my wife! haha! It's true though. She told me I had to stop picking on Oprah's... um... "black hole like" gravitational field.

MazdaMatt: I can do that serial interface. I need a dang laptop though. Due to living conditions, the computer and the motor controller test area are separated by a rather significant distance. I'll figure out something.

As for constant time for PI loop tuning, since I have the hardware current limiting built in (well, once the dang mail gets here I will), I won't need the current sampling to be very fast. I think I'll execute the PI loop from inside a timer interrupt that will be run about every 1 ms. I think that will work out very nicely. It will simplify the code too. I won't need a slowChangingThrottle, and destinationThrottle anymore.
__________________
kits and boards
  Reply With Quote
Old 02-10-2009, 10:19 AM   #378 (permalink)
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 17 Times in 14 Posts
Never underestimate the power of your processor. Make generous use of the timer interrupts, and feel free to run them FAST as long as you aren't doing long arduous calculations. Main loop doesn't make things run faster than if they were in a timer interrupt.

If you have an easy way (pre-written driver?) to burn values into eprom, you could do the exact same method as above, but instead of pipe the array out the serial port, you could just copy it to eprom, bring it to the computer and carry on from there.
  Reply With Quote
Old 02-10-2009, 07:38 PM   #379 (permalink)
EcoModding Apprentice
 
order99's Avatar
 
Join Date: Oct 2008
Location: Newport NC
Posts: 247
Thanks: 21
Thanked 47 Times in 27 Posts
Quote:
Originally Posted by motor_control View Post
I'm working around it - see page 18.
Please keep us informed...I can't wait to see your results!

Lessee-Open Source Controller, Charger, Desulfator, Motor, DIY Headlights, hmmm...now we just need a few Open Source DIY Chassis and we could give away plans for an Open Source EV on the Net!

So, can suspension, wiring bundles and turn signals be copyrighted? Or can anyone make them if those parts became unavailable?
  Reply With Quote
Old 02-11-2009, 12:50 AM   #380 (permalink)
EcoModding Lurker
 
Join Date: Jan 2009
Location: Russia
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
AVR: Very Hi Voltage Programming
http://www.youtube.com/watch?gl=RU&hl=ru&v=EHOxc-FvaUs

Quote:
Originally Posted by order99 View Post
Please keep us informed...I can't wait to see your results!
خت !

  Reply With Quote
Reply  Post New Thread




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