|
RomRaider
Documentation
Community
Developers
|
|
Page 1 of 1
|
[ 5 posts ] |
|
| Author |
Message |
|
orange993
|
Post subject: How to connect wideband output to pc in order to log AFR? Posted: Sat Jun 17, 2023 10:16 am |
|
 |
| Newbie |
Joined: Thu Oct 14, 2021 12:10 pm Posts: 7
|
|
Hi, I have SLC Free 2 wideband controller and 4.9 LSU wideband sensor. I can already log in RomRaider logger but I wanted to attach wideband controller to the logger. In user's manual it says that one pin (Linear Output 0-5 volts) goes to datalogger and I wonder how can I connect it so I can measure the AFR in RR logger?
|
|
| Top |
|
 |
|
piku
|
Post subject: Re: How to connect wideband output to pc in order to log AFR Posted: Sat Jul 15, 2023 11:44 pm |
|
 |
| Newbie |
Joined: Sat Feb 13, 2016 7:35 pm Posts: 37
|
I had a similar problem with an old AEM UEGO. I used an arduino to emulate a UEGO with a serial output. Now bear in mind the voltage table is going to be different for your sensor. I also adjusted something here to compensate for a voltage offset to make the arduino reading actually match the gauge. The reading is also averaged out over 10 readings because it's inherently noisy. Also the code is probably terrible because I just threw it together in a few minutes and I don't remember the rationale behind some of the things I did. But using an arduino is going to be the easiest way to solve your issue. There is additional tabbed data, the plugin only looks at the first value. This is the code: Code: int uegoAdcPin = 0; float voltsPerTick = 0.004882813; int readingCount = 0; float readings[10]; int adcReadings[10]; float volts[10]; float readingsDesired = 10;
void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.flush(); // Use the 5V analog refrence voltage analogReference(DEFAULT);
delay(1000); }
void loop() { // put your main code here, to run repeatedly: if (readingCount==readingsDesired) { float readingAvg = 0; int adcReadingAvg = 0; float voltsAvg = 0; for (int i=0;i<10;i++) { readingAvg+=readings[i]; adcReadingAvg+=adcReadings[i]; voltsAvg+=volts[i]; } readingAvg/=readingsDesired; adcReadingAvg/=readingsDesired; voltsAvg/=readingsDesired; Serial.print(readingAvg); Serial.print("\t"); Serial.print(adcReadingAvg); Serial.print("\t"); Serial.print(voltsAvg); Serial.println(); readingCount=0; } adcReadings[readingCount] = analogRead(uegoAdcPin); volts[readingCount] = convertAdcReadingToVolts(adcReadings[readingCount]); readings[readingCount] = convertVoltsToGasolineAfr(volts[readingCount], adcReadings[readingCount]); readingCount+=1; }
float convertAdcReadingToVolts(int adcReading) { float readingVoltage = voltsPerTick*adcReading; return readingVoltage; }
float convertVoltsToGasolineAfr(float volts, int adcReading) { int itemCount = 34; float voltages[] = { 0.00, 0.16, 0.31, 0.47, 0.62, 0.78, 0.94, 1.09, 1.25, 1.40, 1.56, 1.72, 1.87, 2.03, 2.18, 2.34, 2.50, 2.65, 2.81, 2.96, 3.12, 3.27, 3.43, 3.59, 3.74, 3.90, 4.05, 4.21, 4.37, 4.52, 4.68, 4.83, 4.99, 5.00 }; float gasolineAfrs[] = { 10.00, 10.32, 10.62, 10.94, 11.24, 11.56, 11.88, 12.18, 12.50, 12.80, 13.12, 13.44, 13.74, 14.06, 14.36, 14.68, 15.00, 15.30, 15.62, 16.24, 16.54, 16.86, 17.18, 17.48, 17.80, 18.10, 18.42, 18.74, 19.04, 19.36, 19.66, 19.98, 20.00 };
for (int i=0;i<itemCount;i++) { //Serial.println(i); //Serial.println(itemCount); if (i>=itemCount-1) return 20.00;
if (voltages[i]>volts) { // we have our range (i and i-1). Now we need to figure out a more precise number float afr1 = gasolineAfrs[i-1]; float afr2 = gasolineAfrs[i]; float volt1 = voltages[i-1]; float volt2 = voltages[i]; int ticks1 = volt1/voltsPerTick; int ticks2 = volt2/voltsPerTick;
int ticksInRange = ticks2-ticks1; float afrInRange = afr2-afr1; float afrPerTick = afrInRange / ticksInRange;
float finalAfr = afr1+((adcReading-ticks1)*afrPerTick); return finalAfr; } } return 22; }
|
|
| Top |
|
 |
|
janithdg
|
Post subject: Re: How to connect wideband output to pc in order to log AFR Posted: Mon Nov 24, 2025 7:22 am |
|
 |
| Experienced |
Joined: Mon Oct 17, 2011 1:57 pm Posts: 260 Location: Sri Lanka
|
piku wrote: I had a similar problem with an old AEM UEGO. I used an arduino to emulate a UEGO with a serial output. Now bear in mind the voltage table is going to be different for your sensor. I also adjusted something here to compensate for a voltage offset to make the arduino reading actually match the gauge. The reading is also averaged out over 10 readings because it's inherently noisy. Also the code is probably terrible because I just threw it together in a few minutes and I don't remember the rationale behind some of the things I did. But using an arduino is going to be the easiest way to solve your issue. There is additional tabbed data, the plugin only looks at the first value. This is the code: Code: int uegoAdcPin = 0; float voltsPerTick = 0.004882813; int readingCount = 0; float readings[10]; int adcReadings[10]; float volts[10]; float readingsDesired = 10;
void setup() { // put your setup code here, to run once: Serial.begin(9600); Serial.flush(); // Use the 5V analog refrence voltage analogReference(DEFAULT);
delay(1000); }
void loop() { // put your main code here, to run repeatedly: if (readingCount==readingsDesired) { float readingAvg = 0; int adcReadingAvg = 0; float voltsAvg = 0; for (int i=0;i<10;i++) { readingAvg+=readings[i]; adcReadingAvg+=adcReadings[i]; voltsAvg+=volts[i]; } readingAvg/=readingsDesired; adcReadingAvg/=readingsDesired; voltsAvg/=readingsDesired; Serial.print(readingAvg); Serial.print("\t"); Serial.print(adcReadingAvg); Serial.print("\t"); Serial.print(voltsAvg); Serial.println(); readingCount=0; } adcReadings[readingCount] = analogRead(uegoAdcPin); volts[readingCount] = convertAdcReadingToVolts(adcReadings[readingCount]); readings[readingCount] = convertVoltsToGasolineAfr(volts[readingCount], adcReadings[readingCount]); readingCount+=1; }
float convertAdcReadingToVolts(int adcReading) { float readingVoltage = voltsPerTick*adcReading; return readingVoltage; }
float convertVoltsToGasolineAfr(float volts, int adcReading) { int itemCount = 34; float voltages[] = { 0.00, 0.16, 0.31, 0.47, 0.62, 0.78, 0.94, 1.09, 1.25, 1.40, 1.56, 1.72, 1.87, 2.03, 2.18, 2.34, 2.50, 2.65, 2.81, 2.96, 3.12, 3.27, 3.43, 3.59, 3.74, 3.90, 4.05, 4.21, 4.37, 4.52, 4.68, 4.83, 4.99, 5.00 }; float gasolineAfrs[] = { 10.00, 10.32, 10.62, 10.94, 11.24, 11.56, 11.88, 12.18, 12.50, 12.80, 13.12, 13.44, 13.74, 14.06, 14.36, 14.68, 15.00, 15.30, 15.62, 16.24, 16.54, 16.86, 17.18, 17.48, 17.80, 18.10, 18.42, 18.74, 19.04, 19.36, 19.66, 19.98, 20.00 };
for (int i=0;i<itemCount;i++) { //Serial.println(i); //Serial.println(itemCount); if (i>=itemCount-1) return 20.00;
if (voltages[i]>volts) { // we have our range (i and i-1). Now we need to figure out a more precise number float afr1 = gasolineAfrs[i-1]; float afr2 = gasolineAfrs[i]; float volt1 = voltages[i-1]; float volt2 = voltages[i]; int ticks1 = volt1/voltsPerTick; int ticks2 = volt2/voltsPerTick;
int ticksInRange = ticks2-ticks1; float afrInRange = afr2-afr1; float afrPerTick = afrInRange / ticksInRange;
float finalAfr = afr1+((adcReading-ticks1)*afrPerTick); return finalAfr; } } return 22; }
Did you use a voltage divider in analog input pin?, Without the tab you can use afr=(adcvoltage*2)+10 Thank this helped
|
|
| Top |
|
 |
|
dschultz
|
Post subject: Re: How to connect wideband output to pc in order to log AFR Posted: Wed Nov 26, 2025 4:07 pm |
|
 |
| RomRaider Developer |
Joined: Wed May 20, 2009 9:49 pm Posts: 7314 Location: Canada eh!
|
|
| Top |
|
 |
|
AvA_26RUS
|
Post subject: Re: How to connect wideband output to pc in order to log AFR Posted: Sat Nov 29, 2025 3:11 pm |
|
 |
| Newbie |
 |
Joined: Sat May 31, 2025 3:45 pm Posts: 3 Location: Пятигорск
|
|
If you have an MS41.0 unit, then you need to solder 2 resistors and install firmware 41.1 or 41.2. After that, you will have the opportunity to connect a broadband lambda probe to pins 77, 78. In the recorder, you need to select lambdas after the catalyst and it will register this data.
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 5 posts ] |
|
Who is online |
Users browsing this forum: Janis and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|