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 05-26-2009, 06:39 AM   #1431 (permalink)
EcoModding Lurker
 
Join Date: Feb 2009
Location: Jacksonville, Florida
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by dcb View Post
Hope I'm not intruding, but here is an outline of how I might handle interrupts (just using bytes for example)
Nope, not intruding.... just interrupting....

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 05-26-2009, 07:19 AM   #1432 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
Quote:
Originally Posted by dlaing View Post
dcb,
I really like your code for the ISR's.
It looks like Paul has the ADC clock at 1MHz (which means he should only use 8 bits of the result). Other than the first result the ADC takes 13 ADC cycles, or about 13us. So we can read the current for every ISR with plenty of time for everything else.
Sorry about the 10khz part, thanks for the catch. that was a different platform (arduino @ a fixed 10bit adc). You shouldn't miss any timer1 body invocations in that case.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 05-26-2009, 07:51 AM   #1433 (permalink)
EcoModding Lurker
 
Join Date: May 2009
Location: Bucharest,RO and Copenhagen,DK
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
dcb,

There is smth funny with the adc channel selection code. Why do you use 0, 1 and 2 ADDed into the mux. Shouldn't we use 1,2 and 4 bitwise OR to the MUX ?
  Reply With Quote
Old 05-26-2009, 08:06 AM   #1434 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
It shouldn't matter (assuming the existing code works). ORing is the same as adding if the relevant bits start at zero anyway. I was replicating the existing code a "bit" .
PHP Code:
void ReadTemperature(void) {...
    
ADMUX &= (128+64+32+16);    // = 11110000.  So, this sets MUX to 0000, and leaves the top 4 bits unchanged.
    
ADMUX++;        // This sets MUX to 0001, setting the A/D converter input to PIN 24, the temperature monitor.
...

void ReadThrottle(void) {...
    
ADMUX &= (128+64+32+16);
...

void ReadCurrent(void) {...
    
ADMUX &= (128+64+32+16);    // = 11110000.  So, this sets MUX to 0000, and leaves the top 4 bits unchanged.
    
ADMUX+=2;        // This sets MUX to 0002, setting the A/D converter input to PIN 25, the current monitor
... 
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 05-26-2009 at 08:21 AM..
  Reply With Quote
Old 05-26-2009, 09:48 AM   #1435 (permalink)
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,831

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,367
Thanked 1,115 Times in 730 Posts
If there will be plenty of time for everything else, I'd like to slow down the A/D clock, because the LEM current transducer has pretty poor resolution for its output. For example, on the LEM 300, a current from 0 to 300 amps corresponds to an output of 2.5v to 2.5v + 0.625v. All the smooth driving is based on current being proportional to throttle position. If I get 32 possible values for outputs in the range 0 to 300 amps... Wait! That's when the circular buffer probably comes in handy. I get a much larger range of currents that way. Maybe I could do 500 kHz sample rate if there's time. (A/D prescaler of 32 instead of 16)

P.S.: Sorry about the nonstandard way of setting A/D channel for conversion. It's sort of like I was on a desert island, and was just programming as if there were no standards at all, just reading the ridiculous 308 page documentation and making stuff up as I went.
__________________
kits and boards
  Reply With Quote
Old 05-26-2009, 10:34 AM   #1436 (permalink)
Master EcoModder
 
Join Date: Apr 2009
Location: Charlton MA, USA
Posts: 463

EVVette - '71 Chevy Corvette Coupe
Thanks: 31
Thanked 172 Times in 92 Posts
Ok, So I have been working on this for a few days now. It is a program to access the controllers settings from a windows based computer using the serial port. It is only graphical right now as there is nothing set up on the controller as far as I know for accessing the settings. I included 3 rolling graphs to display throttle, current and temp. Should be helpful. You can change the read speed as well. Hope you enjoy. Once paul finish's the pi loop stuff hopefully he can implement the serial stuff. I was thinking we can create profiles for different voltages and motor combinations that allow for best performance.

Again, Enjoy.

-Adam
Attached Thumbnails
Click image for larger version

Name:	Temp 2.jpg
Views:	113
Size:	125.4 KB
ID:	3564   Click image for larger version

Name:	Current 2.jpg
Views:	83
Size:	126.0 KB
ID:	3565   Click image for larger version

Name:	Throttle 2.jpg
Views:	70
Size:	126.7 KB
ID:	3566  
  Reply With Quote
Old 05-26-2009, 10:45 AM   #1437 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
talk to me adam, does it have to be windows only? I'm pretty good with a serial port in java. Maybe time for a separate thread for user interface stuff that is looming (maybe built in display, standalone is nice)?
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 05-26-2009 at 10:52 AM..
  Reply With Quote
Old 05-26-2009, 10:52 AM   #1438 (permalink)
Master EcoModder
 
Join Date: Apr 2009
Location: Charlton MA, USA
Posts: 463

EVVette - '71 Chevy Corvette Coupe
Thanks: 31
Thanked 172 Times in 92 Posts
OOO Java, That would be cool. I would much rather use my Mac. lol. What do you mean by built in display? Like a dash console? I was thinking about something like that for my car. I will start a new thread soon about interface options for the Cougar controller.

-Adam
  Reply With Quote
Old 05-26-2009, 10:53 AM   #1439 (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 12 Times in 9 Posts
There must be off the shelf interrupt driven uart modules for this mpu... If you'd like I can detail a good com protocol for flexible and reliable data delivery.
  Reply With Quote
Old 05-26-2009, 10:57 AM   #1440 (permalink)
dcb
needs more cowbell
 
dcb's Avatar
 
Join Date: Feb 2008
Location:
Posts: 5,038

pimp mobile - '81 suzuki gs 250 t
90 day: 96.29 mpg (US)

schnitzel - '01 Volkswagen Golf TDI
90 day: 53.56 mpg (US)
Thanks: 158
Thanked 267 Times in 210 Posts
The atmegas have onboard uart (with interrupts), so I don't know what it would add, unless I'm missing something.

What might be cool is a "standard" lcd display (2x16 char or whatever) with a couple buttons and rs232 interface, kind of a "dumb terminal" for embedded use.

__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  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 3471 Yesterday 10:53 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 - 2020, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com