Miles Per Gallon Gauge
Posted: 22 Aug 2012, 23:22
Hi everyone, new here to the forum. Hopefully I'll be a positive addition
I've been tinkering with the idea of making a fuel efficiency gauge for my old car (1968 firebird if you'd like to know) with my NXT. It will compare data from a flow sensor inline with the fuel line to rpm data from an NXT motor inline with the speedometer cable. I'd like to have it give a running average every second if possible. I went ahead and bought a flow sensor from adafruit ( here's the link if you'd like to see: https://www.adafruit.com/products/828 ) and luckily it seems to work great hacked together with a spare sensor cable. I have made a little program that counts up the number of pulses coming from the sensor (each pulse is approx. 2.25 ml btw) so it shows promise. I also found a program online someone had made for an rpm gauge. So what I'm struggling with is how to put the two together. I will have the NXT motor reading revs per minute (or per second), which with some math (knowing gear ratios in the transmission, rear axle, and tire diameter) can become miles per second, and have the flow sensor reading pulses per minute (or second), which with a little math becomes ml, liters, or gallons.
Despite my efforts, I haven't quite figured out how to
1. count pulses per second from the flow sensor
and 2. divide my revs per second data by my pulses per second data to ultimately achieve miles per gallon. Then of course have it give me an updated running average displayed on the screen every second or so.
Does this seem feasible, practical, sane? Any fatal flaws? I'd love some input and help, I might be being a little overambitious here.
Thanks!
-Matt
I've been tinkering with the idea of making a fuel efficiency gauge for my old car (1968 firebird if you'd like to know) with my NXT. It will compare data from a flow sensor inline with the fuel line to rpm data from an NXT motor inline with the speedometer cable. I'd like to have it give a running average every second if possible. I went ahead and bought a flow sensor from adafruit ( here's the link if you'd like to see: https://www.adafruit.com/products/828 ) and luckily it seems to work great hacked together with a spare sensor cable. I have made a little program that counts up the number of pulses coming from the sensor (each pulse is approx. 2.25 ml btw) so it shows promise. I also found a program online someone had made for an rpm gauge. So what I'm struggling with is how to put the two together. I will have the NXT motor reading revs per minute (or per second), which with some math (knowing gear ratios in the transmission, rear axle, and tire diameter) can become miles per second, and have the flow sensor reading pulses per minute (or second), which with a little math becomes ml, liters, or gallons.
Despite my efforts, I haven't quite figured out how to
1. count pulses per second from the flow sensor
and 2. divide my revs per second data by my pulses per second data to ultimately achieve miles per gallon. Then of course have it give me an updated running average displayed on the screen every second or so.
Does this seem feasible, practical, sane? Any fatal flaws? I'd love some input and help, I might be being a little overambitious here.
Thanks!
-Matt