Fuelly Forums

Fuelly Forums (https://www.fuelly.com/forums/)
-   Experiments, Modifications and DIY (https://www.fuelly.com/forums/f9/)
-   -   diy mpg gauge (https://www.fuelly.com/forums/f9/diy-mpg-gauge-5319.html)

skewbe 08-15-2007 04:11 AM

or it may need to be isolated with an op-amp/transistor, hmm is your metro vss magnetic?

skewbe 08-15-2007 09:06 PM

Also, are you auto or stick? I saw a sentance in the haynes that said the vss was in the trans on an auto, and thus it might be magnetic instead of a hard to throw off with a 10k resistor switch.

On a side note, the scangauge started working in the saturn again so I might have cause to work this more actively.

mpmetro 08-18-2007 09:42 PM

Quote:

Originally Posted by skewbe (Post 68565)
Also, are you auto or stick? I saw a sentance in the haynes that said the vss was in the trans on an auto, and thus it might be magnetic instead of a hard to throw off with a 10k resistor switch.

On a side note, the scangauge started working in the saturn again so I might have cause to work this more actively.

my 91 is a 5spd manual. But I dont worry about the CEL.

sonyhome 08-20-2007 02:02 AM

Wouldn't a CEL code risk sending your computer in open loop mode, wasting gas?

If you use like a cheapo 741 op-amp, might as well use it in comparator mode then with 2 potentiometers, gives you full insulation, but you'll need to wire a power supply, like a +5V or a +12V to it (or a battery?).

That would send a clean square wave to the headphones and tuning would be at the pots instead of the config file.

I need to find and spend some time to get a setup too to jump on the bandwagon...

GasSavers_Doc 09-12-2007 04:51 AM

Oxy sensor reading
 
I've got mpg.java to work but have not sure how wire anything to it yet. Trying to work out how to code Java so I can get an Oxygen sensor reading as well. Can this kind of app run off two sound cards so we have 4 channels.
Very Impressive work!!!

skewbe 09-12-2007 04:12 PM

Thanks Doc, I don't know about two sound cards without trying. It might be operating system dependant (i.e. you could do it under linux but not windows).

FYI, mpmetro did a good metro specific installation writeup: https://teamswift.net/viewtopic.php?p=255816#255816

ami8i 12-09-2007 11:20 PM

Hello skewbe,
thank you very much for developing and releasing the mpg monitor!
I came across this forum because I have looked for an item like the Super MID. I'd prefer a ?C DIY solution - but exploiting soundcard for such a gauge is very cool.

My problem ist my poor Hardware. What is the oldest possible Java release to get the mpg monitor running?
I tried jre-1_5_0_13-windows-i586-p-s.exe and jre-1_5_0_10-windows-i586-p-s.exe , both installations failed because my laptop does not provide the 'recomended' memory. I guess RAM is meant. There is enough free space on HDD.

The laptop is an old Toshiba Tecra, 133MHz, 16MB RAM, Win98SE.
I can't find any space/memory requirements for any Java release. This site seems to show all Java releases https://java.sun.com/products/archive/

I can't download & test all releases. :(

Thanks and Best regards from Austria
?Horst

skewbe 12-18-2007 05:06 PM

wow, 16mb, I did not anticipate that. It ran under windows 98 on my 133mhz laptop with 32mb and java version "1.5.0_06". I thought that would be pretty much lowest common denominator. I think if you can upgrade your memory you will be in business.

Here is a $25 48meg upgrade, search for NW2041U in your area or better yet a NW2042U (128 meg) if you want to keep that laptop in service,

https://cgi.ebay.com/TOSHIBA-NW2041U-...sid=p1638.m118

FritzR 02-01-2008 11:29 AM

hey skewbe

if the purpose of the diode it to keep the voltage to the soundcard uner .775 volts so the signal does not clip above 0 DBV, wouldn't it work as well to just make a voltage divider circut?

If the input impedence of the soundcard was 20K then use a 400K resistor to the input not grounded. That would be something like .5 volts to the sound card. You wouldn't need to worry about loading up the injector signal that way.

rsxer63 06-24-2008 09:10 AM

Does anyone know if this would work with a Nokia 770?

sonyhome 06-24-2008 10:05 AM

Try to load the applet on it, and just run it. You then also need to connect the car onto the microphone input.

jtiner 07-23-2008 09:22 PM

Quote:

Originally Posted by skewbe (Post 64732)
Tada!!, it's somewhere in the ballpark for a 98'tro!! Now anyone who has a laptop or tablet in their car can monitor MPG

***you need to be logged in to see the pictures,
You can go here to see the pictures without logging in:
https://opengauge.org/diympggauge/
***
https://www.gassavers.org/attachment....1&d=1185090285
*tank will persist when window is closed


Using this circuit, with right and left switched :rolleyes:
https://www.gassavers.org/attachment....1&d=1183986302


Zoom in on recording of line in (44100 8 bit stereo) for anylizing the waveform (vss* on top, injector on bottom) and general futzing in response. I don't think the diodes are doing much on the vss side :eek:
https://www.gassavers.org/attachment....1&d=1185091266
*Yellow line is default threshold for the vss,
*Cyan "..." injector
*I adapted the code to the latest wave form (inj pulse was on other channel and right side up?!?)
*vss is the misnamed Vehicle Speed Sensor. It really only measures distance. The computer watching the vss still has to keep track of time to figure out the velocity.



Speaking of code, here it is in it's entirety, 6 drama filled pages to chew on in one file called Mpg.java :
Code:

import java.awt.Color;
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.text.NumberFormat;
import java.util.Properties;

import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.TargetDataLine;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Mpg extends Thread {
        static String propFile = "./mpg.properties";        // place to persist confguration and trips.
                                                                                                //Will be created on first run if it doesnt exist.

        static int injThreshold = Integer
                        .parseInt(getProperty("injThreshold", "-30")); // value above the noise

        static int vssThreshold = Integer
                        .parseInt(getProperty("vssThreshold", "100")); // value above the noise

        static double distanceFudge = Double.parseDouble(getProperty("distanceFudge", "3200.0"));

        static double fuelFudge = Double.parseDouble(getProperty("fuelFudge",        "8000000.00"));

        static String dummyFile = getProperty("dummyFile", "");

        // low level stats tracked in the "trip" class.
        class Trip {
                String name;

                long sampleCount; // num samples, used to compute elapsed time, good
                                                        // for about 58 billion hours @ 44100hz

                long injHi; // stores number of samples that were "HI" (injector was
                                        // open)

                long vssTot; // how many pulses from the vss, indication of distance
                                                // travelled

                public Trip(String _name) {
                        name = _name;
                }

                // real lightweight update process, gets called at end of audio chunk
                public void Update(long _sampleCount, long _injHi, long _vssTot) {
                        sampleCount += _sampleCount;
                        injHi += _injHi;
                        vssTot += _vssTot;
                }

                public String toString() {
                        return "name=" + name + ";sampleCount=" + sampleCount + ";injHi="
                                        + injHi + ";vssTot=" + vssTot;
                }

                public void reset() {
                        sampleCount = 0;
                        injHi = 0;
                        vssTot = 0;
                }

                public Trip load() {
                        sampleCount = Long
                                        .parseLong(getProperty(name + ".sampleCount", "0"));
                        injHi = Long.parseLong(getProperty(name + ".injHi", "0"));
                        vssTot = Long.parseLong(getProperty(name + ".vssTot", "0"));
                        return this;
                }

                public void save() {
                        properties.put(name + ".sampleCount", "" + sampleCount);
                        properties.put(name + ".injHi", "" + injHi);
                        properties.put(name + ".vssTot", "" + vssTot);
                }

                public double miles() {
                        return (double) vssTot / distanceFudge;
                }

                public double hours() {
                        return ((double) sampleCount) / (44100.0D * 3600.0D);
                }

                public double gallons() {
                        return (double) injHi / fuelFudge;
                }

                public double mpg() {
                        return gallons() > 0.0D ? (miles() / gallons())
                                        : Double.POSITIVE_INFINITY;
                }
        }

        class TripPanel extends JPanel {
                Trip trip = null;

                JLabel name = new JLabel("name");

                JLabel miles = new JLabel("miles");

                JLabel gallons = new JLabel("gallons");

                JLabel mpg = new JLabel("mpg");

                JLabel hours = new JLabel("gallons");

                JLabel mph = new JLabel("mph");

                JButton reset = new JButton("reset");

                /** used for limiting numbers to 4 decimal places*/
                NumberFormat fm = NumberFormat.getNumberInstance();

                public TripPanel(Trip _trip) {
                        trip = _trip;
                        setLayout(new GridLayout(1, 8));
                        setBorder(BorderFactory.createLineBorder(Color.BLACK));
                        add(name);
                        add(miles);
                        add(gallons);
                        add(mpg);
                        add(hours);
                        add(mph);
                        add(reset);
                        reset.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                        trip.reset();
                                }
                        });
                        fm.setMaximumFractionDigits(4);
                }

                public void upDateLabels() {
                        name.setText(" " + trip.name);
                        miles.setText(fm.format(trip.miles()));
                        gallons.setText(fm.format(trip.gallons()));
                        mpg.setText(fm.format(trip.mpg()));
                        hours.setText(fm.format(trip.hours()));
                        mph.setText(fm.format(trip.miles() / trip.hours()));
                }

        }

        private TargetDataLine m_line;

        protected boolean m_bRecording = true;

        Trip instant = new Trip("instant");

        TripPanel instantPanel = new TripPanel(instant);

        Trip current = new Trip("current");

        TripPanel currentPanel = new TripPanel(current);

        Trip tank = new Trip("tank").load();

        TripPanel tankPanel = new TripPanel(tank);

        public Mpg(TargetDataLine line, AudioFileFormat.Type targetType) {
                m_line = line;

                new Thread(new Runnable() {// thread to update the view every second
                                        public void run() {
                                                while (m_bRecording) {
                                                        instantPanel.upDateLabels();
                                                        instant.reset();// reset the instant trip after
                                                                                        // displaying it
                                                        currentPanel.upDateLabels();
                                                        tankPanel.upDateLabels();
                                                        try {
                                                                Thread.sleep(1000);
                                                        } catch (Exception e) {
                                                        }
                                                }
                                        }
                                }).start();

        }

        public void start() {
                m_line.start();
                super.start();
        }

        public void stopRecording() {
                m_line.stop();
                m_line.close();
                m_bRecording = false;
                System.out.println(" inj sampleCount = " + current.sampleCount
                                + " inj hi = " + current.injHi + " inj vssTot = "
                                + current.vssTot);
        }

        boolean ig = true;

        boolean vg = true;

        void processChunk(byte[] b, int c) {
                long ih = 0;
                long vt = 0;

                for (int x = 0; x < c; x += 2) {
                        int val = ((int) b[x] & 255) - 127;
                        if (val > vssThreshold && vg) {
                                vt++;
                                System.out.println(" vss going hi "
                                                + (current.sampleCount + (x / 2)));
                                vg = false;
                        }
                        if (val < 0) {
                                vg = true;
                        }

                        val = ((int) b[x + 1] & 255) - 127;
                        if (val < injThreshold) {
                                ig = true;
                        }
                        if (val > 0)
                                ig = false;
                        if (ig)
                                ih++;
                }
                instant.Update(c / 2, ih, vt);
                current.Update(c / 2, ih, vt);
                tank.Update(c / 2, ih, vt);
        }

        public void realrun() {
                byte[] buffer = new byte[m_line.getBufferSize()];
                while (m_bRecording) {
                        int c = m_line.read(buffer, 0, m_line.available());
                        if (c != 0) {
                                processChunk(buffer, c);
                        }
                }
        }

        public void run() {
                if ("".equals(dummyFile))
                        realrun();
                else
                        dummyrun();
        }

        public void dummyrun() {
                try {
                        String strFilename = dummyFile;
                        File soundFile = new File(strFilename);
                        AudioInputStream audioInputStream = null;
                        audioInputStream = AudioSystem.getAudioInputStream(soundFile);

                        int nBytesRead = 0;
                        byte[] abData = new byte[44100];
                        while (nBytesRead != -1) {
                                nBytesRead = audioInputStream.read(abData, 0, abData.length);
                                if (nBytesRead >= 0) {
                                        processChunk(abData, nBytesRead);
                                }
                                try {
                                        Thread.sleep(1000);
                                } catch (Exception e) {
                                }
                        }
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }

        public static void main(String[] args) throws Exception {

                AudioFormat audioFormat = new AudioFormat(
                                AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 8, 2, 2, 44100.0F,
                                false);
                DataLine.Info info = new DataLine.Info(TargetDataLine.class,
                                audioFormat);
                TargetDataLine targetDataLine = null;
                targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
                targetDataLine.open(audioFormat);
                AudioFileFormat.Type targetType = AudioFileFormat.Type.WAVE;

                final Mpg recorder = new Mpg(targetDataLine, targetType);
                JFrame j = new JFrame("MPG Monitor!!!");
                j.setSize(640, 125);
                Container c = j.getContentPane();
                c.setLayout(new GridLayout(4, 1));

                JPanel hd = new JPanel();
                hd.setLayout(new GridLayout(1, 8));
                hd.add(new JLabel(""));
                hd.add(new JLabel("MILES"));
                hd.add(new JLabel("GAL"));
                hd.add(new JLabel("MPG"));
                hd.add(new JLabel("HRS"));
                hd.add(new JLabel("MPH"));
                hd.add(new JLabel(""));

                c.add(hd);
                c.add(recorder.instantPanel);
                c.add(recorder.currentPanel);
                c.add(recorder.tankPanel);

                j.addWindowListener(new WindowAdapter() {
                        public void windowClosing(WindowEvent e) {
                                recorder.stopRecording();
                                recorder.tank.save();//this just adds the trip fields to the properties object
                                try {
                                        properties.store(new FileOutputStream(new File(propFile)),"");
                                } catch (Exception f) {
                                }
                                System.exit(0);
                        }
                });

                j.setVisible(true);
                recorder.start();

        }

        static Properties properties;

        static String getProperty(String tag, String dflt) {
                String s = "";

                try {
                        if (properties == null) {
                                properties = new Properties();
                                try {
                                        properties.load(new FileInputStream(new File(propFile)));
                                } catch (Exception e) {
                                }
                                ;
                        }
                        s = properties.getProperty(tag);
                        if (s == null) {
                                s = dflt;
                                properties.put(tag, s);// will propogate default values to the
                                                                                // file
                        }
                } catch (Exception e) {
                }
                return s;

        }

}

So, believe it or not, it's all there. I think its a solid proof of concept anyway. Every car will be different, and there's plenty else that can be done to it: RPM column, invert signal/swap channel from mpg.properties file. A a collection of presets for different cars... But I, personally, am gonna try and do other stuff for a while :)

