View Single Post
Old 10-05-2008, 04:27 PM   #1 (permalink)
ac7ss
EcoModding Lurker
 
Join Date: Sep 2008
Location: Olympia, wa
Posts: 96

Red Beast - '82 Honda V45 Sabre Vetter Fairing
90 day: 39.38 mpg (US)

The Wife's bike - '82 Honda CM450E Red
90 day: 57.22 mpg (US)

Yellow Submarine - '04 Dodge Neon SXT
90 day: 28.71 mpg (US)
Thanks: 6
Thanked 1 Time in 1 Post
Modding the MPGuino

Came up with an idea the other day for adding lights to the MPGuino.

Previously posted in the MPGuino release one workspace:


I was thinking about adding code for a 'Red / Green' indicator (2 LEDs hooked up to the outputs) Red would come on if instant was lower than Current, Green would come on if instant was higher than tank. Check to see if backlight was not 0 before turning the light on.
Code:
// in header section
#define GreenLed 10       
#define RedLed 11
...
// in setup()
pinMode(GreenLed,OUTPUT);       
pinMode(RedLed,OUTPUT);       
...
// After sei() call in loop()
if(lastActivity != nil){
  if(instantmpg()>tank.mpg()){
    //turn on GreenLed
    digitalWrite( GreenLed, HIGH); 
  }else{
    //turn off GreenLed
    digitalWrite( GreenLed, LOW);
  }
  if(instantmpg()>current.mpg()){
    //turn off RedLed
    digitalWrite( RedLed, LOW);
  }else{
    //turn on RedLed
    digitalWrite( RedLed, HIGH);
  }
}else{
  //turn off both lights if we are in sleep mode.
  digitalWrite( RedLed, LOW);
  digitalWrite( GreenLed, LOW);
}
Please check the code, I think this is right. Now just install 2 led's on the 10 and 11 pins with drop resistors.

I feel that this would give an instant, eyes up, indication of your driving efficiency based upon bettering your averages. By basing it on both tank and current you will have 4 different states possible:
  • Green on, Red off: Better than both Tank and Current avg, you are doing it right.
  • Both on or Both off: You are somewhere between current and tank averages, you could be doing better.
  • Red on, green off: You are driving too hard or accelerating.

__________________
  Reply With Quote