Welcome to the North American Subaru Impreza Owners Club Friday March 29, 2024
Home Forums Images 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.







* As an Amazon Associate I earn from qualifying purchases. 
* Registered users of the site do not see these ads. 
Reply
 
Thread Tools Display Modes
Old 11-21-2022, 02:01 AM   #376
Shune
Scooby Newbie
 
Member#: 532211
Join Date: Nov 2022
Default

How do I log my ethanol content with cobb sensor and romraider
* Registered users of the site do not see these ads.
Shune is offline   Reply With Quote
Sponsored Links
* Registered users of the site do not see these ads.
Old 11-28-2022, 10:17 AM   #377
iceman.kcmo
Scooby Newbie
 
Member#: 264683
Join Date: Nov 2010
Default

Quote:
Originally Posted by Shune View Post
How do I log my ethanol content with cobb sensor and romraider
What tuning solution are you using? I am using Carberry open source found on romraider forums. Not sure how if you are using something like Cobb.
iceman.kcmo is offline   Reply With Quote
Old 11-28-2022, 11:46 AM   #378
benflynn
Scooby Specialist
 
Member#: 515308
Join Date: Jun 2020
Default

If you have a rom that will see the flex sensor, or you can log the input it’s hooked to, tgv, MAF or rear o2. Cobb sensor is same as all the other converter solutions.
benflynn is offline   Reply With Quote
Old 02-13-2023, 09:05 PM   #379
Mech314
Scooby Newbie
 
Member#: 526430
Join Date: Sep 2021
Default

Hey guys, excellent manual! I already ordered all the parts to assembly my own sensor with the display.

I have a quick question, I'm on Dimemod so my ROM should be able to detect the signal. So my question is rather simple, should I delete TGVs to be able to send the signal to TGV pin and not mess up TGV work logic?
Mech314 is offline   Reply With Quote
Old 02-13-2023, 09:05 PM   #380
Mech314
Scooby Newbie
 
Member#: 526430
Join Date: Sep 2021
Default

Hey guys, excellent manual! I already ordered all the parts to assembly my own sensor with the display.

I have a quick question, I'm on Dimemod so my ROM should be able to detect the signal. So my question is rather simple, should I delete TGVs to be able to send the signal to TGV pin and not mess up TGV work logic?
Mech314 is offline   Reply With Quote
Old 02-19-2023, 01:43 AM   #381
dankcincy
Scooby Newbie
 
Member#: 472574
Join Date: Aug 2017
Default Code

I know nothing about code but for the fun of it, I plugged the code from the first page into ChatGPT and asked it to optimize it.
This was the result.
Anyone that knows code want to have a look at it and let us know what you think?

// include the library code:
#include <LiquidCrystal.h> //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 and 32khz freq. are 3 and 11 (Nano and Uno)

//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; //unsigned 16bit integer for storing HZ input
int ethanol = 0; //Store ethanol percentage here
float expectedv; //store expected voltage here - range for typical GM sensors is usually 0.5-4.5v

int duty; //Duty cycle (0.0-100.0)
float period; //Store period time here (eg.0.0025 s)
float temperature = 0; //Store fuel temperature here
int fahr = 0;
int cels = 0;
static long highTime = 0;
static long lowTime = 0;
static long tempPulse;

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()
{
Serial.begin(9600);
pinMode(inpPin,INPUT);
setPwmFrequency(outPin,1); //Modify frequency on PWM output
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 C");
}

void loop()
{
getfueltemp(inpPin); //read fuel temp from input duty cycle

if (revTick > 0) // Avoid dividing by zero, sample in the HZ
{HZ = 62200 / revTick;} // 3456000ticks per minute, 57600 per second
else
{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 > 99) // Avoid overflow in PWM
{ethanol = 99;}

expectedv = ((((HZ-50.0)*0.01)*4)+0.5);
//Screen calculations
pwm_output = 1.1 * (255 * (expectedv/5.0)); //calculate output PWM for ECU

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

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

lcd.setCursor(8, 1);
lcd.print(temperature); //Use this for celsius

//PWM output
analogWrite(outPin, pwm_output); //write the PWM value to output pin

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

Serial.println(ethanol);
Serial.println(pwm_output);
Serial.println(expectedv);
Serial.println(HZ);
delay(1000);


}