I am new to this forum and I have been reading the thread about diy mpg gauge using a laptop. Quite an ingenious idea! Very clever. I am ready to put this circuit together but I have a few questions: 1. What kind of diodes should be used? 2. The injector wire; is this an injector wire from an individual injector or the wire that controls all of the injectors? 3. Is it possible to hook this up to a palm pilot?

I am planning to set this up on a 1996 Chrysler concorde and if successful I will publish photos and a tutorial for this car.

sonyhome 07-23-2008 10:15 PM

[QUOTE=jtiner;112351]
1. What kind of diodes should be used? 2. The injector wire; is this an injector wire from an individual injector or the wire that controls all of the injectors? 3. Is it possible to hook this up to a palm pilot?
[QUOTE]
So I'm not the expert but I'll pitch in:
1- any diode, for example some from a power supply.
2- I think it's directly from one of the injectors.
3- Try to run the applet first. Load it on palm & I say save an audio file on an mp3 player, and play it back to the palm via a wire conecting both. If it works you should be OK.

jtiner 07-24-2008 08:37 AM

Thanks for the advise.

Are there parameters within the software that I need to program to the specifics of my car? In other words, if I am using an injector wire from one injector do I need to program the software for 6 cylinders (x6)? I am thinking of the calculations it needs to make for the entire engine, not just one cylinder.

