Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Logging

The system can stream live data via the serial port for logging purposes. Press the '#' key while connected via serial and the system will start streaming data in this format:

mapCorrected,vntTargetPressure,vntPositionRemapped,tpsCorrected,rpmActual,pidOutput,n75precontrol,vntMinDc,vntMaxDc,mode,targetRatioKp,targetRatioKi,targetRatioKd,boostCalculatedP,boostCalculatedI,boostCalculatedD,temp1,auxOutput,millis( / 10)
mapCorrected,vntTargetPressure,vntPositionRemapped,tpsCorrected,rpmActual,temp1,boostCalculatedP,boostCalculatedI,boostCalculatedD,pidOutput,n75precontrol,vntMinDc,vntMaxDc,rpmCorrected,mode,auxOutput,millis( / 10)

The output data can be captured with a tool like 'screen' and logged to disk. It can then be opened directly in a spreadsheet program like LibreOffice or Excel for graphing purposes.

Expand All @@ -66,3 +66,10 @@ To set the baud rate on a fresh serial backpack plug it in via USB. USB doesn't
# echo -e "\xFE\x39\x08" > /dev/ttyACM0

The baud rate setting is stored on the LCD's EEPROM and will be briefly displayed at startup allowing you to verify the setting was saved successfully.

Pop-Off
=========

The pop-off follows this logic: when I exceed a certain TPS value, the pop-off system is armed. If I drop below a certain TPS value, within a certain time limit, at a certain minimum MAP value, the pop-off (output #10) is activated for a certain amount of time.
All the times and values is configurable in sketch.
The pop-off in a diesel engine is usually unnecessary, but it could be an interesting addition if you happen to have problems with turbo surging, fluttering, or simply if you want a cool pop-off in your diesel car!
75 changes: 58 additions & 17 deletions vnt_lda_myPID.ino
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const unsigned char versionString[] PROGMEM = "DMN-Vanbcguy Boost Ctrl v3.2.3";

#define PIN_LCD 8

// POP_OFF Pin
#define PIN_POP_OFF 10

#define LCD_BAUD_RATE 115200

// Pins for the EGT MAX31855
Expand All @@ -43,6 +46,19 @@ ResponsiveAnalogRead map_read(PIN_MAP, false); // no sleep on the MAP read; nee
ResponsiveAnalogRead tps_read(PIN_TPS, true);
ResponsiveAnalogRead rpm_read(0, true);

// POP_OFF Configuration
#define POP_OFF_ACTIVATION_TPS 800 // TPS must exceed this value to arm pop-off
#define POP_OFF_RELEASE_TPS 400 // TPS must be released below this value to activate pop-off
#define POP_OFF_RELEASE_TIME 1000 // maximum time (ms) to release TPS
#define POP_OFF_BLOW_TIME 300 // pop-off length (ms)
#define POP_OFF_MIN_BOOST 100 // minimum MAP value at which pop-off is permitted

// POP_OFF Variables
bool popOffArmed = false;
unsigned long tpsReleaseStartTime = 0;
unsigned long popOffStartTime = 0;
bool popOffBlowing = false;

// Set up the LCD pin
SoftwareSerial lcd = SoftwareSerial(0, PIN_LCD);

Expand Down Expand Up @@ -507,6 +523,10 @@ void setup() {
digitalWrite(PIN_TPS, LOW); // safety unconnected TPS
digitalWrite(PIN_MAP, HIGH); // safety unconnected MAP

// POP_OFF Pin
pinMode(PIN_POP_OFF, OUTPUT);
digitalWrite(PIN_POP_OFF, LOW);

// clear screen
lcd.write(0xFE);
lcd.write(0x58);
Expand Down Expand Up @@ -1189,9 +1209,18 @@ unsigned int execTimeRead = 0;
unsigned int execTimeAct = 0;
unsigned int execTimeLcd = 0;

// streaming data's values
void pageDataLogger(char key) {
Serial.print(toKpaMAP(controls.mapCorrected), DEC);
Serial.print(F(","));








Serial.print(toKpaMAP(controls.vntTargetPressure), DEC);
Serial.print(F(","));
Serial.print(controls.vntPositionRemapped, DEC);
Expand Down Expand Up @@ -1894,12 +1923,10 @@ void displayPage(char page, char data) {
case 3:
pageMapEditor(0, data);
visualizeActuator(28);

break;
case 4:
pageMapEditor(1, data);
visualizeActuator(28);

break;
case 5:
pageMapEditor(2, data);
Expand Down Expand Up @@ -1938,6 +1965,34 @@ unsigned long mapLoop = 0;

void loop() {

//POP-OFF Loop
if (popOffBlowing) {
if (millis() - popOffStartTime >= POP_OFF_BLOW_TIME) {
digitalWrite(PIN_POP_OFF, LOW);
popOffBlowing = false;
}
} else {
if (tps_read.getValue() > POP_OFF_ACTIVATION_TPS) {
popOffArmed = true;
tpsReleaseStartTime = 0;
}

if (popOffArmed && tps_read.getValue() < POP_OFF_ACTIVATION_TPS && tpsReleaseStartTime == 0) {
tpsReleaseStartTime = millis();
}

bool tpsIsReleased = (tps_read.getValue() < POP_OFF_RELEASE_TPS);
bool releaseIsFast = (tpsReleaseStartTime != 0 && (millis() - tpsReleaseStartTime < POP_OFF_RELEASE_TIME));
bool turboHasBoost = (map_read.getValue() > POP_OFF_MIN_BOOST);

if (popOffArmed && tpsIsReleased && releaseIsFast && turboHasBoost) {
digitalWrite(PIN_POP_OFF, HIGH);
popOffBlowing = true;
popOffArmed = false;
popOffStartTime = millis();
}
}

if ((millis() - mapLoop) >= MAP_DELAY) {
readValuesMap(); // Read every loop; we're calculating an average to clean up noise.
mapLoop = millis();
Expand Down Expand Up @@ -2028,18 +2083,4 @@ void loop() {
displayLoop = millis();
execTimeLcd = displayLoop - execTimeLcd;
}
}














}