Go Back   EcoModder Forum > EcoModding > Instrumentation > OpenGauge / MPGuino FE computer
Register Now
 Register Now
 

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 05-20-2008, 08:51 AM   #101 (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 269 Times in 212 Posts
Thanks Yoshi, you da man

Allow me respond for the benefit of the team.

Quote:
Originally Posted by Yoshi View Post
Our microprocessor is 8 bit and it is less powerful than Windows PC Intel chip,
LOL the cpu utilization on the mpguino is low, like 20% and theres plenty of free ram. It only does something interesting once a second when it displays the info. Actually thinking about upping the refresh rate to 1/2 a second. The atmega168 is more powerful than folks give it credit for, and the small interrupts will interrupt whatever is running to keep track of what the vehicle is doing. assembly NOT required

Quote:
Originally Posted by Yoshi View Post
My design is up to a single tank of gasoline distance.
Yup, there is a Trip class in mpguino so adding another arbitrary trip is a few lines of code.

Quote:
Originally Posted by Yoshi View Post
I saw your source.
I'm honored.

Quote:
Originally Posted by Yoshi View Post
It looks there was a bug in the millis() routine and they are going to remove the timer0_overflow_count variable.
You mean the arduino millis() that overflows after 9 hours. I'm aware of the bug, but didn't hear that they were going to remove timer0_overflow_count.
It is still there in arduino 11, but we can adapt if they do remove it. But I'm impressed at what a quick study you have made of the platform

Quote:
Originally Posted by Yoshi View Post
Again, my program is for a sigle tank trip, 99 hours 59 min 59 second max.
I'll have to take your word for it Many folks will appreciate having instant and tank and current and maybe a couple other trips to work with so they can track short and long term segments.

Quote:
Originally Posted by Yoshi View Post
The TACH signal is for my tachometer called SuperMID T-1.
Do you know if some cars do not put out an injector signal porportional to RPM? We were just going to add an injectorpulsesPer2Revolutions variable and do the RPM based on the number of pulses per second, or the microseconds between pulses.

Quote:
Originally Posted by Yoshi View Post
One more note...
When we manipulate the interrupt driven variables, we need cli() and sei() functions to disable/enable interrupts before and after the manipulation.
Please refer to following example.
http://www.arduino.cc/cgi-bin/yabb2/...1201890734/2#2
Maybe. It depends on the minimum time between events that affect a variable and how big the interrupt handlers are. Also sei and cli are global, might just want to mask the interrupts that share variables while you manipulate them. I will investigate further. I think arduino does it for you for attachInterrupt, which is just our injector signal. Also, I never quite got a handle on what happens if you get an interrupt while in an interrupt, does control return to the first interrupt eventually?

Quote:
Originally Posted by Yoshi View Post
Regards,
Yoshi
Thank you again Yoshi.

__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 05-20-2008 at 08:57 AM..
  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 05-20-2008, 10:57 AM   #102 (permalink)
SuperMID designer
 
Yoshi's Avatar
 
Join Date: Mar 2008
Location: Yokohama, JAPAN
Posts: 37
Thanks: 0
Thanked 13 Times in 2 Posts
Hi,
It's almost midnight in Japan, so just a quick note...
Quote:
Originally Posted by dcb View Post
You mean the arduino millis() that overflows after 9 hours. I'm aware of the bug, but didn't hear that they were going to remove timer0_overflow_count.
It is still there in arduino 11, but we can adapt if they do remove it. But I'm impressed at what a quick study you have made of the platform
arduino 0011 was release on March 28, and they changed the millis() on April 18.
http://svn.berlios.de/viewcvs/arduin...45&view=markup
timer0_clock_cycles variable is defined instead of timer0_overflow_count.
Quote:
Do you know if some cars do not put out an injector signal porportional to RPM? We were just going to add an injectorpulsesPer2Revolutions variable and do the RPM based on the number of pulses per second, or the microseconds between pulses.
No, I don't think so.
I observe the injector pulse width and RPM number are changing individually and no relations between them.
Quote:
Maybe. It depends on the minimum time between events that affect a variable and how big the interrupt handlers are. Also sei and cli are global, might just want to mask the interrupts that share variables while you manipulate them. I will investigate further. I think arduino does it for you for attachInterrupt, which is just our injector signal. Also, I never quite got a handle on what happens if you get an interrupt while in an interrupt, does control return to the first interrupt eventually?
I saw "attachInterrupt" source and found it's just initializing interrupt register.
I believe you'll see unstable calc results without setting cli().

