Technical Discussion Topics related to Technical Issues

Fuel gauge mods

Thread Tools
 
Search this Thread
 
Old 07-17-2015, 11:32 AM
  #1  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Fuel gauge mods

I've got a 98 hawk with a bum sending unit (found this out after running the poor thing dry). I tested the light and it works so it's gotta be the SU. Now I see that the later hawks had a float with an LCD readout on the gauge and I also see that the newer float type will fit in the older tank with consideration being given to an internal vent tube or something of the sort.

My plan is to pick up a newer float-style gauge and just whip up my own electronics for a gauge. Not sure if I want to use an RGB LED to indicate level (green->yellow->red or something like that) or use something like a 16x2 graphical LCD and have a bar graph readout.

Has anyone made their own setup for a fuel gauge? I'm interested to see what other people have done and get some ideas.
SXRguyinMA is offline  
Old 07-17-2015, 12:40 PM
  #2  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
Yea back in 06 when I got my bike I found out the hard way my gas light doesnt work.... and I havent cared since....
scottiemann is offline  
Old 07-17-2015, 06:17 PM
  #3  
Senior Member
MotoGP
 
smokinjoe73's Avatar
 
Join Date: Jul 2007
Location: NYC
Posts: 5,033
smokinjoe73 is on a distinguished road
Not sure exactly how you would do it. I tried to adapt a 2nd gen sender to a cbr dash but the resistance was different. Even with resistors and a potentiometers I couldn't get it right.

The sending unit is a pretty easy swap. Just knock the vent tube out of the way.

Or just buy a 2nd gen dash and sell yours to pay for it.
smokinjoe73 is offline  
Old 07-18-2015, 07:26 AM
  #4  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Well I just picked up a float level sender off eBay for under $40 shipped. When it gets here I'll measure the full and empty resistance and make a custom gauge for it. Should be rather simple. The hard part will be weatherproofing the electronics lol
SXRguyinMA is offline  
Old 07-18-2015, 09:39 AM
  #5  
Senior Member
MotoGP
 
smokinjoe73's Avatar
 
Join Date: Jul 2007
Location: NYC
Posts: 5,033
smokinjoe73 is on a distinguished road
That part is easy, just cover it in epoxy or silicone caulk. The resistance numbers are in the repair manual under trouble shooting.

Double check it but I think the gasket (rubber ring) for the 2 units is different slightly.

Go to ronayers fiche and see if they are the same part number. (my memory says they are not). You don't want to have gas leaking onto your hot engine. (or at all)

This is an interesting mod so keep us posted with pics etc.
smokinjoe73 is offline  
Old 07-18-2015, 09:42 AM
  #6  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
They're the same part number when checking a 98 against an 04 (91305-MC7-000). Which is great because I just replaced it when I got the bike because it was leaking lol.


I'll definitely post pics and schematics and code once it's all done. I'm trying to decide if I want to use a single RGB LED and just have it change colors based on level or if I want to make an actual gauge on an LCD. I'll play with both and see which I like better.
SXRguyinMA is offline  
Old 07-18-2015, 09:57 AM
  #7  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
It will be interesting to see if you can make it accurate but that will take a lot of math, the LED would be a lot more simple then the gauge
scottiemann is offline  
Old 07-18-2015, 10:09 AM
  #8  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Nah that will be easy. It's just a matter of getting the actual high and low resistance from the gauge and mapping the LCD readout to those values so it will automatically scale the readout to the actual sender resistance
SXRguyinMA is offline  
Old 07-18-2015, 10:28 AM
  #9  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
Im aware of how its done, what im saying is if you decide to run a gauge instead of LEDs, calculating the resistence against the actual volume present in the tank due to its odd shape. Some people that have run a gauge say it goes from full to half real quick and then a third to empty real quick and the middle third takes the longest due to the fact that there is the most volume per unit of height in the middle of the tank. So in order to make it accurate you would have to experiment with specific volumes and recording the resistence and or a lot of calculations...

Am i making any sense?
scottiemann is offline  
Old 07-18-2015, 10:38 AM
  #10  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Ok I see what you're saying now. I hadn't thought about that. Oh well, something else to mess around with lol
SXRguyinMA is offline  
Old 07-18-2015, 06:08 PM
  #11  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
I came aross this and I'm goign to modify it to suit my needs. I'll remove the oil and water parts of it and wire in the factory (working) low fuel LED. I'll just modify the resistances based on the actual sending unit when I get it.

Designing an Arduino Fuel Gauge & Warning Lights
SXRguyinMA is offline  
Old 07-18-2015, 08:41 PM
  #12  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
