When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission. Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network.
How to get your Fuel gauge working in MS3 / Megasquirt / Tunerstudio
Thought I would make a quick write up on this since it was very hard for me to track down the information and heck, I might even need it into the future.
What you'll need:
-Megasquirt
-Tunerstudio
-Soldering Iron and solder
-100 Ohm resistor
-Spare wire / butt connectors / wiring tools
-Options port plug and plug wires - https://www.diyautotune.com/product/...ector-package/
This is actually pretty simple to setup. I had to do this b/c I wanted to use a digital dash / pidash for track days and immediately realized I couldn't tell how much fuel was in the car. The MS3 in particular has an options port, but I'm sure all megasquirts have something similar that you can use to pipe in an analog sensor's signal. I'm not expert, but as best I can tell from my time researching, the fuel sender is a resistive sensor or variable resistor sensor. It changes resistance based on the fuel level it detects. The key is that the megasquirt can't measure resistance directly and thus can't see the change in resistance that the fuel sender does when the fuel level changes. It can however read voltage. You connect the 5V reference into the same circuit as the fuel sender so that the megasquirt can see the voltage change. You add a 100ohm resistor to the 5V reference because the change in resistance that the fuel sender creates is too small compared to a full 5V, thus the resistor creates a large voltage change for the megasquirt to measure.
You will need to find your fuel pinout on the plug to your gauge cluster and wire it into the option port, C or D. As I found out, this alone is not enough to get a proper read out. You will also need to wire from pin out H (+5V Ref) into that same wire. You will also wire in a resistor on the wire from pin H BEFORE the connection to the fuel wiring. From my understanding you need the 5v input to put a voltage across the fuel line so the megasquirt can see variable voltage.
Here is a basic wiring diagram. Note that Fuel Sender to Pin A for this diagram is pin A on the driver side large gauge cluster plug on by NB2.
Once you have the wiring done, connect up your tunerstudio and do the following:
Go to "Advanced Engine" > "Generic Sensor Inputs"
Select the appropriate analog input in the first dropdown
Name it "Fuel Level"
For "Transformation," select "Linear"
For calibration, you'll need to enter the voltage values that correspond to:
Empty tank: Around 4.5V or 110ohm
Full tank: Around 0.15V or 3 ohm
Add a gauge and choose the fuel level sensor you just created. Now you need to calibrate it as it probably isn't reading perfectly to your fuel.
Go fill up your gas tank. You should see the number in the gauge CHANGE. It probably will not be 100%. Go back to the Generic Sensor Input and you can modify the min/max ohms to get the output to correspond to 100. Run the car to nearly empty (if you have removed your stock cluster like I did, I recommend putting it back). Now update the same fields so the fuel level gauge reads as low as you want it to read for how much gas you think you have in the car.
Let me know if something doesn't make sense and I'll be happy to update with clarification.
To get a more accurate reading, check your voltage with the tank empty, and again when full. Since TS only allows two points, it might be better to grab voltage when empty and with ~3 gallons of fuel, so the bottom ~1/4 tank is really accurate. Otherwise, tank voltage readings 1 gallon at a time from empty to full, and create your own custom .inc file for a custom sensor cal. Unfortunately TS only allows one custom sensor cal, so if you're already using it, you're limited to a 2 point guess.
To get a more accurate reading, check your voltage with the tank empty, and again when full. Since TS only allows two points, it might be better to grab voltage when empty and with ~3 gallons of fuel, so the bottom ~1/4 tank is really accurate. Otherwise, tank voltage readings 1 gallon at a time from empty to full, and create your own custom .inc file for a custom sensor cal. Unfortunately TS only allows one custom sensor cal, so if you're already using it, you're limited to a 2 point guess.
Yep - I've yet to get the tank back to empty so I guess we'll see how it figured it out. I did notice that a digital (numbered) gauge is not the way to go, at least not the one I overwrote as it is too sensitive and I'm guessing I'm seeing fuel readings change +/-1% from 100 based on it sloshing around in the tank.
Iron canyon makes a pretty good box that converts the resistance based sensor to 0-5v, and it has an anti-sloshing circuit built in. That's one of the problems getting rid of the stock cluster, the anti-sloshing is built into the gauge. If you can, reduce frequency to as low as possible.
Looks like Tunerstudio has some other gauge types I didn't check out and they seem to have bigger increments before making it move. I'll test 'em out and report back.
For future people's reference, here's my settings for my '02 miata:
Transform: Linear 0.5-4.5V ("Linear" seems to be exactly the same) - min 99.4, max, -15.0.
This was on a max max fill and when the needle was on the top side of the E. It reads 100.0 with me slowly filling the tank until literally would not take another drop. Read 12 when the needle was on the top side of E. I put 11 gallons in, assuming it is a 12 Gallon tank technically I only had 8% fuel left, but it was close enough for me.