Skip to content

Instantly share code, notes, and snippets.

@DJMarlow
Last active July 28, 2021 15:28
Show Gist options
  • Save DJMarlow/8b56c0b791cbcbb7c4312fbd56bc55f3 to your computer and use it in GitHub Desktop.
Save DJMarlow/8b56c0b791cbcbb7c4312fbd56bc55f3 to your computer and use it in GitHub Desktop.
Flite Sensor Arduino Library Documentation

FLITE ARDUINO INTEGRATION DOCUMENTATION

Flite Sensor Wiring (Looking at top of sensor)

Pinout_Grey_Background

Include the FliteSensor library

Download the FliteSensor library if you haven't already.

https://github.com/DJMarlow/Flite_Arduino

Add this to the top of your sketch:

#include <FliteSensor.h>

Create FliteSensor Object

Construct an instance of your FliteSensor:

char color[] = "BLACK";
FliteSensor fliteSensor = FliteSensor(
  color,//This is the color of the Flite sensor (BLACK, BLUE, RED, GREEN), BLACK used in this example
  201,//This is the memory location in EEPROM for the low calibration distance
  211,//This is the memory location in EEPROM for the low calibration level
  221,//This is the memory location in EEPROM for the high calibration distance
  231,//This is the memory location in EEPROM for the high calibration level
  241,//This is the memory location in EEPROM for the zero PSI offset
  251);//This is the memory location in EEPROM for the temperature offset

The color of the Flite sensor must be BLACK, BLUE, RED, or GREEN. This matches the color of the sensor enclosure. The following 5 parameters represent the memory locations on your Arduino's EEPROM. These are the locations where the calibration data is stored, so it won't be lost if your device is powered off. More information on Arduino EEPROM usage can be found at: https://www.arduino.cc/en/Reference/EEPROM

Setup Serial Console and EEPROM

Initialize your serial output to the console and your Arduino's EEPROM:

Serial.begin(115200);
EEPROM.begin(512);

Initialize Your Flite Sensor

Initializing your Flite sensor will return a bool indicating if the initialization was successful:

if(fliteSensor.beginSensor()){
  Serial.println("Successfully began FliteSensor sensor!");
} else {
  Serial.println(" Error - Unsuccessful beginning FliteSensor sensor!");
}

Calibrate Flite Sensor Level

Before your Flite sensor can provide accurate gallon level readings, it must be calibrated. Calibration requires two points, preferably close to the minimum and maximum keg levels. Call each function when the sensor is installed on a keg with the known level (gallons) passed as the parameter:

fliteSensor.calibrateLow(0.0);
fliteSensor.calibrateHigh(5.0);

Configure Temperature Offset

The temperature sensor in the lid can read a higher temperature than the liquid in the bottom of the keg. For this reason, a temperature offset can be added which is SUBTRACTED from the temperature value read, and this corrected value is displayed. With the sensor sitting at ambient pressure, call the below funtion to assign a temperature offset:

fliteSensor.setTemperatureOffset(7.5);

Zero Flite Sensor Pressure

Before your Flite sensor can provide accurate pressure readings, it must be calibrated. Flite uses an absolute pressure sensor, so any changes in elevation must be accounted for. With the sensor sitting at ambient pressure, call the below funtion to zero the pressure sensor:

fliteSensor.calibrateZeroPSI();

Read Sensor Data

The Flite sensor will return a value of floating point type when the below functions are called.

Get the current level in gallons:

float level = fliteSensor.getLevel();

Get the current temperature in degrees F:

float temperature = fliteSensor.getTemperature();

Get the current pressure in PSI:

float pressure = fliteSensor.getPressure();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment