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

Reply  Post New Thread
 
Submit Tools LinkBack Thread Tools
Old 03-21-2011, 07:34 PM   #11 (permalink)
UFO
Master EcoModder
 
UFO's Avatar
 
Join Date: Sep 2010
Location: Denver, CO
Posts: 1,300

Colorado - '17 Chevrolet Colorado 4x4 LT
90 day: 23.07 mpg (US)
Thanks: 315
Thanked 179 Times in 138 Posts
Quote:
Originally Posted by bobski View Post
Sounds safe. :/
Maybe if you use high value resistors for your divider. Low values might pass enough current to out-feed the power regulator. If the regulator can basically run backwards, that might not be a problem. If it can't, you'll end up with greater than 5V as VCC.
Also, the forward bias voltage of the diode would mean the input hits 5.7 volts (or so, depending on the diode) before it starts clamping down.
Low resistor divider values would be mistake - they would load your source and you might not get an accurate reading. And circuits that run on 5.0V generally have absolute maximums well above 6V, so a diode drop above 5.0V is not a big concern. If you could handle the leakage current, Shottky diodes have very low drops, they might be a good option.

  Reply With Quote
Alt Today
Popular topics

Other popular topics in this forum...

   
Old 03-29-2011, 04:54 PM   #12 (permalink)
EcoModding Lurker
 
mcmancuso's Avatar
 
Join Date: Mar 2010
Location: TN-USA
Posts: 61

Green Metro - '99 Chevrolet Metro LSi Sedan
90 day: 32.78 mpg (US)

Metro Vert - '91 Geo Metro LSi Convertible
90 day: 50.52 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
can someone post a simple wiring diagram of what exactly was done here? And maybe an example of the code added? I mean really, what's the idea of posting hey I got mine to do this! and then not posting anything substantial on how you did it?
  Reply With Quote
Old 03-30-2011, 01:25 PM   #13 (permalink)
EcoModding Lurker
 
Join Date: Mar 2011
Location: In My Truck
Posts: 23
Thanks: 6
Thanked 0 Times in 0 Posts
I don't think we've found a safe way to do it yet.

Another thought - maybe the 12v could be monitored via the analog input for the buttons. That way, it wouldn't tie up another input.
  Reply With Quote
Old 03-30-2011, 01:41 PM   #14 (permalink)
EcoModding Apprentice
 
Join Date: Jan 2010
Location: Newark, DE
Posts: 143

'91 CRX - '91 Honda CRX DX
90 day: 34.91 mpg (US)
Thanks: 0
Thanked 14 Times in 14 Posts
Quote:
Originally Posted by glug View Post
I don't think we've found a safe way to do it yet.
A 5 to 1 (or thereabouts) voltage divider consisting of 2 resistors should work fine.

Quote:
Originally Posted by glug View Post
Another thought - maybe the 12v could be monitored via the analog input for the buttons. That way, it wouldn't tie up another input.
I guess you could use the battery voltage signal as the pull-up for one of the button lines. You wouldn't be able to monitor the voltage while the button is actually being pressed, but that shouldn't be a big deal. Also, very low supply voltages (unlikely to occur) could be mistaken as a button press.
  Reply With Quote
Old 03-31-2011, 03:04 PM   #15 (permalink)
EcoModding Lurker
 
Join Date: Mar 2011
Location: In My Truck
Posts: 23
Thanks: 6
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by bobski View Post
A 5 to 1 (or thereabouts) voltage divider consisting of 2 resistors
I guess you could use the battery voltage signal as the pull-up for one of the button lines. You wouldn't be able to monitor the voltage while the button is actually being pressed, but that shouldn't be a big deal. Also, very low supply voltages (unlikely to occur) could be mistaken as a button press.
I wasn't sure if there would be spikes and noise that might be a complication if the 12v vehicle path is tied to an analog input, etc.

I'd guess the drop in voltage due to the starter would also be a gotcha. The code would probably need to detect that, to avoid false button triggers. Configuring the voltage dividers in a fairly narrow range would probably help reduce false triggers.

