14point7/Romraider/Arduino Nano 3 code

197 views
Skip to first unread message

sparks_c/s

unread,
Mar 25, 2021, 1:22:30 AM3/25/21
to 14Point7

Hi there,

Anyone know what the lambda and gasoline_afr formula is for the spartan2?

I'm using the Arduino Nano 3 and would like to use the 14point7 tab for coms on the Romraider logger.

Code below (given to me by a fellow user, slightly edited)

Regards 

Kev



unsigned long timer = millis() + 2000;

void setup() {

Serial.begin(19200);

} void loop() {

int pinVoltageA1 = analogRead(A1);

float voltage1 = pinVoltageA1 * (4.73 / 1024);

float lambda = (0.11086957 * voltage1) + 0.56784;

float gasoline_afr = (1.63 * voltage1) + 8.344;

float finalDisplayingValue = gasoline_afr;

if(millis() > timer){

Serial.println(finalDisplayingValue);

timer = millis() + 100;

}

}

David Hook

unread,
Mar 25, 2021, 6:11:54 AM3/25/21
to 14Point7

Hi, I did something similar to this.  If you search for the thread "AFR Display", then you will find the discussion where I shared the calculation I perform.  I'm not familiar with Romraider logger so I did a quick google but didn't help much.  Once you have calculated AFR what happens next?  On my set up I put the AFR on the CAN bus to allow me to log it in sync with vehicle data( I'm quite happy to share the code for this if it is useful).

sparks_c/s

unread,
Mar 26, 2021, 3:55:13 AM3/26/21
to 14Point7
Hi Dave,
The Romraider open source logger will request the serial data from the Nano 3.
The calculations I'm after will be specific to how the the spartan 2 calculates lambda or AFR. i.e

float lambda = (0.11086957 * voltage1) + 0.56784;
float gasoline_afr = (1.63 * voltage1) + 8.344;

That's what I'm after, these don't currently add up.

unsigned long timer = millis() + 2000;

void setup() {

Serial.begin(19200);

} void loop() {

int pinVoltageA1 = analogRead(A1);

float voltage1 = pinVoltageA1 * (4.73 / 1024);

float lambda = (0.11086957 * voltage1) + 0.56784;

float gasoline_afr = (1.63 * voltage1) + 8.344;

float finalDisplayingValue = gasoline_afr;

if(millis() > timer){

Serial.println(finalDisplayingValue);

timer = millis() + 100;

}

}







RRL.PNG
Reply all
Reply to author
Forward
0 new messages