I made a flame sensor, but it can also detect light, and the fan it is attached to will turn on once the light or “flame” is detected. The light will come from my phone flashlight, and the fan will cut on when it is directly in front of the sensor. I tried this out in Tinkercad and tweaked the numbers so the sensor works with my phone flashlight after wiring the Arduino, breadboard, fan, and relay module to the correct port. And write code that states what digital pin and analog pin to use. In my case, it was pin 13 and A1. Initialize the sensor value, then make the sensor value equal to read what the analog pin is, have the serial monitor display the distance the analog pin is reading, and make an if-else statement stating that if the distance is less than a certain number, turn the digital pin on high this turns the fan on else the digital pin is on low which turns the fan off. I made the distance less than 1.5 inches, so the light has to be close to the sensor. Of course, you can always change the number. The video of the sensor in action will be here.