|
|
|
|
Thread Tools | Display Modes |
11-21-2022, 02:01 AM | #376 |
Scooby Newbie
Member#: 532211
Join Date: Nov 2022
|
How do I log my ethanol content with cobb sensor and romraider
* Registered users of the site do not see these ads.
|
11-28-2022, 10:17 AM | #377 |
Scooby Newbie
Member#: 264683
Join Date: Nov 2010
|
|
11-28-2022, 11:46 AM | #378 |
Scooby Specialist
Member#: 515308
Join Date: Jun 2020
|
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.
|
02-13-2023, 09:05 PM | #379 |
Scooby Newbie
Member#: 526430
Join Date: Sep 2021
|
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? |
02-13-2023, 09:05 PM | #380 |
Scooby Newbie
Member#: 526430
Join Date: Sep 2021
|
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? |
02-19-2023, 01:43 AM | #381 |
Scooby Newbie
Member#: 472574
Join Date: Aug 2017
|
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 |
02-21-2023, 11:12 PM | #382 |
Scooby Newbie
Member#: 363007
Join Date: Jul 2013
Chapter/Region:
MWSOC
Location: MO
Vehicle:2008 STI Black |
Nothing really changed, just removed indentation and white spacing, and messed up the screen printout.
|
08-15-2023, 08:42 PM | #383 | |
Scooby Newbie
Member#: 486207
Join Date: May 2018
Chapter/Region:
MWSOC
Location: Lithopolis, OH
Vehicle:2005 Impreza WRX Silver |
Quote:
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? |
|
Thread Tools | |
Display Modes | |
|
|