Components and supplies
Alphanumeric LCD, 16 x 2
Push buttons (NO and NC)
Actuonix L12R/L16R linear servo
60W PCIe 12V 5A Power Supply
Solid State Relay, 12 A
Linear Regulator (7805)
DR-IAC5A
SD Card Module
Arduino UNO
ProtoScrewShield
Emergency Stop Switch, DPST
Tools and machines
Extraction Tool, 6 Piece Screw Extractor & Screwdriver Set
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Apps and platforms
Arduino IDE
Project description
Code
Switch/Socket Endurance Tester
c_cpp
1/*Project:Switch/Socket Endurance Tester 2 Author: Cajetan Chinonso Emmanuel*/ 3 4//#include <LEM.h> 5#include <Wire.h> // Include wire library 6#include <LiquidCrystal_I2C.h> // Include New Liquid crystal for I2C bus 7#include <Servo.h> // Include Servo Library 8#include <SD.h> // Load SD library 9#include <SPI.h> // Load SPI library 10 11#define LINEAR_ACTUATORPIN1 5 // Define Servo Pin 12#define LINEAR_ACTUATORPIN2 6 13 14LiquidCrystal_I2C lcd(0x27, 20, 4); // set the LCD address to 0x27 for a 16 chars and 2 line display 15 16Servo LINEAR_ACTUATOR1; // Set object as servo 17Servo LINEAR_ACTUATOR2; 18 19//int linearValue = 1000; // Value for linear actuator on start 20 21int returnButton = 2; 22int startPin = 3; // Start pin 23int resetBoard = 9; 24int resetPin = 7; 25 26int count_A; // Counter 1 Value 27int count_B; 28 29const int setPoint = 10000; 30int countPin1 = A1; 31int countPin2 = A2; 32int startVal = 0; // Value to store start 33 34unsigned long currentMillis = 0; 35unsigned long currentMillis_B = 0; 36unsigned long previousMillis; 37unsigned long previousMillis_B; 38 39const long on_SetTime = 20000; 40 41byte currentButtonState_A; 42byte previousButtonState_A; 43 44byte currentButtonState_B; 45byte previousButtonState_B; 46 47boolean counting; 48boolean counting_B; 49 50//Lem sensor(HO_50_S, A0); 51 52const int chipSelect = 4; 53File testData; 54 55 56void setup() { 57 Serial.begin(115200); // Begin Serial Monitoring 58 // sensor.calibrate(); 59 60 digitalWrite(9, HIGH); 61 62 pinMode(9, OUTPUT); 63 SD.begin(chipSelect); 64 65 lcd.init(); // LCD with 16 chars, 2 line display 66 lcd.clear(); // Clear screen 67 lcd.backlight(); 68 lcd.clear(); 69 lcd.setCursor(0, 0); 70 lcd.print("Scanning..."); 71 72 LINEAR_ACTUATOR1.attach(LINEAR_ACTUATORPIN1, 1000, 2000); // min and max position for servo 73 LINEAR_ACTUATOR1.writeMicroseconds(1550); 74 LINEAR_ACTUATOR2.attach(LINEAR_ACTUATORPIN2, 1000, 2000); 75 LINEAR_ACTUATOR2.writeMicroseconds(1550); 76 77 78 pinMode(startPin, INPUT_PULLUP); // Set start pin as input 79 pinMode(resetPin, OUTPUT); 80 pinMode(A1, INPUT_PULLUP); 81 pinMode(A2, INPUT_PULLUP); 82 pinMode(2, INPUT_PULLUP); 83 pinMode(7, INPUT_PULLUP); 84 85 if (!SD.begin(chipSelect)) { 86 Serial.println("Card failed, or not present"); 87 lcd.setCursor(0, 0); 88 lcd.print("No SD detected"); 89 lcd.setCursor(0, 1); 90 lcd.print("Insert SD card"); 91 delay(750); 92 digitalWrite(resetBoard, LOW); 93 // don't do anything more: 94 while (1); 95 } 96 // Serial.println("card initialized."); 97 delay(200); 98 lcd.clear(); 99} 100 101void stopRun() { 102 // linearValue = 1075; 103 LINEAR_ACTUATOR1.writeMicroseconds(1000); 104 LINEAR_ACTUATOR2.writeMicroseconds(1000); 105} 106 107void testFail() { 108 if (digitalRead(7) == HIGH) { 109 digitalWrite(resetBoard, LOW); 110 } 111 lcd.clear(); 112 lcd.setCursor(0, 0); 113 lcd.print("Failed at " + String(count_A)); 114 lcd.setCursor(0, 1); 115 lcd.print("Failed at " + String(count_B)); 116 delay(4000); 117} 118 119void loop() { 120 // float I = sensor.getCurrentAC(); 121 startVal = digitalRead(startPin); 122 123 lcd.setCursor(3, 0); 124 lcd.print("INITIALISE"); 125 126 if (digitalRead(2) == HIGH) { 127 stopRun(); 128 } 129 130 if (digitalRead(7) == HIGH) { 131 digitalWrite(resetBoard, LOW); 132 } 133 134 if (startVal == LOW && digitalRead(2) == LOW) { 135 136 lcd.clear(); 137 // linearValue = 1000; 138 delay(1000); 139 140 while (startVal == LOW && digitalRead(2) == LOW) { 141 142 lcd.setCursor(0, 0); 143 lcd.print("Pos 1 ="); 144 lcd.setCursor(0, 1); 145 lcd.print("Pos 2 ="); 146 147 unsigned long currentMillis = millis(); 148 unsigned long currentMillis_B = millis(); 149 150 previousButtonState_A = currentButtonState_A; 151 previousButtonState_B = currentButtonState_B; 152 153 currentButtonState_A = digitalRead(A1); 154 currentButtonState_B = digitalRead(A2); 155 156 if (count_B <= 2 and currentMillis_B - previousMillis_B >= 20000) { 157 if (counting_B = true) { 158 lcd.setCursor(0, 1); 159 lcd.print("NOT APPLICABLE"); 160 currentMillis_B = previousMillis_B; 161 counting_B = false; 162 } 163 } 164 165 if (currentButtonState_A == LOW) { 166 Serial.println("OFF"); 167 // linearValue = 1430; //retract 168 // delay(200); 169 // currentMillis = onSwitch; 170 delay(200); 171 LINEAR_ACTUATOR1.writeMicroseconds(1550); 172 delay(200); 173 LINEAR_ACTUATOR2.writeMicroseconds(1800); 174 // delay(200); 175 } 176 177 else { 178 if (previousButtonState_A == HIGH) { 179 Serial.println("ON"); 180 // currentMillis = offSwitch; 181 delay(200); 182 LINEAR_ACTUATOR1.writeMicroseconds(1800); 183 delay(200); 184 LINEAR_ACTUATOR2.writeMicroseconds(1550); 185 // delay(200); 186 } 187 } 188 189 if (currentButtonState_A == LOW and previousButtonState_A == HIGH) { 190 191 count_A++; 192 // float I = sensor.getCurrentAC(); 193 194 lcd.setCursor(8, 0); 195 lcd.print(count_A); 196 lcd.setCursor(0, 1); 197 // lcd.print("Amp: " + String(I) + "A"); 198 // Serial.println(count); 199 testData = SD.open("TSTdata.txt", FILE_WRITE); 200 if (testData) { 201 testData.println("Number of Cycles: " + String(count_A)); 202 testData.println(""); 203 testData.close(); 204 205 /*Serial.println("Number of Cycles: " + String(count) + "; Current: " + String(I * 11.538461538) + "A"); 206 Serial.println("");*/ 207 } 208 209 previousMillis = currentMillis; 210 211 } 212 213 else if (currentButtonState_B == LOW and previousButtonState_B == HIGH) { 214 215 count_B++; 216 // float I = sensor.getCurrentAC(); 217 218 lcd.setCursor(8, 1); 219 lcd.print(count_B); 220 lcd.setCursor(0, 1); 221 // lcd.print("Amp: " + String(I) + "A"); 222 // Serial.println(count); 223 testData = SD.open("TSTdata.txt", FILE_WRITE); 224 if (testData) { 225 testData.println("Number of Cycles: " + String(count_B)); 226 testData.println(""); 227 testData.close(); 228 229 /*Serial.println("Number of Cycles: " + String(count) + "; Current: " + String(I * 11.538461538) + "A"); 230 Serial.println("");*/ 231 } 232 233 previousMillis = currentMillis; 234 235 } 236 237 238 else if (count_A and count_B == setPoint) { 239 while (counting = true) { 240 testData = SD.open("TSTdata.txt", FILE_WRITE); 241 // if (testData) { 242 // testData.println("Cycles completed; Current: " + String(I) + "A"); 243 // testData.println(""); 244 // testData.close(); 245 // 246 // /*Serial.println("Cycles completed; Current: " + String(I * 11.538461538) + "A"); 247 // Serial.println("");*/ 248 // } 249 250 251 lcd.clear(); 252 lcd.setCursor(0, 0); 253 lcd.print("Start New"); 254 lcd.setCursor(0, 1); 255 lcd.print("Test Successful"); 256 delay(4000); 257 counting = false; 258 259 stopRun(); 260 if (digitalRead(2) == HIGH) break; 261 } 262 } 263 264 265 else if ((currentButtonState_A == HIGH or previousButtonState_A == LOW) && (currentMillis - previousMillis >= on_SetTime)) { 266 while (counting = true) { 267 268 testData = SD.open("TSTdata.txt", FILE_WRITE); 269 previousMillis = currentMillis; 270 if (testData) { 271 testData.println("Failed at " + String(count_A)); 272 // testData.println("Current at " + String(count_A) + ": "); 273 testData.println(""); 274 testData.close(); 275 276 /* Serial.println("Failed at " + String(count)); 277 Serial.println("Current at " + String(count) + ": " + String(I * 11.538461538) + "A"); 278 Serial.println("");*/ 279 } 280 testFail(); 281 delay(100); 282 stopRun(); 283 counting = false; 284 if (digitalRead(2) == HIGH) break; 285 } 286 } 287 288 if (digitalRead(2) == HIGH) break; 289 } 290 291 292 if (digitalRead(2) == HIGH) { 293 lcd.clear(); 294 lcd.setCursor(0, 0); 295 stopRun(); 296 } 297 } 298}
Switch/Socket Endurance Tester
c_cpp
1/*Project:Switch/Socket Endurance Tester 2 Author: Cajetan Chinonso 3 Emmanuel*/ 4 5//#include <LEM.h> 6#include <Wire.h> // 7 Include wire library 8#include <LiquidCrystal_I2C.h> // 9 Include New Liquid crystal for I2C bus 10#include <Servo.h> // 11 Include Servo Library 12#include <SD.h> // 13 Load SD library 14#include <SPI.h> // 15 Load SPI library 16 17#define LINEAR_ACTUATORPIN1 5 // 18 Define Servo Pin 19#define LINEAR_ACTUATORPIN2 6 20 21LiquidCrystal_I2C lcd(0x27, 22 20, 4); // set the LCD address to 23 0x27 for a 16 chars and 2 line display 24 25Servo LINEAR_ACTUATOR1; // 26 Set object as servo 27Servo LINEAR_ACTUATOR2; 28 29//int linearValue = 1000; 30 // Value for linear 31 actuator on start 32 33int returnButton = 2; 34int startPin = 3; // 35 Start pin 36int resetBoard = 9; 37int resetPin = 7; 38 39int count_A; // 40 Counter 1 Value 41int count_B; 42 43const int setPoint = 10000; 44int countPin1 45 = A1; 46int countPin2 = A2; 47int startVal = 0; // 48 Value to store start 49 50unsigned long currentMillis = 0; 51unsigned long currentMillis_B 52 = 0; 53unsigned long previousMillis; 54unsigned long previousMillis_B; 55 56const 57 long on_SetTime = 20000; 58 59byte currentButtonState_A; 60byte previousButtonState_A; 61 62byte 63 currentButtonState_B; 64byte previousButtonState_B; 65 66boolean counting; 67boolean 68 counting_B; 69 70//Lem sensor(HO_50_S, A0); 71 72const int chipSelect = 4; 73File 74 testData; 75 76 77void setup() { 78 Serial.begin(115200); // 79 Begin Serial Monitoring 80 // sensor.calibrate(); 81 82 digitalWrite(9, HIGH); 83 84 85 pinMode(9, OUTPUT); 86 SD.begin(chipSelect); 87 88 lcd.init(); // 89 LCD with 16 chars, 2 line display 90 lcd.clear(); // 91 Clear screen 92 lcd.backlight(); 93 lcd.clear(); 94 lcd.setCursor(0, 0); 95 96 lcd.print("Scanning..."); 97 98 LINEAR_ACTUATOR1.attach(LINEAR_ACTUATORPIN1, 99 1000, 2000); // min and max position for servo 100 LINEAR_ACTUATOR1.writeMicroseconds(1550); 101 102 LINEAR_ACTUATOR2.attach(LINEAR_ACTUATORPIN2, 1000, 2000); 103 LINEAR_ACTUATOR2.writeMicroseconds(1550); 104 105 106 107 pinMode(startPin, INPUT_PULLUP); // 108 Set start pin as input 109 pinMode(resetPin, OUTPUT); 110 pinMode(A1, INPUT_PULLUP); 111 112 pinMode(A2, INPUT_PULLUP); 113 pinMode(2, INPUT_PULLUP); 114 pinMode(7, INPUT_PULLUP); 115 116 117 if (!SD.begin(chipSelect)) { 118 Serial.println("Card failed, or not present"); 119 120 lcd.setCursor(0, 0); 121 lcd.print("No SD detected"); 122 lcd.setCursor(0, 123 1); 124 lcd.print("Insert SD card"); 125 delay(750); 126 digitalWrite(resetBoard, 127 LOW); 128 // don't do anything more: 129 while (1); 130 } 131 // Serial.println("card 132 initialized."); 133 delay(200); 134 lcd.clear(); 135} 136 137void stopRun() { 138 139 // linearValue = 1075; 140 LINEAR_ACTUATOR1.writeMicroseconds(1000); 141 LINEAR_ACTUATOR2.writeMicroseconds(1000); 142} 143 144void 145 testFail() { 146 if (digitalRead(7) == HIGH) { 147 digitalWrite(resetBoard, 148 LOW); 149 } 150 lcd.clear(); 151 lcd.setCursor(0, 0); 152 lcd.print("Failed 153 at " + String(count_A)); 154 lcd.setCursor(0, 1); 155 lcd.print("Failed at " 156 + String(count_B)); 157 delay(4000); 158} 159 160void loop() { 161 // float I 162 = sensor.getCurrentAC(); 163 startVal = digitalRead(startPin); 164 165 lcd.setCursor(3, 166 0); 167 lcd.print("INITIALISE"); 168 169 if (digitalRead(2) == HIGH) { 170 stopRun(); 171 172 } 173 174 if (digitalRead(7) == HIGH) { 175 digitalWrite(resetBoard, LOW); 176 177 } 178 179 if (startVal == LOW && digitalRead(2) == LOW) { 180 181 lcd.clear(); 182 183 // linearValue = 1000; 184 delay(1000); 185 186 while (startVal == 187 LOW && digitalRead(2) == LOW) { 188 189 lcd.setCursor(0, 0); 190 lcd.print("Pos 191 1 ="); 192 lcd.setCursor(0, 1); 193 lcd.print("Pos 2 ="); 194 195 unsigned 196 long currentMillis = millis(); 197 unsigned long currentMillis_B = millis(); 198 199 200 previousButtonState_A = currentButtonState_A; 201 previousButtonState_B 202 = currentButtonState_B; 203 204 currentButtonState_A = digitalRead(A1); 205 206 currentButtonState_B = digitalRead(A2); 207 208 if (count_B <= 2 and 209 currentMillis_B - previousMillis_B >= 20000) { 210 if (counting_B = true) 211 { 212 lcd.setCursor(0, 1); 213 lcd.print("NOT APPLICABLE"); 214 215 currentMillis_B = previousMillis_B; 216 counting_B = false; 217 218 } 219 } 220 221 if (currentButtonState_A == LOW) { 222 Serial.println("OFF"); 223 224 // linearValue = 1430; //retract 225 // delay(200); 226 227 // currentMillis = onSwitch; 228 delay(200); 229 LINEAR_ACTUATOR1.writeMicroseconds(1550); 230 231 delay(200); 232 LINEAR_ACTUATOR2.writeMicroseconds(1800); 233 // 234 delay(200); 235 } 236 237 else { 238 if (previousButtonState_A 239 == HIGH) { 240 Serial.println("ON"); 241 // currentMillis 242 = offSwitch; 243 delay(200); 244 LINEAR_ACTUATOR1.writeMicroseconds(1800); 245 246 delay(200); 247 LINEAR_ACTUATOR2.writeMicroseconds(1550); 248 249 // delay(200); 250 } 251 } 252 253 if (currentButtonState_A 254 == LOW and previousButtonState_A == HIGH) { 255 256 count_A++; 257 // 258 float I = sensor.getCurrentAC(); 259 260 lcd.setCursor(8, 0); 261 262 lcd.print(count_A); 263 lcd.setCursor(0, 1); 264 // lcd.print("Amp: 265 " + String(I) + "A"); 266 // Serial.println(count); 267 testData 268 = SD.open("TSTdata.txt", FILE_WRITE); 269 if (testData) { 270 testData.println("Number 271 of Cycles: " + String(count_A)); 272 testData.println(""); 273 testData.close(); 274 275 276 /*Serial.println("Number of Cycles: " + String(count) + "; Current: 277 " + String(I * 11.538461538) + "A"); 278 Serial.println("");*/ 279 280 } 281 282 previousMillis = currentMillis; 283 284 } 285 286 287 else if (currentButtonState_B == LOW and previousButtonState_B == HIGH) { 288 289 290 count_B++; 291 // float I = sensor.getCurrentAC(); 292 293 294 lcd.setCursor(8, 1); 295 lcd.print(count_B); 296 lcd.setCursor(0, 297 1); 298 // lcd.print("Amp: " + String(I) + "A"); 299 // 300 Serial.println(count); 301 testData = SD.open("TSTdata.txt", FILE_WRITE); 302 303 if (testData) { 304 testData.println("Number of Cycles: " + String(count_B)); 305 306 testData.println(""); 307 testData.close(); 308 309 /*Serial.println("Number 310 of Cycles: " + String(count) + "; Current: " + String(I * 11.538461538) + "A"); 311 312 Serial.println("");*/ 313 } 314 315 previousMillis = 316 currentMillis; 317 318 } 319 320 321 else if (count_A and count_B == setPoint) 322 { 323 while (counting = true) { 324 testData = SD.open("TSTdata.txt", 325 FILE_WRITE); 326 // if (testData) { 327 // testData.println("Cycles 328 completed; Current: " + String(I) + "A"); 329 // testData.println(""); 330 331 // testData.close(); 332 // 333 // /*Serial.println("Cycles 334 completed; Current: " + String(I * 11.538461538) + "A"); 335 // Serial.println("");*/ 336 337 // } 338 339 340 lcd.clear(); 341 lcd.setCursor(0, 342 0); 343 lcd.print("Start New"); 344 lcd.setCursor(0, 1); 345 346 lcd.print("Test Successful"); 347 delay(4000); 348 counting 349 = false; 350 351 stopRun(); 352 if (digitalRead(2) == HIGH) break; 353 354 } 355 } 356 357 358 else if ((currentButtonState_A == HIGH or 359 previousButtonState_A == LOW) && (currentMillis - previousMillis >= on_SetTime)) 360 { 361 while (counting = true) { 362 363 testData = SD.open("TSTdata.txt", 364 FILE_WRITE); 365 previousMillis = currentMillis; 366 if (testData) 367 { 368 testData.println("Failed at " + String(count_A)); 369 // 370 testData.println("Current at " + String(count_A) + ": "); 371 testData.println(""); 372 373 testData.close(); 374 375 /* Serial.println("Failed at " 376 + String(count)); 377 Serial.println("Current at " + String(count) 378 + ": " + String(I * 11.538461538) + "A"); 379 Serial.println("");*/ 380 381 } 382 testFail(); 383 delay(100); 384 stopRun(); 385 386 counting = false; 387 if (digitalRead(2) == HIGH) break; 388 389 } 390 } 391 392 if (digitalRead(2) == HIGH) break; 393 } 394 395 396 397 if (digitalRead(2) == HIGH) { 398 lcd.clear(); 399 lcd.setCursor(0, 400 0); 401 stopRun(); 402 } 403 } 404}
Downloadable files
Switch and socket tester schematics
Switch and socket tester schematics
Switch and socket tester schematics
Switch and socket tester schematics
switch and socket tester schematics
switch and socket tester schematics
Comments
Only logged in users can leave comments
Anonymous user
5 years ago
where is the video !! i want to see it work
mubarak_r
2 years ago
and me mraf30@gmail.com
echinonso8
2 years ago
You could share your email address
echinonso8
2 years ago
Ok
Anonymous user
2 years ago
barhomasystem@hotmail.com
Anonymous user
2 years ago
hi could you please share video with me cwacer07@hotmail.com
amithaz
2 years ago
couuld you please send the video me too..amithaprasanna90@gmail.com