Welcome to the North American Subaru Impreza Owners Club Sunday July 22, 2018
Home Forums WikiNASIOC Products Store Modifications Upgrade Garage
NASIOC
Go Back   NASIOC > NASIOC Technical > Engine Management & Tuning

Welcome to NASIOC - The world's largest online community for Subaru enthusiasts!
Welcome to the NASIOC.com Subaru forum.

You are currently viewing our forum as a guest, which gives you limited access to view most discussions and access our other features. By joining our community, free of charge, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is free, fast and simple, so please join our community today!

If you have any problems with the registration process or your account login, please contact us.
* Registered users of the site do not see these ads. 
Reply
 
Thread Tools Display Modes
Old 06-14-2018, 10:39 AM   #176
Sti831
Scooby Newbie
 
Member#: 403592
Join Date: Oct 2014
Default

Bump... anyone try making a DIY pressure sensor also? Lol
* Registered users of the site do not see these ads.
Sti831 is offline   Reply With Quote
Sponsored Links
* Registered users of the site do not see these ads.
Old 06-24-2018, 03:32 PM   #177
brecks
Scooby Newbie
 
Member#: 435142
Join Date: Nov 2015
Chapter/Region: MWSOC
Location: Commerce Twp, MI
Vehicle:
2004 STi
Java Black Pearl

Default

I finally got around to giving this a go. I kept my rear O2 in place, so I made a pigtail for it, using the left TGV for the signal, and the same ethanol sensor posted by the OP. My voltages are as follows:
Battery voltage with the key on: 11.9v (low, I know its been a while lol)
Board power/gnd (where the 8v reg is): 11.7v
The 8v regulator (and/vin): 7.9v
Board 5v: 5.0v (score!)
Signal from E sensor at board: 4.2v
Power at E sensor: 11.7v
TGV signal wire: 0v

I think I may have used the wrong pin from the TGV, and that is why my values are incorrect. My TGV voltage on my AP was reading 0.00 with the car running (no surprise considering the measured voltages at the pins). If someone could confirm for me the signal pin for the TGVs in the 04-07 STi I'd appreciate it!

P.S. I'm using Barge's code, but I don't think this is a coding issue


EDIT: For anyone else having this issue, the signal wire is the yellow/red wire on the 04-07 STi, my TGV voltage is now reading 0.9v, which seems about right for pump 93 (~10% corn)

Last edited by brecks; 06-24-2018 at 04:05 PM.
brecks is offline   Reply With Quote
Old 07-09-2018, 11:57 AM   #178
NickInMN
Scooby Newbie
 
Member#: 488121
Join Date: Jul 2018
Default

I came up with my own version of this, using this thread as well as a few others for inspiration. I did things slightly differently. I used an Arduino Beetle, a .96 inch LCD and a 5 volt regulator instead to power the Beetle since it doesn't have any voltage protection. I also used interrupts vs pulseIn for the measurements. In the display I have the top line showing ethanol percent and the bottom line showing temp in a bit smaller font.




Code:
Code:
#define EI_ARDUINO_INTERRUPTED_PIN

#include <EnableInterrupt.h>
#include <GOFi2cOLED.h>
GOFi2cOLED LCD;

#define SENSOR_PIN 10
#define OUTPUT_PIN 9

volatile unsigned long previousTime = 0;
volatile unsigned long highTime = 0;
volatile unsigned long lowTime = 0;

void stateChanged()
{
	unsigned long currentTime = micros();
	// high -> low
	if (arduinoPinState == 0) {
		highTime = currentTime - previousTime;
	}
	else { // low -> high
		lowTime = currentTime - previousTime;
	}

	previousTime = currentTime;
}

void setup()
{
	LCD.init(0x3C);
	LCD.setTextWrap(false);
	LCD.clearDisplay();
	LCD.setTextSize(2);
	LCD.println("Ethanol");
	LCD.println("Analyzer");
	LCD.display();
	delay(2000);

	pinMode(SENSOR_PIN, INPUT);
	enableInterrupt(SENSOR_PIN, stateChanged, CHANGE);
	
	// Setup for analog out, pin 9 to fast mode.
	pinMode(OUTPUT_PIN, OUTPUT);
	TCCR1B = TCCR1B & 0b11111000 | 0x01;
}

