Good day all.
I am looking for help and guidance with a project of mine, I am still a total newbie to Arduino coding.
I have built a spot welder / battery tab welder, But at this point in time it is manually controlled via a foot pedal switch, and as such it's very hard to get consistent welds.
I am looking at building a Arduino based timer to try and get more consistent welds.
The Arduino will be used to control a relay to turn on and off the spot welder.
The Relay is a Hongmei JQX-78F rated for 16A 250VAC / 16A 30VDC. I will be using it to switch the 230vac mains side, not the high current side of the spot welder. The spot welder pulls 8amps (1840watts) from the mains at 1st arc then drops off so the relay is rated at double what I will be pulling.
The end goal of the project is to be able to set and adjust the weld time via a Rotary encoder, The weld time would never need to exceed 10 seconds.
I am not really quite sure where I should start.
So I am going to need some kind of menu interface to adjust the timer, I have never done menu's before, and don't really even know where to start looking.
I would be very grateful if someone could point me in the right direction or give me some kind of example code to play with.
Below is the code so far:
/*
*/
#include <Wire.h> // Include Standard Wire Library
#include <LiquidCrystal_I2C.h> // Include I2C LCD Library (https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/LiquidCrystal_V1.2.1.zip)
int encoder_A = 2; // Rotary encoder input A Pin
int encoder_B = 3; // Rotary encoder input B Pin
int encoder_SW = 4; // Rotary encoder Switch input Pin
int trigger_SW = 5; // Foot Pedel Switch input Pin
int outputRelay = 9; // Relay output Pin
int outputBuzzer = 10; // Buzzer output Pin
int LCD_I2C_address = 0x20; // LCD I2C Address
int LCD_I2C_en = 2; // LCD I2C Enable Pin
int LCD_I2C_rw = 1; // LCD I2C Read/Write Pin
int LCD_I2C_rs = 0; // LCD I2C Register Select Pin
int LCD_I2C_d4 = 4; // LCD I2C D4 Data Pin
int LCD_I2C_d5 = 5; // LCD I2C D5 Data Pin
int LCD_I2C_d6 = 6; // LCD I2C D6 Data Pin
int LCD_I2C_d7 = 7; // LCD I2C D7 Data Pin
int LCD_I2C_bl = 3; //
int CountDown = 1500; // Default time in milliseconds
LiquidCrystal_I2C lcd(LCD_I2C_address, LCD_I2C_en, LCD_I2C_rw, LCD_I2C_rs, LCD_I2C_d4, LCD_I2C_d5, LCD_I2C_d6, LCD_I2C_d7, LCD_I2C_bl, POSITIVE); //
void setup() { // Put your setup code here, to run once:
pinMode(encoder_A, INPUT); // Set pin as Input
pinMode(encoder_B, INPUT); // Set pin as Input
pinMode(encoder_SW, INPUT); // Set pin as Input
pinMode(trigger_SW, INPUT); // Set pin as Input
pinMode(outputRelay, OUTPUT); // Set pin as Output
digitalWrite(outputRelay, LOW); // Set output as Low
pinMode(outputBuzzer, OUTPUT); // Set pin as Output
digitalWrite(outputBuzzer, LOW); // Set output as Low
lcd.begin(16,2); // Initialize the lcd
delay(100); // Delay
lcd.setCursor(2,0); // Start at character 3 on line 0
lcd.print("Spot Welder"); // Print text to lcd display
lcd.setCursor(2,1); // Start at character 3 on line 1
lcd.print("Firmware 0.1"); // Print text to lcd display
delay(5000); // Delay
}
void loop() { // Put your main code here, to run repeatedly:
lcd.setCursor(0,0); // Start at character 1 on line 0
lcd.print("**System Ready**"); // Print text to lcd display
lcd.setCursor(0,1); // Start at character 3 on line 1
lcd.print(" Time: 1.000s "); // Print text to lcd display
delay(2000); // Delay
lcd.setCursor(0,0); // Start at character 1 on line 0
lcd.print(" Press and Hold "); // Print text to lcd display
lcd.setCursor(0,1); // Start at character 1 on line 1
lcd.print(" Pedal to Start "); // Print text to lcd display
delay(2000); // Delay
}
Thanks for your time and advice.