sonyhome 07-24-2008 04:23 PM

Don't expect to have it right off the bat: I think there's a small config file to define parameters and tune to your car... Injector size, delay between open and gas flow, # cylinders, tire rotation speed, etc will impact the MPG reading. I think it's all in the original post/thread. You can also contact the guy who wrote this instead of my 2nd hand flaky info.

jim-frank 08-26-2008 08:01 AM

I've recently gotten this to work just fine. Here's my take on it.

1)Any silicon small signal diode will do. Radio Shack or scavenge. (Actually, a germanium diode will work, but you'll get a maximum signal of about 0.3 volts instead of 0.6 volts.)

2) Yes, use the injector wire from just one cylinder, whichever wire is easiest to get to is fine.

3) If your Palm Pilot has a stereo line level sound card input, you can do it. Otherwise, no deal. You'd also have to get the Java app ported to Palm OS. (I don't know how that would be done).

There are only four variables that need to be calibrated to your vehicle. These are called fuelFudge, distanceFudge, injThreshold, and vssThreshold.

They are found in the mpg.properties file that the program creates the first time you run it. You can open this file with any text editor, (with the program NOT running) and then save your changes before running mpg.java again.

I found some details that are scantily covered in the information above, and these are relevant.

Once you get the interface electronics wired up and connected to a soundcard, it's a good idea to run a recording of the signal. I use CoolEdit or Adobe Audition, but anything that will let you record and then zoom in on the waveform will do.