void loop()
{
	unsigned long pulsetime = highTime + lowTime;

	// 20000 uS = 50 HZ - ~6667 uS = 150 HZ
	if (pulsetime > 200000 || pulsetime < 6667) {
		// If the value falls outside the range just skip it for this iteration.
		return;
	}

	LCD.clearDisplay();
	LCD.setCursor(0, 0);
	
	// 50 HZ = 0% ethanol, 150 HZ = 100% ethanol
	long eContent = int((1000000 / pulsetime) - 50);
	
	// These should never hit due to the check above.
	if (eContent < 0) {
		eContent = 0;
	}
	else if (eContent > 100) {
		eContent = 100;
	}

	// 1 millisecond = -40C, 5 milliseconds = 125C
	float frequency = float(1000000 / pulsetime);
	float dutyCycle = 100 * (highTime / float(lowTime + highTime));
	float totalTime = float(1.0 / frequency);
	float period = float(100 - dutyCycle) * totalTime;
	int temperature = 40.25 * 10 * period - 81.25;
	int temperatureF = temperature * 1.8 + 32;

	// Analog out, 0 volts = 0%, 5 volts = 100%
	float desiredVoltage = mapf(eContent, 0, 100, 0, 5);
	int analogOut = 255 * (desiredVoltage / 5);
	analogWrite(OUTPUT_PIN, int(analogOut));
	
	LCD.setTextSize(4);
	LCD.print("E:");
	LCD.print(eContent);
	LCD.println("%");
	LCD.setTextSize(1);
	LCD.println("");
	LCD.setTextSize(2);
	LCD.print("Temp:");
	LCD.print(temperatureF);
	LCD.print((char)247);
	LCD.println("F");
	LCD.display();
	delay(1000);
}

double mapf(double x, double in_min, double in_max, double out_min, double out_max)
{
	return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Last edited by NickInMN; 07-09-2018 at 10:47 PM.
NickInMN is offline   Reply With Quote
Old 07-11-2018, 08:06 PM   #179
salvi
Scooby Specialist
 
Member#: 188132
Join Date: Aug 2008
Default

Best location for the E85 sensor...on the return line.

salvi is offline   Reply With Quote
Old 07-20-2018, 08:49 AM   #180
pearson222
Scooby Newbie
 
Member#: 393782
Join Date: Jun 2014
Chapter/Region: MWSOC
Location: Saint Paul, MN
Vehicle:
2004 WRX EWG E85
2006 RPW STi

Default

I am experiencing an issue with my sensor voltage dropping to 0 during startup. I am in the process of switching over to Accessport from OS and it is causing the eth content to be locked at 10% during the voltage drop @ start. Any ideas on what can be done?

Datalog of condition - https://datazap.me/u/pearson222/log-...data=4-8-16-17
pearson222 is offline   Reply With Quote
Old 07-20-2018, 03:36 PM   #181
brecks
Scooby Newbie
 
Member#: 435142
Join Date: Nov 2015
Chapter/Region: MWSOC
Location: Commerce Twp, MI
Vehicle:
2004 STi
Java Black Pearl

Default

Quote:
Originally Posted by pearson222 View Post
I am experiencing an issue with my sensor voltage dropping to 0 during startup. I am in the process of switching over to Accessport from OS and it is causing the eth content to be locked at 10% during the voltage drop @ start. Any ideas on what can be done?

Datalog of condition - https://datazap.me/u/pearson222/log-...data=4-8-16-17
How is it all wired up? Could just be a simple power issue. Have you tested voltages at the board with the car running? Made sure pinouts of plugs are correct? That's where I'd start.

Since all of this is custom, and varies person to person, its a hard issue to diagnose.
brecks is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -4. The time now is 03:25 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Powered by Searchlight © 2018 Axivo Inc.
Copyright ©1999 - 2017, North American Subaru Impreza Owners Club, Inc.