I fully support that idea but arduinos are expensive, you can find a similar prototyping board from another company that would be cheaper... but again i fully support people designing and programming their own electronics.

Would you use arduino code or another low level language?
scottiemann is offline  
Old 07-18-2015, 08:46 PM
  #13  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
I'm not going to put the whole Arduino in lol. I've got tons of chips and components laying around. I'll design a PCB and have it made. I'll use the smallest chip that's got enough GPIO to run everything. Heck of I was going the RGB LED route I could use an attiny85 or something. I'll pray use the Arduino IDE as it's so easy. I've got a couple Arduino's and ChipKit's floating around to mess with along with RGB and single color LCD's
SXRguyinMA is offline  
Old 07-19-2015, 05:19 AM
  #14  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
Well after seeing your last comp build with your own PCB for the cooling system I'm excited to see what you come up with. If you can make it worth your time and money I'm sure some guys on the forum would buy it
scottiemann is offline  
Old 07-20-2015, 10:50 AM
  #15  
Not Realy A Squid
Squid
 
waltr's Avatar
 
Join Date: Sep 2006
Location: Portland Oregon area
Posts: 93
waltr is on a distinguished road
I say use the bar graph. I am interested in this for my own bike, I hate the RLOD. It would be great if you could actually map it to the fuel volume remaining instead of just a linear level change because of the tank shape as mentioned above.
waltr is offline  
Old 07-20-2015, 11:00 AM
  #16  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
That should be ready enough to do. Just start with an empty tank and put measured amounts of fuel into the tank and take resistance readings at those specified fuel quantities rather than the level.
SXRguyinMA is offline  
Old 07-23-2015, 09:34 AM
  #17  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Well I got the float gauge so today I'll get a readout working. Interestingly enough the tank is 16L and the LCD has 16 segments. It's also got and RGB backlight so I think the plan will be to have each segment be 1L. Now the reserve is 2.65L so I think I'll round it up to 3. I plan to have the backlight green and slowly fade to orange and then once it hits the 3L level it will turn red. Thoughts? I'm going to whip it up on my lunch break as a proof of concept
SXRguyinMA is offline  
Old 07-23-2015, 10:08 AM
  #18  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
good deal, sounds like a plan, do you have pics of the display you will be using?
scottiemann is offline  
Old 07-23-2015, 10:20 AM
  #19  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Originally Posted by scottiemann
good deal, sounds like a plan, do you have pics of the display you will be using?

This is what I'm prototyping with and it's what I plan on using in the final product. I'll probably 3D print an enclosure once I get a PCB design finalized and made.


RGB backlight negative LCD 16x2 + extras [RGB on black] ID: 399 - $13.95 : Adafruit Industries, Unique & fun DIY electronics and kits
SXRguyinMA is offline  
Old 07-23-2015, 11:13 AM
  #20  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
ok pardon my stupidity but it all makes sense EXCEPT for, how is it going to automatically switch colors?

I'm no electrical engineer, just a hobbiest, but from reading the description it looks like you would change the color with how its physically hooked up, not programming... sorry I just cant picture the schematics for it at the moment...
scottiemann is offline  
Old 07-23-2015, 11:34 AM
  #21  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Well you drive the LED backlights with PWM. So you can set the green to 100% duty cycle (full on) for a specified fuel level (resistance) range. Then set green PWM to 50% and red to 50% (orange) for another specified level range then finally when it sees resistance for ~3L (reserve) it will set the PWM of the green LED to 0% (off) and red to 100% (on)


EDIT I'm going to have the PWM values fade instead of going straight from 100% to 50% so it'll gradually change colors and be less intrusive.

Last edited by SXRguyinMA; 07-23-2015 at 11:40 AM.
SXRguyinMA is offline  
Old 07-23-2015, 11:41 AM
  #22  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
oh ok gotcha, must have missed that part in the description.
scottiemann is offline  
Old 07-23-2015, 11:47 AM
  #23  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Well it's been so long since I've messed with my Arduino that I forgot how to hook up the LCD and get it all configured so I spent my lunch break doing that LOL. But the LCD is up and running so tomorrow's project will be slowly adding in features (bar graph, resistance reading, smoothing and averaging of the readings [so the graph isn't bouncing all over as the fuel is sloshing around], setting LED PWM and mapping float resistance to the bar graph).


Once I get it working on the bench I'll swap the sender and add 1L of fuel at a time and read the resistance of the float and calibrate the bar graph to that so that the bar graph is showing fuel quantity rather than fuel level.
SXRguyinMA is offline  
Old 07-24-2015, 01:26 AM
  #24  