A peek into the java code reveals that the waveform is decoded for the program as numbers from -127 to +127. This number is the number of samples above or below zero that the waveform goes. This number is also what is referered to as the threshold variables in the program.

In my case, the injector waveform makes a pretty clean vertical line at the opening/closing of the injector, (like a square wave), so a threshold of near zero works OK. I adjusted mine to -8, which prevents false injector readings when the engine is off (noise signals will vary around the zero line by some amount.)

The vehicle speed sensor waveform in my car is a steep sided quasi-sinewave. A look at the waveform shows that it varies from -65 to plus 65 or so, and a threshold of about 10 works for me.

After you have set the threshold factors, you can set the fuelFudge and distanceFudge to correspond to your car.

Set the distanceFudge first by running down the road and having a helper (for safety's sake) monitor the speedometer versus the program's calculated speed. The program counts the number of speeds sensor pulses in a one second interval, then divides this by the distanceFudge to get the speed.

So, if the program shows that you are going faster than the speedometer, INCREASE the fudge factor. If it shows a calculated speed lower than the actual, DECREASE the fudge factor.

You can get pretty close with a little math. If the distance Fudge is 3200, (the beginning default value), you're going 60, and the program shows 70, then you're off by (70/60)*3200, or about 373. So try a fudge factor of 3573. When you get within a few percent, it's easier to just tweak the fudge factor by two to five units at a time, say from 3573 to 3575, then 3580, etc.

Over a long trip the TANK total miles (bottom box in the program) will be more accurate to tweak the fudge factor. So if you have 400 miles on the tank, and the program has calculated 375, you will have to decrease the fudge factor a bit.

Now that you have the speed calibrated, it's time to get the fuel factor set up. It works the same way, the program divides the total number of fuel injector pulses by the fuelFudge to get the actual fuel usage. You can get pretty close by topping off the tank, running the program while driving a quarter to half a tank off, then comparing the total gallons calculated with what it actually takes to fill the tank back up.

Same math will get you close, so if the program says it took 10 gallons, and it actually takes 8, you have to increase the fuelFudge by about 1.25 times. (The default is 8 million, so you'd want to try 10 million) It takes a bit of tweaking to get this one set up, but just a tank or so of fuel should get you pretty close indeed.

I hope this helps you all out.

Jim

curjones 09-02-2008 04:46 AM

I'm kinda lost here. May never get what you are doing so be gentle. Are you using the sound card already in the computer. Then do you have to enter some data to make this program work on the computer. Im trying to understand the basic concept. I have seen where you can buy programs that read gauges and sensors on the lap top.

theholycow 09-02-2008 05:12 AM

The idea is pretty cool: You use the existing sound card, since what comes over the injector wire resembles sound enough to be accurately recorded by the sound card. There's a program that analyzes that input, designed for this purpose; you just need to adjust that program.

curjones 09-02-2008 06:10 AM

So you buy the program, name,where and how much. Do you have to have a specific sound card.

theholycow 09-02-2008 07:12 AM

That's a good question about the program. I didn't know it existed until jim-frank posted about it above. Before that, I just knew that others have connected to sound cards, as in this thread:
https://www.gassavers.org/showthread.php?t=7608
(that link is in my thread about using the HF multimeter, too)

To do it that way, no specific sound card is necessary. The same is almost certainly true of the program jim-frank uses, which he says runs on Java; Java is somewhat hardware-agnostic, and uses the OS to deal with stuff like sound cards. I hope he comes back and posts the name of the program and tells us where to find it. A few minutes of googling failed to produce it for me.

I'd recommend trying it on a computer you're not afraid to hurt, first, just in case your fuel injection system uses high voltage or current or could otherwise damage the computer...after all, you are making a connection that no engineer ever expected you to make.

curjones 09-02-2008 07:23 PM

Was the name Audacity. That is what I pulled from the link you gave. Once you load the program are they using java to program to get the wave form. I know nothing about programing. I saw he had a bunch of language on a scroll down. I have seen other devices that you can hook up to the computer but they are expensive.

curjones 09-02-2008 08:15 PM

This site has good inf0
 
This site had some basic inf0. I believe the people here Have found a way to use a sound card and cut some cost.

https://www.aldlcable.com/

I have not got to read every thing but it looks like it has some really great info.. What do yall thiink. Think Ill make it a new thread.

theholycow 09-03-2008 04:36 AM

Audacity is a great audio editor, and was used in the link I gave you to view the waveforms...but it's not made for hooking up to fuel injection, it's just for audio. It can't do the calculations we need.

Where did you see the computer language? All I saw was a schematic for fuel injectors.

sonyhome 09-03-2008 08:19 AM

I'm too lazy to search though the forom or even this thread, but the MPG monitor was published on the forum both as a java binary and with the source code in case someone wants to edit it.
The source code is not needed to run the app.
just D/l the binary and run it.

The waev editor is just for kicks to look at the audio file.

The collection is done via the stereo microphone input of a PC/PDA or anything running java. One side collects Vss (speed sensor) and the other collects the fuel injector signal. From both you compute MPG.

Vss is a pulse AFAIK, so from its frequency you compute speed (but gotta calibrate it). FI signal is a on/off signal so ignore frequency, but compute duty cycle (how long on vs total of a cycle).

theholycow 09-03-2008 09:00 AM

Oh....it's this thread! Hahahah, I didn't even look back at earlier pages in the thread...d'oh!

There's some good stuff on the first couple pages!

This one has the compiled binary program:
https://www.gassavers.org/showpost.ph...6&postcount=43

Thanks, sonyhome! :D

GasSavers_Lurch 09-06-2008 10:30 AM

ummm, is this device you guys are building just for detecting the mpg??
if so its getting very complex. I like the soldered mass of diodes and resistors though. just have to wonder if he burnt himself :(

itjstagame 09-12-2008 08:11 AM

Wow this brings back memories. I can't believe it was over a year ago I was planning to do this and did nothing. I need to see where I put those diodes I bought or buy more. For some reason this time the circuit doesn't look as confusing or maybe I just want to jump in and test it more.

As for program, it's Java for now. Sony did you or anyone else ever use a graphics library and make anything cool? I saw a different thread in Holy Cow's thread but didn't see what code he was using.

The big thing holding me back was having no idea where my VSS signal is. I looked under the car, by the tranny and have no idea. Holy Cow you have a similar vehicle (fullsize chevy P/U), do you have any idea where VSS is or the lines run up from the tranny?

After that I need to reread the code, I remember making a lot of changes so I could calibrate easier and tell me fuel vs. acceleration and trying to build a way to automate cid calculation (but couldn't figure out how to solve the entire curve so that was a messy cludge).

itjstagame 09-12-2008 10:52 PM

2 Attachment(s)
Man, why did I take a year to do this, it's so easy. I found and tapped the wire and soldered the diodes up easy. I was worried since the only diodes I could find at Rad Shack said 50v, but they clamp it to .7V. I wired up and described and as MPGMetro did and I tested before I hooked to my laptop. We're producing a cycle wave so I just set my multimeter on AC and tested the voltage. Worked great and I definately had just the inside tip giving a reading and nothing hooked to the other side yet (haven't looked for VSS yet).

I made a sample recording though and I have two channels of data. Maybe my laptop just has a mono microphone jack? It doesn't have a line in like my old laptop used to, just mic.

Now I understand the fudge factors, but what are the vssthreshold and injthreshold for? Attached is a shot of my 1st record. It idled for a while (the left side) and this is a shot of right when I hit the accelerator a bit. .7V is pretty low Db, so does this mean I should lower my inj threshold a bit compared to your car?

Also whenever I start the program with no audio hooked up (and configed to not use a test wav) it keeps displaying random numbers for a while. Sometimes the whole time I'm in the program (10+ mins) and other times it'll stop after a couple mins. Does this happen to you too and any ideas?

Also I've been adding to this program like crazy. I still don't have a good way to calculate the Cid, but I have entrants for Cid, air temp, elevation, car weight and frontal area and I've added current acceleration and HP to the displays. My HP isn't quite right though, I found a good calculation for acceleration times car weight (/ by 32ft/sec^2 to get mass), but I want to add this to a drag calculation https://en.wikipedia.org/wiki/Drag_(physics). My thought being, if I'm holding at 45MPH I don't want it to say 0HP, this way it'd show the HP required for that speed due to drag and also show HP as I accelerate. Once I get this down good I want HP/gal. That way I can finally test if slowly accelerating to 45MPH is better than hot footing it to 45MPH, it should show my best efficiency of the engine (most power for gallon of gas).

So if anyone can decipher that drag calc let me know. My accerlation HP is all in ftlb/min which is standard HP measurement. But when I try even simple examples on paper with the drag calc using either ft, lb or metric I always get very large numbers and I'm not sure what the units are, certainly not HP or watts.

I'll post the code update when I'm done, but it's already been over a year and requires more debugging so who knows when :p.

itjstagame 09-12-2008 10:54 PM

Quote:

Originally Posted by Lurch (Post 117649)
ummm, is this device you guys are building just for detecting the mpg??
if so its getting very complex. I like the soldered mass of diodes and resistors though. just have to wonder if he burnt himself :(

How can you say it's complex? 2 diodes and a resistor hooked to an injector ( I just did this up in 20 mins or so) and the software works fine out of the box, I'm just adding more stuff I'd like to see. It's a simple java program that reads the injector cycles from the audio input and based on this you can approximate fuel (once you tune the fudge factor).

itjstagame 09-14-2008 02:48 PM

Ha, I was adding RPMs are 2 * injector firings / min, which makes sense because with 1 injector per cylinder each injectors gets fired every camshaft revolution, that is every 2 crank revolutions.

I just found out my TBI actually injects once for each cylinder firing! So 4 times per crankshaft revolution and 8 times per camshaft rev. Cool!

itjstagame 09-15-2008 05:57 AM

6 Attachment(s)
Ok, another question in case Skewbe comes back. I recorded a run today (just fuel, no VSS yet) and looked it over. My previous test idling looked like I needed a -20 threshold or so and I think this is still good, but I wanted to ask about the strange things I'm seeing.

If you look at the attached pictures, I'd say 'bumpy' is pretty much the normal output I see, here you can see where I'm revving up and accelerating a bit after a turn. Strange that not only the pulses get stronger but I get a very high 'noise' wave. That is, are there only 3 fuel pulses in this picture? Why is it so noisy at the end?

More bumpy is at the same zoomlevel and further in the trip. Now the noise is getting sharp points. Very strange. Again would you say there's only 3 injections there? The 'noise' is starting to look more like injections. At this point I measured the low points of the noise and it was -16, so it's getting close to my threshold.

Then in the middle of my trip it went 'flat'. This is the same exact zoom level and noise is very very minimal and the injections look obvious. There's only two here now. My TBI is supposed to inject once for each cylinder (I think both injectors fire once per each cylinder or 4 times each per revolution), but here I calculated at at this rate in the 'flat' picture it's only 1100 injections per min. That can't be 300 rpm and even at double that, 650 rpm still seems too low (I have no tach in my truck). Is this some form of DFCO or something? It's injecting once per rev and skipping a bunch of cylinders or something?

Even stranger is my SoundForge chops out dead air in the middle. I had many points where it said it cut out 2-3 secs here and there. That must mean the recording was completely flat with no noise. DFCO maybe? This run was only at 45MPH max and I just left it in overdrive the whole time, so I doubt my revs would be high enough for DFCO (as I understand it).

Thoughts ?

itjstagame 09-18-2008 05:52 AM

Well hooked into the VSS and tested without any resistor or diode using AC voltage. I know it's definately increasing frequency and not voltage but I think it's averaging the voltage and more waves means higher average. Anyway 15MPH was about 10volts and 55MPH was 45Volts, that's a lot. Maybe I should use a resistor bigger than 10k? The diode bridge should clamp to .7, right but still worries me.

sonyhome 10-19-2008 12:20 AM

Aahh... I still have to do this project and spend some time learning Java. i want to use Eclipse to do the R&D, but need time and must make a decision as to which graphic library to use (there's like 3).

Like ItsJstAGame, I've been lazy to find out where that dang Vss wire is, and how to wire the injector wire through the firewall.
Maybe I can get those signals directly from the ECU (?) inside the car.
I have plenty of crappy old laptops to throw at the problem.

Well, first, gotta fix my alternator and change the timing belt and do brakes.

ItsJstAGame:
You're not making much sense in that last post.

i'll just pitch in generalities, maybe it will answer what you ask:
If you have an A/C signal, the longer the duty cycle, the higher the voltage read. If you have a square signal duty 50% and max Vcc 50V, then the voltage you'll read is 25V (1/2 on, 1/2 off).

If your foot is on the gas pedal, you should not DFCO... Idle is 700~1000rpms, so you can use that as a base and play it by ear. Maybe go to what feels like very sluggish in 5th gear... Will be likely 1500rpm 2000rpm, and record when accelerating: no DFCO for sure.
If you like math and know the gear ratios then you can tell what RPMs you do at a given speed, say in 5th gear.

You should be injecting 4x per rotation on a 4 cylinder, right? Then you need to fudge in the injector size (cc/min), and it's trigger delay (it likely has a latency between the start for oozing gas from when the electric signal is on).

Lastly, your pictures have either high amounts of noise making them unusable, or you're soomed out and are seeing 100's of cycles.
Zoom in to 1 "noise" element, and compute it's frequency looking at the time line displayed by soundforge.
Your connection might be crappy: not shielded well enough and drudging noise from random stuff like the alternator, too inductive or capacitive, preventing the injector signal from reaching the sound card.

@#!$ I got to get my *** in gear and try this project... :\

theholycow 10-19-2008 04:05 AM

Quote:

Originally Posted by sonyhome (Post 121759)
Like ItsJstAGame, I've been lazy to find out where that dang Vss wire is, and how to wire the injector wire through the firewall.
Maybe I can get those signals directly from the ECU (?) inside the car.

I think most ECUs are on the far side of the firewall, so you still have to run wires in.

I have difficulty poking wires through existing firewall holes and hate drilling new ones, so I've found a good way to get wires in without penetrating the firewall at all. Just run them to the side of the car, between the sheet metal and the firewall, and close the door on them. Tuck them behind the dash trim and you only see a couple inches of wire when you open the door.

Quote:

You should be injecting 4x per rotation on a 4 cylinder, right?
One of us is doing math wrong; wouldn't that be 2 injections per rotation? Don't forget the exhaust stroke...

Quote:

@#!$ I got to get my *** in gear and try this project... :\
I have the same problem all the time, which is why my grilles are still not blocked. :(

sonyhome 10-19-2008 08:50 PM

What? You don't have your grills yet?

https://www.goldteeth.com/images/invisible-sets2.jpg

On civics, the ECU is under the passeger's feet. Also found the wires to pull from it...

All OBD-1 Honda/Acura cars:

A1 - INJ1 - Brown - Battery Voltage with KOEO
B10 - VSS Vehicle Speed Sensor - Orange - Pulses 0/12V while spinning front-left wheel

https://www.b18c5eg.com/obd1.jpg

itjstagame 10-20-2008 12:29 PM

Sweet updates! Well I still haven't tested stuff because I don't have stereo line input :(. But now I'm mostly driving the Festy anyway, the Truck has gone <50 miles in 1 month. But I would like to get it tested and then install on the Festy too.

I can't believe it took be over a year to do becasue it's pretty cool.

As for my 'bumpy' pictures. I really have no idea. I'm quite confident that the larger spikes are the events I want. It's certainly possible the noise could be ignition. It seems to increase with throttle and my unshielded 12 gauge (can't recall actual gauge but not too thick) wire goes right over almost all the ignition wires and the distributor. I mean it's at least 3" away all the time, but still...

As for my confusing post, the VSS is usually a magnet pulsing a coil as the driveshaft or something in the tranny spins, so it produces a AC. Yes I assumed the peak, actual voltage generated would stay about the same, so more AC means higher duty cycle/more AC pulses. Either way it's looking ok when I recorded it, but I used a 33k resitor which may have been a bit too high.

And yes, on a 4 cyl you'd have 2 injections / crank rotation, 4 / cam rotation. On a V8 this is obviously different, but mine is even more different because it's TBI and only has 2 injectors right at the start of the intake runner that feeds all 8 cylinders.

I had originally assumed 2 batch fires / cam rotation (full OTTO cycle), but after reading online it is actually supposed to inject 8 times, I at first thoght this meant 4 times each / cam rotation, but that still looked awefully low, so I decided each one must be firing 8 times, so that's 4 times each / crank rotation. But yeah, definately with it just idling I can see really strange suff, like I can tune so that idle is about 1000 rpm but then when it warms up it can be as low as 350rpm. I'm sure it's just not calculated right, but sometimes I really think it's firing less times/cycle under certain conditions.

sonyhome 10-20-2008 01:47 PM

LOL! Yeah, no way you can be at 350rpm... Unless your truck sounds and vibrates like a harley.

700rpm more likely.

I'd expect you'd go from 1200~1500rpm when cold down to 700~1000rpm idle when warm.

Vss could also be 12V pulled down to 0V, aka reversed.

As for how many injections per cycle, I dunno...
I dunno why you say 2 injections per cycle. (Note
I do not consider the case of cylinders that have 2 or
4 injectors, 8 or 16 valves or what not) For me an injection
is one injection of gas into a cylinder followed by a burn.
I woud expect each cylinder do do one burn per cycle.
However we're veering off topic here.

theholycow 10-20-2008 02:13 PM

Quote:

Originally Posted by sonyhome (Post 121925)
I woud expect each cylinder do do one burn per cycle.

Yes, but a cycle requires two revolutions.

https://upload.wikimedia.org/wikipedi...oke-Engine.gif

itjstagame 10-21-2008 05:27 AM

Yes, when I say cycle I mean full OTTO cycle, 2 revolutions of the crank and 1 revolution of the cam.

As for the 2 injections it's because I only have 2 injectors on my V8, not 8. The ECU could fire those whenever and how ever often it wants to as long as it's fuel requirements/cycle are met. Which is why I'm wondering if at idle or below a certain pulsewidth time if it doesn't just drop from 8 injections/cycle to 4 injections/cycle with larger pulse widths. I mean depending on injector size and fueling requirements I'd totally program it to do this so who knows what GM did.

theholycow 10-21-2008 06:20 AM

Quote:

Originally Posted by itjstagame (Post 122001)
Yes, when I say cycle I mean full OTTO cycle, 2 revolutions of the crank and 1 revolution of the cam.

Yeah, that discussion was a response to this:
Quote:

Originally Posted by sonyhome (Post 121759)
AYou should be injecting 4x per rotation on a 4 cylinder, right?

Anyway...back to our regularly scheduled programming...

Quote:

Which is why I'm wondering if at idle or below a certain pulsewidth time if it doesn't just drop from 8 injections/cycle to 4 injections/cycle with larger pulse widths. I mean depending on injector size and fueling requirements I'd totally program it to do this so who knows what GM did.
Measuring duty cycle, which IIRC is what we're talking about (but maybe I'm lost again), makes the question unnecessary. Whether you have 8 small injections or 4 large injections, your duty cycle is the same. This may be a short-attention-span-failure on my part...


All times are GMT -8. The time now is 06:33 AM.

Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.