void getfueltemp(int inpPin){ //read fuel temp from input duty cycle
highTime = 0;
lowTime = 0;

tempPulse = pulseIn(inpPin,HIGH);
if(tempPulse>highTime){
highTime = tempPulse;
}

tempPulse = pulseIn(inpPin,LOW);
if(tempPulse>lowTime){
lowTime = tempPulse;
}

duty = ((100*(highTime/(double (lowTime+highTime))))); //Calculate duty cycle (integer extra decimal)
float T = (float(1.0/float(HZ))); //Calculate total period time
float period = float(100-duty)*T; //Calculate the active period time (100-duty)*T
float temp2 = float(10) * float(period); //Convert ms to whole number
temperature = ((40.25 * temp2)-81.25); //Calculate temperature for display (1ms = -40, 5ms = 80)
int cels = int(temperature);
cels = cels*0.1;
float fahrtemp = ((temperature*1.8)+32);
fahr = fahrtemp*0.1;

}

void setPwmFrequency(int pin, int divisor) { //This code snippet raises the timers linked to the PWM outputs
byte mode; //This way the PWM frequency can be raised or lowered. Prescaler of 1 sets PWM output to 32KHz (pin 3, 11)
if(pin == 5 || pin == 6 || pin == 9 || pin == 10) {
switch(divisor) {
case 1: mode = 0x01; break;
case 8: mode = 0x02; break;
case 64: mode = 0x03; break;
case 256: mode = 0x04; break;
case 1024: mode = 0x05; break;
default: return;
}
if(pin == 5 || pin == 6) {
TCCR0B = TCCR0B & 0b11111000 | mode;
} else {
TCCR1B = TCCR1B & 0b11111000 | mode;
}
} else if(pin == 3 || pin == 11) {
switch(divisor) {
case 1: mode = 0x01; break;
case 8: mode = 0x02; break;
case 32: mode = 0x03; break;
case 64: mode = 0x04; break;
case 128: mode = 0x05; break;
case 256: mode = 0x06; break;
case 1024: mode = 0x7; break;
default: return;
}
TCCR2B = TCCR2B & 0b11111000 | mode;
}
}

Last edited by dankcincy; 02-19-2023 at 01:47 AM. Reason: Added context
dankcincy is offline   Reply With Quote
Old 02-21-2023, 11:12 PM   #382
kopele
Scooby Newbie
 
Member#: 363007
Join Date: Jul 2013
Chapter/Region: MWSOC
Location: MO
Vehicle:
2008 STI
Black

Default

Nothing really changed, just removed indentation and white spacing, and messed up the screen printout.
kopele is offline   Reply With Quote
Old 08-15-2023, 08:42 PM   #383
ijn ducky
Scooby Newbie
 
Member#: 486207
Join Date: May 2018
Chapter/Region: MWSOC
Location: Lithopolis, OH
Vehicle:
2005 Impreza WRX
Silver

Default

Quote:
Originally Posted by porkchop View Post
Thanks for the help!

after digging around some more, it seems that the accessport for 16bit ecu might not have the code/option to enable flex fuel, so the work around is to use the input from the rear o2.

You'll likely never come back, but did you get this working? I want to get mine going on a 2005 WRX, which previous research says it doesn't work at all. Now I see it might?
ijn ducky 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 02:08 AM.


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

As an Amazon Associate I earn from qualifying purchases.

When you click on links to various merchants on this site and make a purchase, this can result in this site earning a commission
Affiliate programs and affiliations include, but are not limited to, the eBay Partner Network.