close-circle
Close
0%
0%

Honda Superhawk fuel gauge

LCD graph fuel gauge retrofit

Similar projects worth following
My 98 Superhawk came with just a low fuel warning LED which as I found out does not work. The 2001-up hawks came with an actual fuel level gauge. I got one of the float sensors from a newer hawk and designed my own fuel gauge on a tri-color (5 green, 3 yellow and 2 red) LED bar graph. The code allows the gauge to read isntantly and also adds smoothing and averaging so the display isn't going bonkers as the float is bouncing when you're going down the road. It will all end up on a custom PCB in a 3D printed enclosure.

I originally planned on using a 16x2 RGB LCD but due to size and lack of placement options I decided on a smaller 10-segment LED bar graph instead.

My 1998 Honda Super Hawk (VTR1000F) came with just a low fuel LED indicator that didn't work. In 2001 Honda added a real guage to the bike. I picked up an 01 float gauge from eBay as well as 10-segment tricolor (5 green, 3 yellow and 2 red) LED bar graph. I added functionality to use the OEM low fuel LED as well.

  • 1 × 10-Segment Tri-Color LED bar graph
  • 11 × 220 Ohm resistor Pulldown for float gauge
  • 2 × 10k Ohm resistor
  • 1 × Honda fuel gauge P/N 37080-MBB-A20
  • 1 × 5mm LED For LCD contrast

View all 7 components

  • 1
    Step 1

    Arduino D2-D11 to lins 1-10 on the LED bar graph. 220 ohm resistors from opposite side of graph to ground.

    Fuel level sender Grn/Blk to 5V and Gry/Blk to Analog 0 with 10k to GND

    Low fuel LED to Digital 12 with 220 ohm resistor

  • 2
    Step 2
    /*
    *LED Fuel Gauge for Honda SuperHawk 16L Tank
    *http://www.superhawkforum.com
    *Code by Will Lyon 10/3/2015. Contact: will.lyon12584@gmail.com
    *Help from user Doug Jefferies on the Element 14 Forums
    *5V to fuel sensor Grn/Blk
    *Fuel sensor Gry/Blk to Analog 0 with 10k resistor to GND
    *220 ohm resistor to each led and GND
    */
    
    const int sensorPin = A0;       // the pin that the potentiometer is attached to
    const int ledCount = 10;        // the number of LEDs in the bar graph
    const int numReadings = 35;     // use this value to determine the size of the readings array
    const int fuelPin = 12;         // pin for factory low fuel LED
    
    int ledPins[] = {
      2, 3, 4, 5, 6, 7,8,9,10,11 }; // an array of pin numbers to which LEDs are attached
    int readings[numReadings];      // the readings from the fuel level gauge
    int readIndex = 0;              // the index of the current reading
    int total = 0;                  // the running total
    int average = 0;                // the average
    int averagingCount = 0;         // checks the number of values in the Index
    int timer = 75;                 // timer for inital LED sweep
    int pinCount = 10;              // number of LED pins
    
    void setup() {
      Serial.begin(9600);
      pinMode(fuelPin, OUTPUT);
      digitalWrite(fuelPin, LOW);
      for (int thisLed = 0; thisLed < ledCount; thisLed++) {      // loop over the pin array and set them all to output
        pinMode(ledPins[thisLed], OUTPUT);
      }
      for (int thisReading = 0; thisReading < numReadings;        // initialize all readings to zero
      thisReading++) {
      readings[thisReading] = 0;
      }
      for (int thisPin = 0; thisPin < pinCount; thisPin++) {      // loop from the lowest pin to the highest
        digitalWrite(ledPins[thisPin], HIGH);                     // turn the pin on
        delay(timer);                                             // delay for time set bove
        digitalWrite(ledPins[thisPin], LOW);                      // turn the pin off
      }
      for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) { // loop from the highest pin to the lowest
        digitalWrite(ledPins[thisPin], HIGH);                     // turn the pin on
        delay(timer);                                             // delay for time set above
        digitalWrite(ledPins[thisPin], LOW);                      // turn the pin off
      }
    }
    
    void loop() {
      total = total - readings[readIndex];                    // subtract the last reading
      readings[readIndex] = analogRead(sensorPin);            // read from the sensor
      total = total + readings[readIndex];                    // add the reading to the total
      readIndex = readIndex + 1;                              // advance to the next position in the array
      if (readIndex >= numReadings) {                         // if we're at the end of the array
        readIndex = 0;                                        // wrap around to the beginning
      }
      averagingCount = averagingCount + 1;                    // increments the count for averaging
      if (averagingCount >= numReadings) {                    // caps the averaging count to the array
        averagingCount = numReadings;                           
      }
      average = total / averagingCount;                       // calculate the average
      delay(3000);                                            // delay in between readings so the gauge doesn't fluctuate too fast
      average = map(average, 585, 940, 0, ledCount);          // map the result to a range from 0 to the number of LEDs:
      for (int thisLed = 0; thisLed < ledCount; thisLed++) {  // loop over the LED array
        if (thisLed == average-1) {                           // if the array element's index is less than ledLevel
          digitalWrite(ledPins[thisLed], HIGH);               // turn the pin for this element on:
        }
        else {
          digitalWrite(ledPins[thisLed], LOW);                // turn off all pins higher than the ledLevel:
        }
      }
      if (average <= 2) {                                     // if either of the last two LED's on the display are lit
        digitalWrite(fuelPin, HIGH);                          // turn on the low fuel LED
      }
      else {
        digitalWrite(fuelPin, LOW);                           // turn the low fuel LED off
      }
      Serial.println(analogRead(sensorPin));
      delay(100);
    }

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates