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

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 09-02-2008, 09:40 AM   #571 (permalink)
markr-nc
 
Join Date: Jul 2008
Location: Greensboro, NC
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
How to Do?

Quote:
Originally Posted by dcb View Post
Have you been able to dial in the trip distance?

I've noticed that the trip on the metro seems pretty accurate despite the jumpy instant speed reading, which means it is getting most/all of the vss pulses anyway.

The cheap fix is to skip the timing of the vss pulses and just compute "instant" speed based on last few seconds worth of pulses instead of the last .5 seconds worth.

Do we make a change in here:

unsigned long instantmph(){
cli();
unsigned long vssPulseTimeuS = (lastVSS1 + lastVSS2) / 2;
sei();
init64(tmp1,0,1000000000ul);
init64(tmp2,0,parms[vssPulsesPerMileIdx]);
div64(tmp1,tmp2);
init64(tmp2,0,3600);
mul64(tmp1,tmp2);
init64(tmp2,0,vssPulseTimeuS);
div64(tmp1,tmp2);
return tmp1[1];
}

unsigned long instantmpg(){
cli();
unsigned long vssPulseTimeuS = (lastVSS1 + lastVSS2) / 2;
sei();
init64(tmp1,0,1000000000ul);
init64(tmp2,0,parms[vssPulsesPerMileIdx]);
div64(tmp1,tmp2);
init64(tmp2,0,3600);
mul64(tmp1,tmp2);
init64(tmp2,0,vssPulseTimeuS);
div64(tmp1,tmp2);
// return tmp1[1];


or somewhere else? If it's in here, I've been trying to figure it out but haven't had much success. It kinda looks to me like the second paragraph is doing what the first one describes, I think. I was wondering if the 3600 in the second init64 was where the number would change?

I'll certainly admit that the abstract thought processes used in programing aren't my strong point, if it were I wouldn't be getting greasy and my knuckles beat up working on cars for a living...

Many thanks,
Mark

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 09-02-2008, 09:41 AM   #572 (permalink)
Test Tool Engr.
 
Join Date: Aug 2008
Location: Elgin, IL, USA
Posts: 47

Red Rocket - '02 Honda Civic LX Sedan
90 day: 33.57 mpg (US)

Bronze Bucket - '98 Toyota Corolla VE
90 day: 34.97 mpg (US)

Silver Bullet - '06 Hyundai Sonata GL
90 day: 31.58 mpg (US)
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Clev View Post
Has anybody considered the ATMega128 controller? (Link: ATMega Controller) It has double the clockspeed, 4K EEPROM, 128K FLASH. Does anybody know if this is compatible with the Arduino? I'd like to be able to add some extra functionality, and I think we're going to hit the limits of Arduino's FLASH.
ATMega128 only comes in flat-packs (not easy for everyone to solder).
Did you look at ATMega328? It should be Arduino-compatible some day (and someone already has mods you can do to make it run Arduino code today). It comes in the same 28-pin DIP package.
Details on using ATMega328 with Arduino
  Reply With Quote
Old 09-02-2008, 12:44 PM   #573 (permalink)
EcoModding Lurker
 
Join Date: Aug 2008
Location: Raleigh, NC
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Wiki beeds help

Quote:
Originally Posted by MetroMPG View Post
Also.... the MPGuino wiki. Think it's worthwhile starting a new thread to talk that over in more detail? How would you like to see it evolve, content wise? I was talking to Ben, and have agreed that one or both of us will take an active role in shepherding that part of the project, if you like.
Sounds like a winner, I have not really been managing the WIKI much, because it really does not fit in my daily routine, but I would like to make a suggestion. Start by putting a link in the first post, because that is where everyone goes that is new to this post.

As with many good pieces of information, it gets lost in the forum, and the WIKI is basically lost right now because anyone new to this post will not even know it exists and as a result no-one will bother to update it if they do not know it exists or others do not continue to update it.

I look forward to seeing how the WIKI transforms.

TruckTrash
  Reply With Quote
Old 09-02-2008, 02:22 PM   #574 (permalink)
Wannabe greenie
 
Join Date: Aug 2008
Location: Yorba Linda, CA
Posts: 1,098

The Clunker (retired) - '90 Honda Accord EX sedan
Team Honda
90 day: 29.49 mpg (US)

Mountain Goat - '96 Ford Ranger XLT 4x4 SuperCab
90 day: 18 mpg (US)

Zippy - '10 Kymco Agility 125
90 day: 65.03 mpg (US)
Thanks: 5
Thanked 53 Times in 40 Posts
Quote:
Originally Posted by ishiyakazuo View Post
ATMega128 only comes in flat-packs (not easy for everyone to solder).
Did you look at ATMega328? It should be Arduino-compatible some day (and someone already has mods you can do to make it run Arduino code today). It comes in the same 28-pin DIP package.
Details on using ATMega328 with Arduino
Ah, excellent. Looks like a drop-in upgrade (physically, anyway) that doubles the EEPROM, SRAM and FLASH. I'll go ahead and order the Arduino with that possibility in mind.
__________________

  Reply With Quote
Old 09-02-2008, 06:36 PM   #575 (permalink)
Addicted
 
bbjsw10's Avatar
 
Join Date: Jul 2008
Location: Findlay,OH
Posts: 555

bbjsw10 - '91 Geo Metro Xfi
90 day: 51.06 mpg (US)
Thanks: 0
Thanked 11 Times in 7 Posts
Quote:
Originally Posted by wagonman76 View Post
since bypassing that transistor circuit. NO glitches since, not even one.
How did you bypass and should I do this when I build mine to just avoid the problem. Will be receiving parts soon.
__________________

Last edited by bbjsw10; 09-02-2008 at 09:01 PM..
  Reply With Quote
Old 09-02-2008, 07:30 PM   #576 (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 bbjsw10 View Post
...should I do this when I build mine...
You should try to build it correctly so the guino can control the backlight for you.
__________________
WINDMILLS DO NOT WORK THAT WAY!!!
  Reply With Quote
Old 09-02-2008, 07:40 PM   #577 (permalink)
Addicted
 
bbjsw10's Avatar
 
Join Date: Jul 2008
Location: Findlay,OH
Posts: 555

bbjsw10 - '91 Geo Metro Xfi
90 day: 51.06 mpg (US)
Thanks: 0
Thanked 11 Times in 7 Posts
dcb Thanks for the quick response. I will take your word on it.
__________________
  Reply With Quote
Old 09-02-2008, 08:01 PM   #578 (permalink)
EcoModding Apprentice
 
ptsmith24's Avatar
 
Join Date: Aug 2008
Location: Statesboro, GA
Posts: 177

El Camrino - '90 Toyota Camry LE
90 day: 32.47 mpg (US)
Thanks: 0
Thanked 0 Times in 0 Posts
I got my board and LCD in today and picked up the misc. parts that I need. I'll get it all built in the next few days (definitely by this weekend) and post back with results. I'll try and take note of vehicle specific stuff so I can contribute to the wiki.
__________________
"It is foolish and wrong to mourn the men who died. Rather we should thank God that such men lived."
- General George S. Patton, Jr

  Reply With Quote
Old 09-02-2008, 09:00 PM   #579 (permalink)
testing the waters
 
Join Date: Jun 2008
Location: usa
Posts: 40
Thanks: 0
Thanked 1 Time in 1 Post
Quote:
Originally Posted by ac7ss View Post
An idea for the instant speed problem. (Stolen from the space shuttle software.) Take 3 time readings (time between pulses) and average the 2 that are closest in value to each other.
If you have the following 3 values: 100 45 47, have it throw out the 100 and return a value of 46.

I have some experience in optimizing code. Would you mind if I look at the source and help save some memory?

Thanks, that's a great idea, I'll try it


Please optimize this if you can, it uses lots of memory


Code:
void doDisplay0_60() {

  
  switch ( g_Mode060 ) {
      
    // STAGE VEHCLE INTRO
    case 0:
      LCD::LcdCommandWrite(B00000001);  // clear display, set cursor position to zero
      LCD::print("STAGE VEHICLE...");
            
      if( instantmph() < 1000ul )
        g_Mode060 = 1;
      
      g_StartTime060 = 0;
      g_StopTime060 = 0;
      
      break;
      
      // ON YOUR MARK GET SET AND GO
    case 1: 
      LCD::LcdCommandWrite(B00000001);  // clear display, set cursor position to zero
      LCD::print("..ON YOUR MARK..");
      LCD::gotoXY(1,1);
      LCD::print("...GET SET...  ");
      delay2(2000);
      LCD::LcdCommandWrite(B00000001);
      LCD::print("      G0!      ");    
      
      
      delay2(3000);
      
      // Start the Timer and compensate for the delay
      g_StartTime060 = millis2() - 3000; 
      g_Mode060 = 2;
      break;
  
    // ITS GO TIME
    case 2:
    
      // Timer's already started
     // IF NOT AT 60 mph yet, DSPLAY BIG TIMER
     if( instantmph() < 60000ul )  
       bigNum( instantmph() ,"CUR","SPD");
     
     // Else, move on
    else {
       g_Mode060 = 3;
       LCD::LcdCommandWrite(B00000001);
     }
      break;
    case 3:
      // Lets stop the timer,
      // But only once
      if( g_StopTime060 == 0 ) {
        g_StopTime060 = millis2() - 500; // reads 500 high due to processing
      }
      LCD::print("0 to 60 in...");
      LCD::gotoXY(1,1);   
      LCD::print(format((g_StopTime060 - g_StartTime060))); 
      LCD::print(" Seconds");
      
      g_Mode060 = 0;
      delay2(5000);          
      break;
  }
  
    
} // end doDisplay0_60
  Reply With Quote
Old 09-02-2008, 10:33 PM   #580 (permalink)
Master EcoModder
 
wagonman76's Avatar
 
Join Date: Jun 2008
Location: Northwest Lower Michigan
Posts: 1,006

Red Car - '89 Chevrolet Celebrity CL 4 door
Team Chevy
90 day: 36.47 mpg (US)

Winter Wagon - '89 Pontiac 6000 LE Wagon
90 day: 28.26 mpg (US)
Thanks: 8
Thanked 17 Times in 16 Posts
Quote:
Originally Posted by dcb View Post
You should try to build it correctly so the guino can control the backlight for you.
Yes I agree, start by building it per the specs. Only if something isnt quite right then find a workaround. Mine was one such case where the display ended up not having the exact same specs as the stock display. I found out my pin 15 is basically just there for looks, it does not connect to anything internally. I found that it takes a different circuit to dim my backlight, I have to break the display ground. So I was using the stock transistor to control my own transistor to control the backlight, which may have led to my problems. Going to just my own transistor and changing some code seems to have solved the issue.

__________________

Winter daily driver, parked most days right now


Summer daily driver
  Reply With Quote
Reply  Post New Thread




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