Out of my mind, back in 5
MotoGP
 
Tweety's Avatar
 
Join Date: Nov 2006
Location: Skurup, Sweden
Posts: 6,109
Tweety is on a distinguished road
Originally Posted by SXRguyinMA
Well I got the float gauge so today I'll get a readout working. Interestingly enough the tank is 16L and the LCD has 16 segments. It's also got and RGB backlight so I think the plan will be to have each segment be 1L. Now the reserve is 2.65L so I think I'll round it up to 3. I plan to have the backlight green and slowly fade to orange and then once it hits the 3L level it will turn red. Thoughts? I'm going to whip it up on my lunch break as a proof of concept
That sounds nice in theory, but how are you going to account for the fact that in the middle part of the tank, which is a lot wider, you have 2-3 liters of volume for every small movement on the float, vs a lot less on the top and bottom?

The only way to get it even ball park right would probably be if the float is very sensitive and accurate in its increments, and you actually fill the tank to specified volumes and read out the values, to make a lookup table, because any kind of ma thematic formula will be mostly guesswork...

I know firsthand, since I have made a bar-graph style fuel gauge... I gave up having that kind of resolution long ago, and have just 5 bars and the lower blinking for 'reserve', and they aren't really equal in volume, just a rough estimation...
Tweety is offline  
Old 07-24-2015, 04:45 AM
  #25  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Well the gauge goes from about 92 ohms to about 11 IIRC. So I'll start with an empty tank and add 1L of fuel at a time and read the resistance then use those readings in the code. That way the graph will correspond to quantity not level
SXRguyinMA is offline  
Old 07-24-2015, 12:25 PM
  #26  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Ok I've pretty much got it working how I want. All that's left is to add in some smoothing so that the gauge isn't going bonkers when the fuel is sloshing in the tank. I also need to get a PCB designed and made and get an enclosure designed and 3D printed on my Prusa i3. Thoughts so far? It turns red as 3 bars ~ 3L fuel remaining (2.65L reserve according to the specs).


Right now it's calibrated linearly to float level rather than fuel quantity but the float isn't in the tank yet so that will come later. On the plus side though having it set to float level means it will work in both 19L and 16L tanks just fine.

Here's a short (6s) video I took of the proof-of-concept in action.
https://goo.gl/photos/TrYC4aPGkhyNdG4y8
SXRguyinMA is offline  
Old 07-24-2015, 12:45 PM
  #27  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Here's the code for anyone interested:

Code:
/*
 *LCD Fuel Gauge for Honda SuperHawk 16L Tank
 *https://www.superhawkforum.com
 *Code by Will Lyon 7/24/2015. Contact: will.lyon12584@gmail.com
 *Uses the LcdBarGraph Library for Arduino. Author:  Balázs Kelemen. Contact: prampec+arduino@gmail.com
 *Designed to be used with the Adafruit 16x2 RGB LCD (both negative and positive work properly)
 *5V to fuel sensor Grn/Blk
 *Fuel sensor Gry/Blk to Analog 0 with 10k resistor to GND
*/

#include <LiquidCrystal.h>
#include <LcdBarGraph.h>
byte lcdNumCols = 16; // 16 columns in the 16x2 LCD
byte sensorPin = A0; // Fuel float sensor 5V input with 10k resistor to GND and Analog 0
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // LCD connected to digital 7-12
LcdBarGraph lbg(&lcd,16,0,1); // Parameters for LCD bar graph library
const int redPin = 5; // Red LCD backlight on Digital pin 5
const int grnPin = 6; // Green LCD backlight on Digital pin 6

void setup() {
  pinMode(redPin, OUTPUT);
  pinMode(grnPin, OUTPUT);
  lcd.begin(2, lcdNumCols);
  lcd.clear();
  delay(100);
}

void loop() {
  int level = analogRead(sensorPin); // Label sensor reading as "level"
  level = map(level, 624, 946, 0 ,1023); // Map the sensor's 624E/946F readings to 0-1023 for proper graph display
  lcd.setCursor(0, 0);
  lcd.print("E      ||      F"); // Static full/empty readout on the LCD
  lbg.drawValue( level, 1023);
  if (level < 200) // If the mapped value is below 200 (approx. 3L fuel remaining)
  {  
      analogWrite (grnPin, 255); // Turn the green LCD backlight off
      analogWrite (redPin, 0); // Turn the red LCD backlight on
  }
  else // Otherwise
  {
     analogWrite (grnPin, 0); // Turn the green LCD backlight on
     analogWrite (redPin, 255); // turn the red LCD backlight off
  }
  delay(100); // Delay between readings
}
And here's where I got my inspiration and code snippets from:
Arduino Playground - LcdBarGraph Library
Designing an Arduino Fuel Gauge & Warning Lights
SXRguyinMA is offline  
Old 07-28-2015, 08:20 PM
  #28  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Update! I have the gauge working almost 100%. I added a snippet of code so that when the neutral light is on the gauge will read the level isntantly and when the light goes out it will real slowly (like a car).

