Photo Resistor With Flowing LED
by iamcycy14 in Circuits > Arduino
137 Views, 0 Favorites, 0 Comments
Photo Resistor With Flowing LED
Today, I am going to explain what I made with LEDs. First, I will introduce how does my product work. I used a photoresistor in my product indeed to let it detect light, and "if" the photoresistor detects no light, then the flowing LED will light up, "else" it won't light up. This product could be used in some scenarios, for example, when I have a party, when I turn off my light, this thing will light up, gives a good mood for the party. Also, it could be placed in your house, it is useful when you are afraid of the dark, this means that if you turn off the light, the flowing LED could ignite the place.
Prepare You Materials !
In this project, you can try to change the number of LEDs depending on how much you want, if you like more, you can add it yourself. You can also decide the color of the LED too.
Material :
- Arduino & Bread Board
- LED x9 (increase or decrease depending on how much you like)
- Blue Resistors x1 (This is used on the photoresistor)
- Orange resistors x9 (the number of resistors would be the same as your LED)
- Wires x50 (It depends on how much you need)
- Photoresistor x1
- Alligator clip x2
Build Your Circuits
Here, I will show you how my circuits are connected, there will be small steps to follow
Circuit - 1
You just have to do the same thing to get this thing to work. But if you want to add in LED, you just have to do the same way but just connect your wires to a new pin.
Circuit - 2
This is the product you will make out
Coding
Coding - 1
So this part is basically doing the setting. You can choose the lowest and highest pin depending on how many LEDs you want to put.
Coding - 2
In the first image, from lines 13 to 35, most of the codes are to make the light flowing effect, and the "LOW" and "HIGH" are whether off and on. But for the first few lines, the codes are for the photoresistor. It is basically the "if" and "else" logic, the if would be at the front where the loops start, and the else will be placed at the back. When the photoresistor didn't receive light signals, the LED light will start to flow. Also, you can customize the delay time yourself, and I set 100 ms for me. For the second image, the last few lines are the else code, so when the photoresistor detects light, the LED will be put off.
Testing and Finishing
click here to see the test video
So if you watch the video, you can see that the LED flows with no light, but stops flowing when it detects light. If you turn off your light, it could also work like the testing too. In addition, I made a case for my device, the case is basically made of a piece of paper, but if you put this on, you can see that the LED looks better with it. If you want to make the same thing, you just have to take an A4 paper, and then take the short side and fold it to the other short side, then stick it. After that, the case will be finished! Also, you can put a little hole for the photoresistor.