Code:
//attach the vss/buttons interrupt
ISR( PCINT1_vect ){ 
  static byte vsspinstate=0;
  byte p = PINC;//bypassing digitalRead for interrupt performance
  if ((p & vssBit) != (vsspinstate & vssBit)){
    tmpTrip.vssPulses++;
    currentVSS=elapsedMicroseconds(lastVSS);
    lastVSS=microSeconds();
  }
  vsspinstate = p;
  buttonState &= p;
}
Regarding to your code above, I think the "vsspinstate" variable has to be a global.

Regards,
Yoshi
  Reply With Quote
Old 05-20-2008, 12:21 PM   #103 (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 269 Times in 212 Posts
Quote:
Originally Posted by Yoshi View Post
Hi,
arduino 0011 was release on March 28, and they changed the millis() on April 18.
http://svn.berlios.de/viewcvs/arduin...45&view=markup
timer0_clock_cycles variable is defined instead of timer0_overflow_count.
Nice catch We will have to add an #ifdef to do the right thing when arduino 12 comes out.

Quote:
Originally Posted by Yoshi View Post
No, I don't think so.
I observe the injector pulse width and RPM number are changing individually and no relations between them.
Sorry, what I meant was that if you get X number of injector pulses in a second, then you probably have an indication of RPM, at least for most vehicles. Or if you know the time between pulses (not the pulse width).


Quote:
Originally Posted by Yoshi View Post
I saw "attachInterrupt" source and found it's just initializing interrupt register.
I believe you'll see unstable calc results without setting cli().
I looked it up in the datasheet. Interrupts are disabled by default when an interrupt occurs:
"When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts are disabled. The user software can write logic one to the I-bit to enable nested interrupts. All enabled interrupts can then interrupt the current interrupt routine. The I-bit is automatically set when a Return from Interrupt instruction -RETI-is executed."

My concern with leaving the interrupts disabled is that while processing an injector interrupt, we WILL eventually lose some vss interrupts, or vice versa. So I may try to enable nested interrups so we don't lose data and try and make the code "interrupt safe", as it were.

