DIY e85 sensor display
Last edited by aknovaman; Dec 18, 2021 at 09:50 AM.
Code:
#include <Adafruit_ST7735.h> // Hardware-specific library
#define cs 10
#define dc 9
#define rst 8
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst);
const int pulsePin = 7; // Input signal connected to Pin 8 of Arduino
int pulseHigh; // Integer variable to capture High time of the incoming pulse
int pulseLow; // Integer variable to capture Low time of the incoming pulse
float pulseTotal; // Float variable to capture Total time of the incoming pulse
float frequency; // Calculated Frequency
void setup()
{
pinMode(pulsePin, INPUT);
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST7735_BLACK);
tft.setRotation(1); // rotate 90 degrees
tft.setCursor(5, 0);
tft.setTextColor(CYAN);
tft.setTextSize(3);
tft.print("E85%:");
tft.setCursor(5, 70);
tft.setTextColor(MAGENTA);
// tft.setTextSize(2);
tft.print("Temp:");
}
void loop()
{
pulseHigh = pulseIn(pulsePin, HIGH);
pulseLow = pulseIn(pulsePin, LOW);
pulseTotal = pulseHigh + pulseLow; // Time period of the pulse in microseconds
frequency = 1000000 / pulseTotal; // Frequency in Hertz (Hz)
tft.setCursor(10, 25);
tft.setTextColor(YELLOW, BLACK);
tft.setTextSize(5);
tft.print(frequency - 51.1, 1);
tft.setCursor(5, 100);
tft.setTextColor(GREEN, BLACK);
tft.setTextSize(2);
// tft.print((((pulseLow) / 1000) * 40.25) - 81.25); //display fuel temp in C
tft.println((pulseLow / 1000 * 74.25) - 114.25,1); //display fuel temp in F
}
Last edited by aknovaman; Dec 23, 2021 at 08:37 PM.
I ended up selling my arduino powered engine dyno, fuel injector flow bench, and wideband AFR visual grapher (for carbed engines) last year when my youngest was born.
Good work though, this is really some quality stuff.







