Help Hacking a UV light board into something I can use

I have a UV light display found in a product that is meant for or certain types of nail polish. Upon deconstructing, The board is quite simple, and I want to use it with an Arduino nano to make a oven style resin curing station. I have the Arduino Nano wired to the button in a way that allows it to simulate a button press by applying its own voltage. The specific board came with a timer to automatically turn off the light once a time hit, which I have removed with the board remaining fully functional. The problem is, when I want the Arduino to read a light sensor and turn it off when regular light is sensed, the light will continue to blink in a pattern. I believe that it is a problem with the way my code is checking if the light is already off to avoid redundant toggles. The light toggles on when the button is pressed once, and off when it is pressed 2 more times. The code I have the problem with is below, documented to the best of my abilities. feel free to ask for any additional resources such as images

const int UVlight = 2;
const int PhotoSens = A2;
const int Button1 = 4;
int lightVal = 0;
int lightCal = 0;
bool UVstatus;  //declare variables and pins

void setup() {
  pinMode(UVlight, OUTPUT);
  pinMode(PhotoSens, INPUT);
  pinMode(Button1, INPUT); 
  Serial.begin(9600); //pinModes and begin serial

}

void loop() {
  // put your main code here, to run repeatedly:
  lightVal = analogRead(PhotoSens); //Read the phototransistor and store it as lightVal
  Serial.print(lightVal);
  Serial.print("       ");   // print the light value as well as a large space
  


  if (lightVal < 40) { //if light value is above 40 (what i saw to be a good middle point with my resistor), run UV_ON function and write "ON" to Serial
    UV_ON();
    Serial.println("ON");
    
  }
  else { //If not, Write off and run UV_OFF function
    UV_OFF();
    Serial.println("OFF");
  }
}

 //[Important note] The board in use uses 1 button press to turn on, 2 button presses turn it off
void UV_ON() { //This part of the code simulates a button press on the board.
  if (!UVstatus) { //
  digitalWrite(UVlight, HIGH); //button being pressed down
  delay(50);
  digitalWrite(UVlight, LOW); //button being released
  }
  UVstatus = true; //sets bool UV status to true, because light is now on. This prevents the light from being attempted to turn on multiple times, and therefore turning off.
  
}

void UV_OFF() { //This part o fthe code simulates 2 button presses, which corresponds to turning the UV light off
  if (UVstatus) {
  digitalWrite(UVlight, HIGH); //button pushed down
  delay(50);
  digitalWrite(UVlight, LOW); //button release
  delay(500);
  digitalWrite(UVlight, HIGH);// button press again
  delay(50);
  digitalWrite(UVlight, LOW);// button release again
  }
  UVstatus = false; // sets the UV status bool to false becasue light is off for the same reason as before.
  }


  



My five cents:
When you want to sense the light from an UV source: are you sure your sensor can see the UV light? Many sensors are for visible or infrared light, they might not have any sensitivity on UV light (I am not aware of a commonly used UV light sensor, they can be also very expensive, very seldom parts needed by the public).

Just check the wavelength of the UV light (OK, assume it is real UV light, there are also different regions for UV, e.g. UV-A, UV-B, no idea what a nail studio needs to harden paint...), and the wavelength of your sensor. If you use an ordinary light sensor: it will not see any UV light.
Often, ambient light sensors, e.g. for your daylight - they have an UV filter: they do not want to be saturated by the UV part from the sun light. So, they are even more insensitive for UV light!

Also be careful!
UV light is almost invisible for you! You have no clue how strong the light is. And UV is power-full! it cannot just burn your skin - it will kill your eyes immediately on first light beam caught!
Wear an UV protection goggle (as I do with my laser engraver, maybe a laser protection goggle is your first investment into the project).

Playing with UV is risky and very specific! Handle it like a laser. And be aware of the wavelength (and energy) created!

And my 2 cents. UV curing resin is sensitive to specific UV wave lengths. Before you invest much more time and energy, you need to test you resin and the UV light to see if the resin will cure. Takes only a few seconds.

This is helpful, and I have used this to dry the first few prints I have made after being cleaned, and i mainly want a more permanent solution, as well as being enclosed so I don't have to be exposed. The UV lights are not very powerful, and emit more purple than UV, so I will know if its on.

When you want to sense the light from an UV source:

I may have worded it oddly. I want a regular photoresistor to determine when a drawer is open so that the light can cut off automatically. The end goal for the project is a oven like drawer with reflective surfaces to bounce around any light, but only turn on when the drawer is closed.

BE CAREFUL!!!!
Playing with UV risks your eyes - for sure!
Even you see a purple light - you do not know what the radiated power in the invisible spectrum is!
Even an UV LED, with 50mW can kill your eyes! (I have used some before, with very high caution)
I assume, the devices used to harden nail paint or UV-curing glue (dentist) are very power full!

Again: a UV-sensor is something very specific. Any ordinary photoresistor might not measure the UV part (you might measure more the ambient light). You cannot rely on a photo sensor if you are not sure it is intended to be used to detect UV light. And even if so: check the wavelength which is detected: UV is a wide spectrum, maybe UV-B is radiated, but a sensor for UV-A will not get it really (and give you false "measurement".

I would STOP working on UV stuff, if you are not really sure what the radiation power and spectrum (wavelength) is, if you do not have the right protection stuff for yourself (your eyes).
Please, do not assume to get help when your project is so specific and DANGEROUS.

Several years ago we, my company, worked with a neighboring company to manufacturer UV LED curing lights for finger nail polish. They went with Chinese lights because they were so cheap. The UV they use for nail polish will not damage anyone's eyes, both because of wavelength and because of power of the UV.

1 Like

"hmmm": why do I have to protect my eyes at the dentist when they cure my fillings?
I take UV very seriously! If you go the approach as "what I do not (can) see does not harm" - it's up to you. No further comments (and neither support) from my side.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.