Welcome to the SR20 Community Forum - The Dash.
Register
SR20 forum logo

Thread: Flex-fuel sensor output

+ Reply To Thread
Posts: 21-30 of 72
2015-03-19 07:44:43
#21
I found a way to get the LCD KeyPad to cooperate with my program. Sadly, it involves modifying a pin on the LCD (relocating RS data pin 8->3). I will post the program and some pics on what to modify soon.
2015-03-20 01:36:08
#22
Originally Posted by Dala
I found a way to get the LCD KeyPad to cooperate with my program. Sadly, it involves modifying a pin on the LCD (relocating RS data pin 8->3). I will post the program and some pics on what to modify soon.


Be interesting to know what a full cost would be for this setup
If its less the the Zeitronixs unit you could be onto a winner
I'd be interested...
2015-03-20 01:54:59
#23
The flex fuel sensor its self is roughly $50
The connector is roughly $5
The airduno with lcd is roughly $15
The wire to hook everything up should be about $5

so unless you are running an fittings you are looking at about $75
2015-03-20 08:36:17
#24
Actually, I didn't use the GM connector harness, I just crimped some spade connectors and attached them to the fuel sensor. For wiring, I used some leftover wire from a door lock install.

If you are cheap like me you can do everything for 50$+15$ = 65$

Tonight I will resolder the LCD and continue testing.
2015-03-20 15:57:00
#25
Originally Posted by Dala
I found a way to get the LCD KeyPad to cooperate with my program. Sadly, it involves modifying a pin on the LCD (relocating RS data pin 8->3). I will post the program and some pics on what to modify soon.



I was thinking the same thing! Can't wait to see your finished code, It's looking awesome!
2015-03-20 20:24:47
#26
It's working perfectly (with 498Hz test input)!

To use the LCD Keypad shield, this modification is needed


Here's the code
/*******************************************************
This program will sample a 50-150hz signal depending on ethanol
content, and output a 0-5V signal via PWM.

Connect PWM output to NEMU Breakoutboard on ADC0-3, and tune
the "FLEX FUEL SETUP" tab accordingly. NOTE: Lowpass filter to
be used on output.

Input pin 8 (PB0) ICP1 on Atmega328
Output pin 3 PWM

If LCD Keypad shield is used, solder jumper from Pin 8 - Pin 2,
and snip leg from pin 8 http://i.imgur.com/KdlLmye.png
********************************************************/

// include the library code:
#include //LCD plugin

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2, 9, 4, 5, 6, 7); //LCD Keypad Shield

int inpPin = 8; //define input pin to 8
int outPin = 11; //define PWM output, possible pins with LCD are 3, 10 and 11 (UNO)
//int outPin2 = 3; //temporary PWM, for simulating 489HZ

//Define global variables
volatile uint16_t revTick; //Ticks per revolution
uint16_t pwm_output = 0; //integer for storing PWM value (0-255 value)
int HZ = 0; //unsigned 16bit integer for storing HZ input
int ethanol = 0; //Store ethanol percentage here
uint16_t voltage = 0; //store display millivoltage here (0-5000)

void setupTimer() // setup timer1
{
TCCR1A = 0; // normal mode
TCCR1B = 132; // (10000100) Falling edge trigger, Timer = CPU Clock/256, noise cancellation on
TCCR1C = 0; // normal mode
TIMSK1 = 33; // (00100001) Input capture and overflow interupts enabled

TCNT1 = 0; // start from 0
}

ISR(TIMER1_CAPT_vect) // PULSE DETECTED! (interrupt automatically triggered, not called by main program)
{
revTick = ICR1; // save duration of last revolution
TCNT1 = 0; // restart timer for next revolution
}

ISR(TIMER1_OVF_vect) // counter overflow/timeout
{ revTick = 0; } // Ticks per second = 0


void setup()
{
setupTimer();
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Initial screen formatting
lcd.setCursor(0, 0);
lcd.print("Ethanol: %");
lcd.setCursor(0, 1);
lcd.print(" Hz mV");
}

void loop()
{
if (revTick > 0) // Avoid dividing by zero, sample in the HZ
{HZ = 62200 / revTick;} // 3456000ticks per minute, 57600 per second
else // 62200 per seconmd seems to be more accurate?
{HZ = 0;} //needs real sensor test to determine correct tickrate

//calculate ethanol percentage
if (HZ > 50) // Avoid dividing by zero
{ethanol = HZ-50;}
else
{ethanol = 0;}

if (ethanol > 100) // Avoid overflow in PWM
{ethanol = 100;}

//Screen calculations
pwm_output = 255 * (ethanol*0.01); //calculate output PWM for NEMU
voltage = ethanol*50; //calculate voltage (mV) for display

lcd.setCursor(10, 0);
lcd.print(ethanol);

lcd.setCursor(1, 1);
lcd.print(HZ);

lcd.setCursor(8, 1);
lcd.print(voltage);

//PWM output
analogWrite(outPin, pwm_output); //write the PWM value to output pin
//analogWrite(outPin2, 40); //489.9Hz test output

delay(100); //make screen more easily readable by not updating it too often

}


Known Issues:
-If no sensor is connected, the display can go haywire. I will look into this.
-Tickrate for HZ sample might need calibrating for 16Mhz CPU, I will know once I get it on my car.

Well, it could be done!
Last edited by Dala on 2015-03-24 at 19-30-59. Reason: Changed wiring layout to correct one!
2015-03-20 20:34:33
#27
You da man! I'll let you know results as soon as I get my engine in the car
2015-03-21 18:28:45
#28
Tested it on my car today, doublechecked the calibration with a multimeter, was within 0.7Hz accurate! Seems good enough to me!

2015-03-22 15:42:43
#29
i have 2 questions.

1. is there a sensor that operates on the 0-5v range, so there is not converter needed?

2. ultimatly i want a small lcd screen no more that 2" wide, mounted in the gauge cluster that displays the %of ethanol. whats out there?
2015-03-23 09:32:12
#30
Originally Posted by turbotank

1. is there a sensor that operates on the 0-5v range, so there is not converter needed?


I haven't seen any direct 0-5V sensors on ebay.. The reason the sensors output 50-150hz, is so that they can cram fuel temperature into the same signal. The frequency outputs ethanol content, the duration outputs temperature. This means that the arduino application could be further developed and display fuel temperature.


2. ultimatly i want a small lcd screen no more that 2" wide, mounted in the gauge cluster that displays the %of ethanol. whats out there?


You can get a barebone 2-digit display and mount it in the cluster. Then wire it up to an arduino. That would make a clean install for sure, and cost next to nothing (2$ display, 7$ arduino)
+ Reply To Thread
  • [Type to search users.]
  • Quick Reply
    Thread Information
    There are currently ? users browsing this thread. (? members & ? guests)
    StubUserName

    Back to top