Here's the current code:

Code:
/*
 *LCD Fuel Gauge for Honda SuperHawk 16L Tank
 *https://www.superhawkforum.com/forums/technical-discussion-28/fuel-gauge-mods-33365/
 *Basic concept found at http://www.pddnet.com/articles/2014/01/designing-arduino-fuel-gauge-warning-lights
 *Code by Will Lyon 7/26/2015. Contact: will.lyon12584@gmail.com
 *Uses the LcdBarGraph1.5 Library for Arduino. Author:  Balázs Kelemen. Contact: prampec+arduino@gmail.com
 *LCDBarGraph library can be found here: http://playground.arduino.cc/Code/LcdBarGraph#Download
 *Designed to be used with the Adafruit 16x2 RGB LCD (both negative and positive work properly)
 *5V to fuel sensor Grn/Blk
 *Fuel sensor Gry/Blk to Analog 0 with 10k resistor to GND
 *Light sensor to Analog 1 with 10k resistor to ground
*/

#include <LiquidCrystal.h> // Include Liquid Crystal library
#include <LcdBarGraph.h>   // Include LCD Bar Graph library

byte lcdNumCols = 16; // 16 columns in the 16x2 LCD
byte fuelPin = A0;    // Fuel float sensor 5V input with 10k resistor to GND and Analog 0

LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // LCD connected to digital 7-12
LcdBarGraph lbg(&lcd,16,0,1);           // Parameters for LCD bar grah library
const int redPin = 5;                   // Red LCD backlight on Digital pin 5
const int grnPin = 6;                   // Green LCD backlight on Digital pin 6

void setup() {
//  Serial.begin(9600);       // Initialize communication with PC via serial monitor
  pinMode(redPin, OUTPUT);  // Configure red LED pin as output
  pinMode(grnPin, OUTPUT);  // Configure green LED pin as output
  pinMode(fuelPin, INPUT);  // Configure the fuel level sensor pin (A0) as an input
  lcd.begin(2, lcdNumCols); // Define LCD as having 2 rows and refer to the above byte for number of columns
  lcd.clear();              // Clear the LCD display
  delay(100);
}

void loop() {
  int level = analogRead(fuelPin);       // Label sensor reading as "level"
  level = map(level, 624, 946, 0 ,1023); // Map the sensor's 624E/946F readings to 0-1023 for proper graph display
  lcd.setCursor(0, 0);                   // Set cursor to top left of display
  lcd.print("E      ||      F");         // Static full/empty readout on the LCD
  lbg.drawValue( level, 1023);           // Draw graph as fuel level reading
  if (level < 200)                       // If the mapped value is below 200 (approx. 3L fuel remaining)
  {
    analogWrite (grnPin, 255); // Turn the green LCD backlight off
    analogWrite (redPin, 0);   // Turn the red LCD backlight on
  }
  else // Otherwise
  {
    analogWrite (grnPin, 0);   // Turn the green LCD backlight on
    analogWrite (redPin, 255); // turn the red LCD backlight off
  }
  delay(100);
}
I also took some time and designed a PCB for it in Eagle. Once I get some made I'll design an enclosure for it and print it out on my 3D printer.





SXRguyinMA is offline  
Old 07-28-2015, 08:47 PM
  #29  
Senior Member
SuperBike
 
scottiemann's Avatar
 
Join Date: Feb 2007
Location: boston
Posts: 1,252
scottiemann is on a distinguished road
very nice work so far, cant wait to see the PCB done

BTW I thought you were going to use arduino code... or is arduino code that close to C
scottiemann is offline  
Old 07-28-2015, 08:53 PM
  #30  
Member
Squid
Squid
Thread Starter
 
SXRguyinMA's Avatar
 
Join Date: Jun 2015
Location: Leicester MA
Posts: 85
SXRguyinMA is on a distinguished road
Yea Arduino is basically C/C++ just super simplified. Once I sell some spare PC parts I'll double and triple check the schematic and PCB and order them up
SXRguyinMA is offline  


Quick Reply: Fuel gauge mods



All times are GMT -7. The time now is 12:55 AM.