Low Fuel Light II - Lowduino

This circuit differs from the original in the number of inputs and outputs - this has six main inputs / outputs, as shown below:

The sender receives 5V rather than 12V, as the Arduino will only read 0-5V on it’s analog input.

The circuit itself (click for full size):

The Eagle schematic file is here: ArduinoFuel9d.sch.

The PCB layout (click for full size):

The blue tracks are the bottom side of the board, and the red tracks are wire links on the top side of the board.

The Eagle PCB file is here: ArduinoFuel9d.brd

A bill of materials for the circuit is here: Lowduino BOM.pdf 

Here's the code that the Arduino runs. - UPDATED to V10.1, due to issues with erroneous values when the tank is 'brimmed'.

Things to note about the code:

  • The tank map - senderMap - has been measured using my tank. It may work with another sportster tank, but as they're all slightly different, you may want to measure your tank and calculate your own map. You can do this by using this spreadsheet. Just follow the instructions in it, and it'll do the rest. Here's a snippet of code that you can run on your arduino to capture the analog values as seen by it for any given level of fuel. 
  • The gauge map  - gaugeMap - has been measured using my gauge. As with the tank, you'll probably want to create your own for your gauge. Follow the instructions in this spreadsheet and it'll calaculate one for you.
  • The lamp threshold values (fuelThresholdLow, fuelThresholdInt) can be changed to whatever you want, within a percentage range - so if you want the yellow warning at 50%, change it to 50 etc.
  • The amount of averaging is set by numReadings. As the code stands, you'll get a 50 point moving average. If you want more (or less), change the value it's set to.
  • The frequency of tank readings is handled by taTakeSample. The interval is measured in milliseconds, so it's current value of 1000 equals one tank reading per second
  • The frequency of gauge and lamp updates is handled by taGaugeDisplay. Again, the interval is measured in milliseconds, so it's current value of 5000 equals one gauge update every 5 seconds.
  • You will also need to go to the Arduino site and download the TimedAction .h files to include in the project.

The code can be uploaded to the Arduino using the Arduino IDE.