Parts Catalog Accessories Catalog How To Articles Tech Forums
Call Pelican Parts at 888-280-7799
Shopping Cart Cart | Project List | Order Status | Help



Go Back   PeachParts Mercedes-Benz Forum > Mercedes-Benz Tech Information and Support > Diesel Discussion

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 08-13-2015, 06:32 AM
Registered User
 
Join Date: Feb 2013
Posts: 33
A finished w124/w126 diy LED fuel gauge

Hi all, finally I have something to contribute back to the community.

So we have two 84 300SD's and of course the thin resistance wire on the fuel level sending unit broke on both cars. I had the most difficult time trying to find an identical match to the resistance wire Mercedes used and spending over a hundred dollars for a unit on ebay or rolling the dice and waiting at the junkyard was just something I wasn't going to do.

The following is something of a how-to guide on how to make an LED gauge out of the tank unit. I'll try to describe the electronics the best i can as not all readers are familiar or comfortable with electronics or arduino microcontrollers. It this seems like a long or boring read, I apologize. Please don't interpret the language used as condescending.. I'm just trying to reach and teach the widest audience as possible.

I wanted to leave the fuel gauge in the instrument cluster alone in case I came across a stock unit in the junkyard one day. If you'd rather put your turbo gauge there instead or something, go for it. But to be non-invasive I just made an LED bar to represent how empty/full the tank is which I mounted outside the cluster. To do this, I used an arduino and coded a program to handle this. If you have no idea what that is, it's simply a small programmable computer and I'll try to walk you through it enough that you can just copy/paste your way through.

~

Fuel Reader:

I was going to fabricate a capacitive sensor in place of the fuel unit; however I had concerns with temperature fluctuations giving faulty readings. To avoid that headache I just converted the broken fuel reader.

The market on the aforementioned resistance wires is FLOODED with kanthal wire for vaporizing pens and is extremely cheap, I got a 100' roll for something like $5. I used 28 gauge kanthal wire which measured a resistance reading of 8.4 ohms over 10 inches. You don't need to get too hung up with what the resistance value is if you plan on attempting this and go looking for the wire.

I removed the fuel level sending unit and replaced the old wire with the kanthal wire in the same configuration as before. (See the posts about removing and cleaning the unit).

Note: make sure the pins on the black bobber contact the wire correctly on both sides, they should "hug" the wire. I soldered the kanthal in the same locations as well. Its a 1-for-1 replacement. Be aware this has nothing to do with the cooper wire which runs down the center. Orient yourself by looking at the resistor & flat bars.

