Part1:Introduction:Digital LPG Fuel Meter with radius of action counter in KM

Introduction

My car has a bi-fuel system. This means I can drive on regular Euro95 Benzine and LPG gas.
To toggle between these different fuel types there is a switchbox.
This (Necam) switchbox has 4 leds to indicate the fuel level of the LPG.
Because of the poor indication I would like to get a better view how much is left in the fuel tank and how far I can drive with it.


To get a better view I would like to present this information on a LCD.
The 4 leds or the signal which controls these leds are gonna be used for a 0-100% scale.
I use a math formula to calculate the distance how far I can drive based on the scale and the total radius of action.

Because this LCD must be small and I don't have many characters to display I choose for a 2x8 LCD. This LCD is based on the HD44780 controller and has 2 lines with 8 characters each.


I want to use the Arduino/Atmega328 to calculate the output of the switchbox and drive the LCD.
With the little test code you can see how it looks (animation) on the LCD.

// include the library
#include <LiquidCrystal.h>
int i;
unsigned int KM = 4.2; //How much KM I can you drive on a full tank divided by 100
// initialize the interface pins
LiquidCrystal lcd(4,5,6,7,8,9 ); // digital pins which are used by the LCD


void setup()
{
  // sets the LCD's rows and colums:
  lcd.begin(16, 2);lcd.clear();delay(500);
}


void loop(){
//{lcd.setCursor(0,0);lcd.print("LPG CHK");delay(2000);lcd.clear();delay(1000);
for (int i=100 ; i>=1 ; i--) {lcd.setCursor(0,0);lcd.print("LPG ");lcd.print(i);lcd.print("% ");


lcd.setCursor(0,1); lcd.print("+/-");lcd.print(i*KM); lcd.print("KM");delay(1300);
}
}

The video below gives you an example of the above script. This is just a test with a different LCD.


Geen opmerkingen:

Een reactie posten