Quote:
Originally Posted by Yoshi View Post
Code:
//attach the vss/buttons interrupt
ISR( PCINT1_vect ){ 
  static byte vsspinstate=0;
...
Regarding to your code above, I think the "vsspinstate" variable has to be a global.
A method static variable will retain its value between calls. The variable just isn't accessible outside the method is the only difference with global. That code does need revamping though. I think there is more resolution available at low speeds if we keep track of the milliseconds between vss pulses rather than just a count. But not a big deal.

Thanks!
__________________
WINDMILLS DO NOT WORK THAT WAY!!!

Last edited by dcb; 05-20-2008 at 12:32 PM..
  Reply With Quote
Old 05-20-2008, 02:01 PM   #104 (permalink)
EcoModding Lurker
 
Join Date: Jan 2008
Location: us
Posts: 14

grnsat - '95 Saturn SL1

metro - '95 Geo Metro LSi
Thanks: 0
Thanked 0 Times in 0 Posts
(this is with code prior to tuesday morning's update)

dcb: could you (and everyone else, but since you have a saturn it would help me out) post what kind of instantaneous reading you're seeing at a certain speed?

Right now at a 60mph cruise, I'm seeing 34000uS injectors, and a 36 injector count. At 60mph, my car should be running 2165RPM, or 36 revolutions per sec. This shows I'm counting the number of pulses just fine. My VSS, MPH, MI are all still solid.

But as far as my uS display, I'm seeing a number that is far too low..

Here's what I would expect to see:

Suppose my car gets 45mpg at 60mph (I dont know exactly, but should be close). I would be consuming gas at a rate of 1.3333 gallons/hour.

With my car's 19lb/hr injectors, or 3.04 gallons/hr, times 4 injectors, I can spray 12.16 gallons/hr.

1.3333/12.16 is 0.109648849 or 10.9% time while injector would be on.

10.9% of a second is 109648uS.

With my current reading of 34000uS, i'm about 3 times less than what I'd expect to see. For the hell of it, I changed
tmpTrip.injHius += elapsedMicroseconds(injHiStart); to
tmpTrip.injHius += 3*(elapsedMicroseconds(injHiStart));

and got readings that, if you didn't tell me otherwise, i'd think were pretty accurate.

Is it possible we're losing quite a bit of microseconds on the pulses? losing 2/3 seems pretty unrealistic, but I thought I'd put it out there..

I'd really like to see your (dcb) uS at 60mph, to try to rule out a connection problem..
  Reply With Quote
Old 05-20-2008, 02:42 PM   #105 (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 269 Times in 212 Posts
Quote:
Originally Posted by Mr. Cheap View Post
...My injector line is low when the engine is off. The guino incorrectly counts this as injector firing...
I think this is the most significant issue currently, because it will be a little tricky to solve. I got to the store today with an indicated 35mph for the trip. When I got out, I was at 5!

When I hold in my injector kill switch, the indicated consumption goes way up too.


mosier, I'll get back to you with some instant numbers.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 05-20-2008, 03:56 PM   #106 (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 269 Times in 212 Posts
Actually, this might not be too bad. Might also solve figuring out when the engine is off.


If in the main loop, we see that the time since injHius is getting larger than a second or so, we set a flag or whatever that says "the key is turned off". We turn off the LED backlight, and don't do anything but reset the flag on the next injector interrupt...
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 05-20-2008, 03:59 PM   #107 (permalink)
EcoModding Apprentice
 
awillard69's Avatar
 
Join Date: Feb 2008
Location: Streamwood, IL
Posts: 105

Dakota - '00 Dodge Dakota Club Cab, Sport
90 day: 18.57 mpg (US)

Jeep - '01 Jeep Wrangler TJ Sport
90 day: 18.46 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
Will turning off the backlight prevent you from seeing the "final" numbers when you shut down at the end of a trip? Maybe delay the backlight off for 10-15 seconds.

If the engine refires you won't really know (care?), but the MPG's should improve, right?
__________________

  Reply With Quote
Old 05-20-2008, 06:49 PM   #108 (permalink)
EcoModding Apprentice
 
awillard69's Avatar
 
Join Date: Feb 2008
Location: Streamwood, IL
Posts: 105

Dakota - '00 Dodge Dakota Club Cab, Sport
90 day: 18.57 mpg (US)

Jeep - '01 Jeep Wrangler TJ Sport
90 day: 18.46 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
Success.

I build a primitive serial cable from some connectors and I works like it should. I need to get the latest code and any schematic changes and see what it looks like.

Then, I need to start my input generator. So, I need some basic data:

How many pulses from the injector at 30 MPH, and at what duration?
How many pulses per mile at 30 MPH?
__________________

  Reply With Quote
Old 05-20-2008, 06:51 PM   #109 (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 269 Times in 212 Posts
Awesome!! Updating the code now...
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 05-20-2008, 07:13 PM   #110 (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 269 Times in 212 Posts
Quote:
Originally Posted by mosier View Post
(this is with code prior to tuesday morning's update)

dcb: could you (and everyone else, but since you have a saturn it would help me out) post what kind of instantaneous reading you're seeing at a certain speed?
...
There wasn't anywhere near here to do 60mph, but at 40 I saw:

15 injector pulses/second, ~80,000 uS .

15 * 60 * 2 = 1800 RPM, which is about what I saw on the tach.

I assume your 95 is mpfi. if it is TBI then you might need a number 4x larger.

__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Reply  Post New Thread


Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
My kingdom for a giant, heated workspace MetroMPG The Lounge 14 12-12-2010 09:08 AM
Motorcycle manufacturers beginning to release MPG info MetroMPG Motorcycles / Scooters 1 04-03-2008 05:23 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