The (2.4 kiloohm?) brown/tan resistor that Mercedes applied across the two flat bar contacts was removed (or reasons i'll explain later). Also, to avoid later confusion take a sharpie and mark off the pin which connects to that copper line, we won't be needing it.

~


Arduino:

For the "brains" of this project, I used an Arduino Mega 2560 i got for $10. To be honest, the Mega is a bit overkill for this and you might be able to get away with some of the weaker & cheaper units such as the Uno or the Duemilanove. I can't say one way or the other since I haven't tested it but I have little concern it should be an issue.. but its something to be aware of.

The code for this project I'll post at the bottom of this page. All you need to do is download the Arduino software, hook your unit up to the computer, copy & paste the code below and hit upload. That's it. If there are any difficulties I'll be more than happy to chime in and help out if you can't google a solution. (Linux: run the arduino software as root)

~

Circuit Diagram



Understanding the breadboard: That white thing with holes in it is just an easy way to hook up circuits. So you're oriented with the circuit.. the top two lines (with the + and -) of holes are actually all connected horizontally.. the slots A,B,C,D, etc below it are all connected vertically. So picture those lines of holes as a single wire.

The positive (longer legs) of the LEDS are connected to digital slots 2, 3, 4, 7 & 8. The negative (shorter legs) of the leds are grounded.

The little part with the squiggly line (which is what usually is a photoresistor) is just a visual representation of the tank fuel gauge. One leg is grounded (doesn't matter which one). The other leads into the..

~

Self made resistor?:

(Represented by the blue dial looking thingy in the picture) This is where people will have the most trouble.. without getting into the circuit analysis too deeply, because the resistance value of the kanthal wire is so small.. you can do one of two things... I used 21 inches of wire, assuming you match the resistance values of my unit (approx 10 ohms empty tank).. you can use a 13 ohm resistor here.. (or 10 ohms + 1 ohm + 1 ohm + 1 ohm resistors chained together and treated like one big one.)

Chances are you won't because there are countless different types of resistance wires and all of them have maybe a hundred different resistances. But don't sweat it. You can make a resistor with the same wire you used to retrofit the fuel reading unit. Unroll a decent amount of wire and connect it to the fuel unit.. and (maybe with an alligator clip) non-permanently connect the wire to the arduino and move the bobber and see how accurate your LED's light vs. where the bobber is. If it's wrong, keep moving it until you hit that sweet spot and you get accurate tank readings. Here you can measure the resistance with a multimeter and get a matching resistor/s or just wrap the wire around something nonconductive and tape the sucker.

I suggest doing this instead of a potentiometer.. since the sweet spot is actually quite small.

Powering the whole thing:

You can either find a switching regulator such as the LM2596 on ebay to hook directly to the battery, or you can try to find one of those "usb from the cigarette lighter port units" typically used for phone charging in the car you see at the gas station and use that. You'll need one of those cylinder jacks you typically see in wall warts:



so just cut one end of that and solder it to the end of some usb cable you aren't using and do that. Or if you're very bold and mcgyver.. just harvest the parts from the cig usb and wire that up directly to the battery. I bet someone does this.

I'll leave it you where to put the LEDS, Arduino board, etc. If you got any questions I'll be happy to answer them. I'll be back with more W126 electronics projects.


The Code, created by Jonathan Henry Williams (not myself):

/*
This is the "LED fuel gauge" code

Analog input, serial output

Reads an analog input pin, prints the results to the serial monitor.
outputs high voltage signal to 5 different pins based on reading.


The circuit:
(100 ohm) voltage dividing circuit connected to analog pin 0.

LEDs connected to pins 2, 3, 4, 7 and 8
LEDs come on and stay on as resistance is lowered. - all LEDs lit indicates full tank.

Greater than 385 = LED1 blinks (Very empty!!)
less than 385 = LED1 on (empty)
less than 353 = LED2 on
less than 291 = LED3 on
less than 229 = LED4 on
less than 167 = LED5 on (full)

created by Jonathan Henry Williams and everyone who's ever used Arduino

*/
int led1 = 2; // the output pins
int led2 = 3;
int led3 = 4;
int led4 = 7;
int led5 = 8;

void setup()
{
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);

Serial.begin(9600);
}



void loop() {
// read the analog input into a variable:
int analogValue = analogRead(0);
// print the result:
Serial.println(analogValue);
// wait 10 milliseconds for the analog-to-digital converter
// to settle after the last reading:
delay(0);

if ((analogValue>385) && (analogValue<1028) ) { //
digitalWrite(led1, HIGH);
delay(500); //
digitalWrite(led1, LOW);
delay(0);
}
else {
digitalWrite(led1, LOW); // light is off
}


if ((analogValue>0) && (analogValue<354) ) { //
digitalWrite(led1, HIGH); //
}
else {
digitalWrite(led1, LOW); // light is off
}

if ((analogValue>0) && (analogValue<292) ) { // pin 0 reads 2nd resistor only - 268ohm - beige
digitalWrite(led2, HIGH); // fan goes on!
}
else {
digitalWrite(led2, LOW); // fan is off
}

if ((analogValue>0) && (analogValue<230) ) { // pin 0 reads both resistors in parallel
digitalWrite(led3, HIGH);
//
}
else {
digitalWrite(led3, LOW); //
}
if ((analogValue>0) && (analogValue<168) ) { // pin 0 reads both resistors in parallel
digitalWrite(led4, HIGH);
//
}
else {
digitalWrite(led4, LOW); //
}
if ((analogValue>0) && (analogValue<106) ) { // pin 0 reads both resistors in parallel
digitalWrite(led5, HIGH);
//
}
else {
digitalWrite(led5, LOW); //
}

}

Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:44 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2024 Pelican Parts, LLC - Posts may be archived for display on the Peach Parts or Pelican Parts Website -    DMCA Registered Agent Contact Page