Uno based GM 4 wire IAC controller
Stand alone controller for 4 wire Intake Air Control Valves.
Components and supplies
10k pot
25W L298N Dual HBridge
Arduino UNO
Adafruit Waterproof DS18B20 Digital temperature sensor
Tools and machines
Soldering iron (generic)
Solder Wire, Lead Free
Apps and platforms
Arduino IDE
Project description
Code
GMiac_v3.ino
csharp
arduino source code
1// GM IAT Controller JKW 2021 2#include <Wire.h> 3#include <LiquidCrystal_I2C.h> 4#include <Stepper.h> 5#include <OneWire.h> 6#include <DallasTemperature.h> 7#define ONE_WIRE_BUS 2 8#define BACKLIGHT_PIN 3 9const int stepsPerRevolution = 255; 10Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7); 11int stepCount = 0; 12int Step = 0; 13int MinSteps = 3; 14int prog = 0; 15int istep = 0; 16int maxtmp = 180; 17int potpin = 0; 18unsigned long myTime; 19LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display 0X26 for 20 by 4 lcd. 20OneWire oneWire(ONE_WIRE_BUS); 21DallasTemperature sensors(&oneWire); 22 23 24void iprog() { 25istep = map(stepCount,0,255,15,0); 26lcd.setCursor(0,0); 27lcd.print("Initializing!"); 28lcd.setCursor(0,1); 29switch (istep) { 30 case 1: 31 lcd.print("=> "); 32 break; 33 case 2: 34 lcd.print("==> "); 35 break; 36 case 3: 37 lcd.print("===> "); 38 break; 39 case 4: 40 lcd.print("====> "); 41 break; 42 case 5: 43 lcd.print("=====> "); 44 break; 45 case 6: 46 lcd.print("======> "); 47 break; 48 case 7: 49 lcd.print("=======> "); 50 break; 51 case 8: 52 lcd.print("========> "); 53 break; 54 case 9: 55 lcd.print("=========> "); 56 break; 57 case 10: 58 lcd.print("==========> "); 59 break; 60 case 11: 61 lcd.print("===========> "); 62 break; 63 case 12: 64 lcd.print("============> "); 65 break; 66 case 13: 67 lcd.print("=============> "); 68 break; 69 case 14: 70 lcd.print("==============> "); 71 break; 72 case 15: 73 lcd.print("===============>"); 74 break; 75 } 76 } 77 78void homeit() { 79 maxtmp = analogRead(potpin); 80 lcd.clear(); 81 lcd.setBacklight(HIGH); 82 stepCount = 0; 83 while (stepCount < 255) { 84 iprog(); 85 myStepper.step(1); 86 Serial.print("steps:"); 87 Serial.println(stepCount); 88 stepCount++; 89} 90} 91 92void setup() { 93 Serial.begin(9600); 94 Wire.begin(); 95 lcd.begin (16,2); // <<----- LCD 16x2 96 lcd.clear(); 97 sensors.begin(); 98 delay(2000); 99 homeit(); 100 lcd.setBacklight(HIGH); 101 myTime = millis(); 102} 103 104void progressBar() { 105prog = map(Step,0,255,6,1); 106lcd.setCursor(9,1); 107switch (prog) { 108 case 1: 109 lcd.print("=> "); 110 break; 111 case 2: 112 lcd.print("==> "); 113 break; 114 case 3: 115 lcd.print("===> "); 116 break; 117 case 4: 118 lcd.print("====> "); 119 break; 120 case 5: 121 lcd.print("=====> "); 122 break; 123 case 6: 124 lcd.print("======>"); 125 break; 126 } 127} 128 129void dhtwork() { 130 sensors.requestTemperatures(); 131 float f = sensors.getTempFByIndex(0); 132 if (isnan(f)) { 133 Serial.println(F("Failed to read from DHT sensor!")); 134 return; 135 } 136 maxtmp = analogRead(potpin); 137 maxtmp = map(maxtmp, 1, 1022, 20, 180); 138 Step = constrain(map(f, -20, maxtmp, 255, 0), 0, 255); 139 Serial.print(F("MaxTemp: ")); 140 Serial.print(maxtmp); 141 Serial.print(F(" Temperature: ")); 142 Serial.print(f); 143 Serial.print(" "); 144 lcd.setCursor(0,0); 145 lcd.print("T:"); 146 lcd.print(f); 147 lcd.print(" "); 148 lcd.setCursor(9,0); 149 lcd.print("Max:"); 150 lcd.print(maxtmp); 151 lcd.print(" "); 152} 153 154void loop() { 155dhtwork(); 156setit(); 157delay(25); 158if ( millis() > myTime + 125000 ) { 159 lcd.setBacklight(LOW); 160} 161 162} 163 164void disableStepper() { 165digitalWrite(4, LOW); 166digitalWrite(5, LOW); 167digitalWrite(6, LOW); 168digitalWrite(7, LOW); 169} 170 171void setit() { 172 // added some histerysis, so were looking for at leats 3 degrees before a change. 173 if (Step > stepCount + MinSteps ) { 174 lcd.setBacklight(HIGH); 175 myTime = millis(); 176 openit(); 177 } 178 if (Step < stepCount - MinSteps ) { 179 lcd.setBacklight(HIGH); 180 myTime = millis(); 181 closeit(); 182 } 183 Serial.print("Calculated step:"); 184 Serial.println(Step); 185 lcd.setCursor(0,1); 186 lcd.print("Step "); 187 lcd.print(Step); 188 if ( Step >= 100 ) { 189 lcd.print(" "); 190 } else { 191 lcd.print(" "); 192 } 193 delay(5); 194 progressBar(); 195} 196 197void openit() { 198 while (stepCount - MinSteps < Step) { 199 myStepper.step(1); 200 stepCount++; 201 delay(5); 202 disableStepper(); // only for locking style iac, if power is needed to prevent it moving comment out. 203} 204} 205 206void closeit() { 207 while (stepCount + MinSteps > Step) { 208 myStepper.step(-1); 209 stepCount--; 210 delay(5); 211 disableStepper(); 212} 213}
GMiac_v3.ino
csharp
arduino source code
1// GM IAT Controller JKW 2021 2#include <Wire.h> 3#include <LiquidCrystal_I2C.h> 4#include <Stepper.h> 5#include <OneWire.h> 6#include <DallasTemperature.h> 7#define ONE_WIRE_BUS 2 8#define BACKLIGHT_PIN 3 9const int stepsPerRevolution = 255; 10Stepper myStepper(stepsPerRevolution, 4, 5, 6, 7); 11int stepCount = 0; 12int Step = 0; 13int MinSteps = 3; 14int prog = 0; 15int istep = 0; 16int maxtmp = 180; 17int potpin = 0; 18unsigned long myTime; 19LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display 0X26 for 20 by 4 lcd. 20OneWire oneWire(ONE_WIRE_BUS); 21DallasTemperature sensors(&oneWire); 22 23 24void iprog() { 25istep = map(stepCount,0,255,15,0); 26lcd.setCursor(0,0); 27lcd.print("Initializing!"); 28lcd.setCursor(0,1); 29switch (istep) { 30 case 1: 31 lcd.print("=> "); 32 break; 33 case 2: 34 lcd.print("==> "); 35 break; 36 case 3: 37 lcd.print("===> "); 38 break; 39 case 4: 40 lcd.print("====> "); 41 break; 42 case 5: 43 lcd.print("=====> "); 44 break; 45 case 6: 46 lcd.print("======> "); 47 break; 48 case 7: 49 lcd.print("=======> "); 50 break; 51 case 8: 52 lcd.print("========> "); 53 break; 54 case 9: 55 lcd.print("=========> "); 56 break; 57 case 10: 58 lcd.print("==========> "); 59 break; 60 case 11: 61 lcd.print("===========> "); 62 break; 63 case 12: 64 lcd.print("============> "); 65 break; 66 case 13: 67 lcd.print("=============> "); 68 break; 69 case 14: 70 lcd.print("==============> "); 71 break; 72 case 15: 73 lcd.print("===============>"); 74 break; 75 } 76 } 77 78void homeit() { 79 maxtmp = analogRead(potpin); 80 lcd.clear(); 81 lcd.setBacklight(HIGH); 82 stepCount = 0; 83 while (stepCount < 255) { 84 iprog(); 85 myStepper.step(1); 86 Serial.print("steps:"); 87 Serial.println(stepCount); 88 stepCount++; 89} 90} 91 92void setup() { 93 Serial.begin(9600); 94 Wire.begin(); 95 lcd.begin (16,2); // <<----- LCD 16x2 96 lcd.clear(); 97 sensors.begin(); 98 delay(2000); 99 homeit(); 100 lcd.setBacklight(HIGH); 101 myTime = millis(); 102} 103 104void progressBar() { 105prog = map(Step,0,255,6,1); 106lcd.setCursor(9,1); 107switch (prog) { 108 case 1: 109 lcd.print("=> "); 110 break; 111 case 2: 112 lcd.print("==> "); 113 break; 114 case 3: 115 lcd.print("===> "); 116 break; 117 case 4: 118 lcd.print("====> "); 119 break; 120 case 5: 121 lcd.print("=====> "); 122 break; 123 case 6: 124 lcd.print("======>"); 125 break; 126 } 127} 128 129void dhtwork() { 130 sensors.requestTemperatures(); 131 float f = sensors.getTempFByIndex(0); 132 if (isnan(f)) { 133 Serial.println(F("Failed to read from DHT sensor!")); 134 return; 135 } 136 maxtmp = analogRead(potpin); 137 maxtmp = map(maxtmp, 1, 1022, 20, 180); 138 Step = constrain(map(f, -20, maxtmp, 255, 0), 0, 255); 139 Serial.print(F("MaxTemp: ")); 140 Serial.print(maxtmp); 141 Serial.print(F(" Temperature: ")); 142 Serial.print(f); 143 Serial.print(" "); 144 lcd.setCursor(0,0); 145 lcd.print("T:"); 146 lcd.print(f); 147 lcd.print(" "); 148 lcd.setCursor(9,0); 149 lcd.print("Max:"); 150 lcd.print(maxtmp); 151 lcd.print(" "); 152} 153 154void loop() { 155dhtwork(); 156setit(); 157delay(25); 158if ( millis() > myTime + 125000 ) { 159 lcd.setBacklight(LOW); 160} 161 162} 163 164void disableStepper() { 165digitalWrite(4, LOW); 166digitalWrite(5, LOW); 167digitalWrite(6, LOW); 168digitalWrite(7, LOW); 169} 170 171void setit() { 172 // added some histerysis, so were looking for at leats 3 degrees before a change. 173 if (Step > stepCount + MinSteps ) { 174 lcd.setBacklight(HIGH); 175 myTime = millis(); 176 openit(); 177 } 178 if (Step < stepCount - MinSteps ) { 179 lcd.setBacklight(HIGH); 180 myTime = millis(); 181 closeit(); 182 } 183 Serial.print("Calculated step:"); 184 Serial.println(Step); 185 lcd.setCursor(0,1); 186 lcd.print("Step "); 187 lcd.print(Step); 188 if ( Step >= 100 ) { 189 lcd.print(" "); 190 } else { 191 lcd.print(" "); 192 } 193 delay(5); 194 progressBar(); 195} 196 197void openit() { 198 while (stepCount - MinSteps < Step) { 199 myStepper.step(1); 200 stepCount++; 201 delay(5); 202 disableStepper(); // only for locking style iac, if power is needed to prevent it moving comment out. 203} 204} 205 206void closeit() { 207 while (stepCount + MinSteps > Step) { 208 myStepper.step(-1); 209 stepCount--; 210 delay(5); 211 disableStepper(); 212} 213}
Downloadable files
arduino to bridge wiring
wiring of the bridge board
arduino to bridge wiring
temp sensor wiring
diagram of temp sensor wiring
temp sensor wiring
temp sensor wiring
diagram of temp sensor wiring
temp sensor wiring
arduino to bridge wiring
wiring of the bridge board
arduino to bridge wiring
wiring of potentiometer
wire the adjustment knob, forget the servo here, just the pot.
wiring of potentiometer
Comments
Only logged in users can leave comments