The more inputs that are free for pressure, temp, etc, the better.
  Reply With Quote
Old 03-31-2011, 03:24 PM   #16 (permalink)
EcoModding Lurker
 
mcmancuso's Avatar
 
Join Date: Mar 2010
Location: TN-USA
Posts: 61

Green Metro - '99 Chevrolet Metro LSi Sedan
90 day: 32.78 mpg (US)

Metro Vert - '91 Geo Metro LSi Convertible
90 day: 50.52 mpg (US)
Thanks: 0
Thanked 1 Time in 1 Post
That's a good idea, most cars won't start if battery V is less than 10V or so, I know a Metro's computer needs at least 9V to run. You could essentially ignore any voltage below 10V or so since if your voltage is below that you will know it via less technical means.
  Reply With Quote
Old 03-31-2011, 04:54 PM   #17 (permalink)
EcoModding Apprentice
 
Join Date: Jan 2010
Location: Newark, DE
Posts: 143

'91 CRX - '91 Honda CRX DX
90 day: 34.91 mpg (US)
Thanks: 0
Thanked 14 Times in 14 Posts
Yep. You could set the minimum even lower if you wanted to be able to diagnose bad battery cells or something; 5V maybe? That would be 1V after the divider, or 200 or less when read in code.
Code:
if(analogRead(pin#) < 200) {doButtonAction;}
else {batteryVoltage = analogRead(pin#) / 40.92;}
  Reply With Quote
Old 03-31-2011, 06:54 PM   #18 (permalink)
EcoModding Apprentice
 
meelis11's Avatar
 
Join Date: Feb 2009
Location: Estonia
Posts: 199

Green frog - '97 Audi A4 Avant 1.9TDI 81kW
Diesel
90 day: 43.1 mpg (US)
Thanks: 19
Thanked 40 Times in 28 Posts
Here is my working function:
Voltage divider ratio could be bigger but I had these resistors and it is working.
* correct R1 and R2 value to resistor values you use. For calibration, you can fine-tune these numbers
* you also must define voltagePin with correct pin number


Code:
#define voltagePin   2

unsigned long batteryVoltage(void){
   float vout = 0.0;
   float vin = 0.0;
   float R1 = 21500.0;    // !! resistance of R1 !!
   float R2 = 9500.0;     // !! resistance of R2 !!
   int value = 0;

   value = analogRead(voltagePin);
   vout = (value * 5.0) / 1024.0;
   vin = vout / (R2/(R1+R2));

   return vin * 1000;
}
Schematic is like this.
12V...R1...VoltagePin...R2...GND
so it means R1 is between 12V and VoltagePin, R2 is between VoltagePin and GND

Last edited by meelis11; 03-31-2011 at 07:02 PM..
  Reply With Quote
Old 02-10-2012, 01:07 AM   #19 (permalink)
EcoModding Lurker
 
fastegg's Avatar
 
Join Date: Jan 2012
Location: Gosford
Posts: 49
Thanks: 3
Thanked 1 Time in 1 Post
MPGuino

Quote:
Originally Posted by meelis11 View Post
Hi,
has this idea been discussed before? At least I haven't seen it.
Anyway, I would like to see battery voltage in MPGuino and started searching how to measure 12V battery voltage (max should be 15V I think) and found this link and some other voltage divider pages.
Also I am going to add coolant temperature to this screen (needs extra input pin) along with liters/hour and RPM
new screen will be "Car sensors" or similar.

Meelis
Yep... having battery voltage is an excellent idea, so is coolant temperature...
__________________
UCF20R LS400 VVTi
Lexus Mad
  Reply With Quote
Old 02-14-2012, 07:29 AM   #20 (permalink)
EcoModding Lurker
 
Join Date: Jan 2012
Location: Warwick, UK
Posts: 22
Thanks: 24
Thanked 1 Time in 1 Post
Why not just display PID 42 Control module voltage ??

  Reply With Quote
Reply  Post New Thread


Tags
alternator, battery, charging voltage, mpguino, voltage





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