I started playing around with photo-sensitive PCBs. So, I needed a device to expose PCBs. It's not just a UV light, we need to control the exposure time and other paramaters. So I used an Arduino for control and to give the user a way to set the time of exposure. In this write-up, I will give you some details on how I did this. Now, you don't need to make this project overly complex and there are ways to simplifiy it. With my own experience, I started with the bare minimum but, I found it a bit, 'lacking.'
I hope you will find this useful and a time saver. I will tell you what worked, what didn't, and any issues I found, and to overcome them.
First, here's the schematic for the entire project. I will post individual schematics of each module to make it easier to follow. The circuit isn't complex and mostly beginner oriented. The code for the Arduino is the complex part but you don't have to understand it as it's complete and is free of bugs (I think).
#include <LiquidCrystal.h>
#include <stdio.h>
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int minutes = 0;
int seconds = 0;
int countdown = 0;
const int startButton = 2;
const int resetButton = 5;
const int minutesButton = 3;
const int secondsButton = 4;
const int LED_UV = 6;
const int UV_BRD1 = 16;
const int UV_BRD2 = 17;
const int buzzerPin = 7;
const int pwrLED = 14;
const int expLED = 15;
boolean startCountdown = false;
int logic1, logic2, logic3, logic4;
void setup(){
pinMode(startButton, INPUT_PULLUP);
pinMode(resetButton, INPUT_PULLUP);
pinMode(minutesButton, INPUT_PULLUP);
pinMode(secondsButton, INPUT_PULLUP);
pinMode(pwrLED, OUTPUT);
pinMode(expLED, OUTPUT);
pinMode(LED_UV, OUTPUT);
pinMode(UV_BRD1, OUTPUT);
pinMode(UV_BRD2, OUTPUT);
pinMode(buzzerPin, OUTPUT);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("-Exposure Time-");
lcd.setCursor(0, 1);
lcd.print("- Press SETUP -");
digitalWrite(LED_UV, LOW);
digitalWrite(pwrLED, HIGH);
Serial.begin(9600);
}
void splashscreen(){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Exposure Time");
lcd.setCursor(0, 1);
lcd.print("* Press Start *");
}
void buzzer(){
for (int x = 0; x <= 3; x++)
{
tone(buzzerPin, 1500, 100);
delay(200);
tone(buzzerPin, 1500, 100);
delay(200);
tone(buzzerPin, 1500, 100);
delay(200);
tone(buzzerPin, 1500, 100);
delay(200);
}
}
void uberTime(){
countdown = ((minutes * 60) + seconds);
digitalWrite(LED_UV, HIGH);
digitalWrite(UV_BRD1, HIGH);
digitalWrite(UV_BRD2, HIGH);
digitalWrite(expLED, HIGH);
digitalWrite(pwrLED, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Exposing Board");
lcd.setCursor(0, 1);
lcd.print("Time:");
lcd.setCursor(11, 1);
lcd.print(" Secs");
for (int timer = countdown; timer >= 0; timer --){
char buffer[6];
sprintf(buffer, "%4d", countdown);
lcd.setCursor(7, 1);
lcd.print(buffer);
delay(1000);
countdown = countdown - 1;
}
digitalWrite(LED_UV, LOW);
digitalWrite(UV_BRD1, LOW);
digitalWrite(UV_BRD2, LOW);
digitalWrite(expLED, LOW);
digitalWrite(pwrLED, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" ** ALL DONE **");
lcd.setCursor(0, 1);
lcd.print(" Press START");
buzzer();
logic1 = digitalRead(startButton);
while (logic1 != 0){
logic1 = digitalRead(startButton);
}
startCountdown = false;
minutes = 0;
seconds = 0;
countdown = 0;
}
void setupTimer(){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" - Set Time - ");
lcd.setCursor(0, 1);
lcd.print("Then Press Start");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Set Expose Time");
lcd.setCursor(0, 1);
lcd.print("Min: ");
lcd.setCursor(9, 1);
lcd.print("Sec: ");
while (startCountdown == false){
logic2 = digitalRead(secondsButton);
//SECONDS ADJUST
if (logic2 == LOW){
seconds ++;
delay(300);
if (seconds >= 60){
seconds = 0;
minutes ++;
}
}
char buffer[3];
sprintf(buffer, "%2d", seconds);
lcd.setCursor(14, 1);
lcd.print(buffer);
logic3 = digitalRead(minutesButton);
//MINUTES ADJUST
if (logic3 == LOW){
minutes ++;
delay(500);
}
lcd.setCursor(6, 1);
lcd.print(minutes);
logic4 = digitalRead(resetButton);
//RESET ADJUSTMENTS = SETS SECONDS AND MINUTES TO 0
if (logic4 == LOW){
seconds = 0;
minutes = 0;
}
logic1 = digitalRead(startButton);
//START
if (logic1 == LOW){
startCountdown = true;
}
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Exposure Start");
lcd.setCursor(0, 1);
lcd.print("Timer = ");
lcd.setCursor(8, 1);
lcd.print(countdown);
lcd.setCursor(12, 1);
lcd.print("Secs");
buzzer();
uberTime();
}
void loop(){
splashscreen();
logic1 = digitalRead(startButton);
logic2 = digitalRead(secondsButton);
logic3 = digitalRead(minutesButton);
if (logic1 == LOW){ // SETUP & START BUTTON
setupTimer();
}
Serial.print("startButton = ");
Serial.print(digitalRead(startButton));
Serial.print("resetButton = ");
Serial.print(digitalRead(resetButton));
Serial.print("minutesButton = ");
Serial.println(digitalRead(minutesButton));
delay(100);
}
#include <LiquidCrystal.h>
#include <stdio.h>
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
int minutes = 0;
int seconds = 0;
int countdown = 0;
const int startButton = 2;
const int resetButton = 5;
const int minutesButton = 3;
const int secondsButton = 4;
const int LED_UV = 6;
const int UV_BRD1 = 16;
const int UV_BRD2 = 17;
const int buzzerPin = 7;
const int pwrLED = 14;
const int expLED = 15;
boolean startCountdown = false;
int logic1, logic2, logic3, logic4;
void setup(){
pinMode(startButton, INPUT_PULLUP);
pinMode(resetButton, INPUT_PULLUP);
pinMode(minutesButton, INPUT_PULLUP);
pinMode(secondsButton, INPUT_PULLUP);
pinMode(pwrLED, OUTPUT);
pinMode(expLED, OUTPUT);
pinMode(LED_UV, OUTPUT);
pinMode(UV_BRD1, OUTPUT);
pinMode(UV_BRD2, OUTPUT);
pinMode(buzzerPin, OUTPUT);
lcd.begin(16, 2);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("-Exposure Time-");
lcd.setCursor(0, 1);
lcd.print("- Press SETUP -");
digitalWrite(LED_UV, LOW);
digitalWrite(pwrLED, HIGH);
Serial.begin(9600);
}
void splashscreen(){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Exposure Time");
lcd.setCursor(0, 1);
lcd.print("* Press Start *");
}
void buzzer(){
for (int x = 0; x <= 3; x++)
{
tone(buzzerPin, 1500, 100);
delay(200);
tone(buzzerPin, 1500, 100);
delay(200);
tone(buzzerPin, 1500, 100);
delay(200);
tone(buzzerPin, 1500, 100);
delay(200);
}
}
void uberTime(){
countdown = ((minutes * 60) + seconds);
digitalWrite(LED_UV, HIGH);
digitalWrite(UV_BRD1, HIGH);
digitalWrite(UV_BRD2, HIGH);
digitalWrite(expLED, HIGH);
digitalWrite(pwrLED, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Exposing Board");
lcd.setCursor(0, 1);
lcd.print("Time:");
lcd.setCursor(11, 1);
lcd.print(" Secs");
for (int timer = countdown; timer >= 0; timer --){
char buffer[6];
sprintf(buffer, "%4d", countdown);
lcd.setCursor(7, 1);
lcd.print(buffer);
delay(1000);
countdown = countdown - 1;
}
digitalWrite(LED_UV, LOW);
digitalWrite(UV_BRD1, LOW);
digitalWrite(UV_BRD2, LOW);
digitalWrite(expLED, LOW);
digitalWrite(pwrLED, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" ** ALL DONE **");
lcd.setCursor(0, 1);
lcd.print(" Press START");
buzzer();
logic1 = digitalRead(startButton);
while (logic1 != 0){
logic1 = digitalRead(startButton);
}
startCountdown = false;
minutes = 0;
seconds = 0;
countdown = 0;
}
void setupTimer(){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" - Set Time - ");
lcd.setCursor(0, 1);
lcd.print("Then Press Start");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" Set Expose Time");
lcd.setCursor(0, 1);
lcd.print("Min: ");
lcd.setCursor(9, 1);
lcd.print("Sec: ");
while (startCountdown == false){
logic2 = digitalRead(secondsButton);
//SECONDS ADJUST
if (logic2 == LOW){
seconds ++;
delay(300);
if (seconds >= 60){
seconds = 0;
minutes ++;
}
}
char buffer[3];
sprintf(buffer, "%2d", seconds);
lcd.setCursor(14, 1);
lcd.print(buffer);
logic3 = digitalRead(minutesButton);
//MINUTES ADJUST
if (logic3 == LOW){
minutes ++;
delay(500);
}
lcd.setCursor(6, 1);
lcd.print(minutes);
logic4 = digitalRead(resetButton);
//RESET ADJUSTMENTS = SETS SECONDS AND MINUTES TO 0
if (logic4 == LOW){
seconds = 0;
minutes = 0;
}
logic1 = digitalRead(startButton);
//START
if (logic1 == LOW){
startCountdown = true;
}
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Exposure Start");
lcd.setCursor(0, 1);
lcd.print("Timer = ");
lcd.setCursor(8, 1);
lcd.print(countdown);
lcd.setCursor(12, 1);
lcd.print("Secs");
buzzer();
uberTime();
}
void loop(){
splashscreen();
logic1 = digitalRead(startButton);
logic2 = digitalRead(secondsButton);
logic3 = digitalRead(minutesButton);
if (logic1 == LOW){ // SETUP & START BUTTON
setupTimer();
}
Serial.print("startButton = ");
Serial.print(digitalRead(startButton));
Serial.print("resetButton = ");
Serial.print(digitalRead(resetButton));
Serial.print("minutesButton = ");
Serial.println(digitalRead(minutesButton));
delay(100);
}