TheSalkku3.0 – News for 2016 season

Since winters are pretty long and dark here in Finland there’s plenty of time to do some more or less useful things. This time it got to be useful :)

Fuel gauge to monitor generator’s fuel level

Since we have very few fields with electricity here in Finland practically all of us have an generator to charge on the field. That is surely one thing I always forget, to refuel before it shuts down. So. Something had to be done for that issue.

After some studying what could be done I ordered a fuel-sensor, some arduino-stuff and now I have an generator with WiFi.

The sensor can be seen next to filling-cap and the WiFi-antenna on the background. The generator of choise, Kipor IG2000 conveniently has also an 12VDC output so just a 7805 is needed to get the adruino and HLK RM04 cards to work. The sensor is 12V model. (Actually 10-30V.)

Agre

Idea is pretty simple, since the F330 fuel sensor was ordered as 0-5V model arduino mini reads the value and outputs it as serial data to HLK RM04 serial-to-wifi card everytime the www-interface in HLK RM04 get’s a read, so there really is no www-server involved, practically it’s the arduino acting as a server. Wifi card is connected to the wireless network TheSalkku3.0 already has. After that the software reads the value and makes a real-time gauge in to bottom of the interface.

The arduino-code is easy:

// Arduino sketch created by Tero Salminen 2016
// For F330 Fuel Sensor with 0-5V configuration
//
// Based on Nikos Georgousis Wireless_Temp from
// http://www.instructables.com/id/Arduino-WiFi-Temperature-Meter-with-web-page/

float analogVal;
float fuel;
float referenceVoltage;
void setup() {                
  Serial.begin(57600);
  analogReference(INTERNAL);
  referenceVoltage = 5.00;
}

void loop() {
  boolean has_request = false;
  if (Serial.available()) {
    while(Serial.available()) {
      char c = Serial.read();
    }
    has_request = true;
  }
  if (has_request) {
    Serial.println("HTTP/1.1 200 OK");
    Serial.println("Content-Type: text/html");
    Serial.println("Connection: close");
    Serial.println("Refresh: 5");
    
    String //sr = "\n";
    sr = "";
    analogVal=0;
    fuel=0;
    int analogChannel = 3;
    for(int i = 0; i < 25; i++) {
	    analogVal += analogRead(analogChannel);
      delay(2);
      }
    fuel = analogVal/25;
    fuel = (fuel * 100) / 1023;
    sr += fuel;
    Serial.print("Content-Length: ");
    Serial.print(sr.length());
    Serial.print("\r\n\r\n");
    Serial.print(sr);
    Serial.println(fuel, 0);
    Serial.print("");
    has_request = false;
  }
}

The result is a webpage with just the value of fuel level in 0-100 without any formatting. That value is then read by the software in TheSalkku3.0 and the gauge is generated to the bottom of the interface:

home_2016_2

Since the generator is not running all the time I wanted it to be seen that it is offline so I made the fuel-pump picture gray when generator is offline.

home_2016

Now I just need an audio to shout “Fuel up you moron!” when fuel-level drops too low :)

TheSalkku3.0

The complete features of my charger-case is readable on it’s own page here, the hardware has an own page found here.

5 thoughts on “TheSalkku3.0 – News for 2016 season

    1. Yes, it's this one: http://www.alibaba.com/product-detail/F330-capacitive-fuel-level-sensor-for_1901899797.html

      You need to contact them and ask for price, remember to mention that you need 0-5V version, calibrator and a model that you can cut to lenght. (Some materials cannot be cut by end-user)

  1. Hi there,
    I am a fan of DIY projects. I have a i4010 and i308 charger; I would like to monitor their function using bluetooth or wifi network to my android celular. Is it possible?

    Thanks,
    Rick

  2. I got to this site by accident! I am impressed with what you accomplished! I have a 308 duo charger so my obvious question is if your system would ruin on windows and if so, fo you perhaps sell your software.
    Regards
    Christo
    Cape Town
    South Africa

    1. In theory yes, in practice no. It's really ugly code and a mess of different languages used.

Leave a Reply

Your email address will not be published. Required fields are marked *