This LED is controlled by Arduino.
According to the experiment you will find when the light is strong, the LED will off. When the light is weak the LED will on. Do you feel strange why this happen without light sensor? Now let me tell you the answer.
Check the connection diagram:
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Test the LED
Thanks PCBWay support, you can redeem Arduino and bread board in their gift shop.
As we know the LED will shine when powered on.
So will it generate voltage when we use illuminate LED? After experiment it is Yes, the LED also has photovoltaic effect. An ordinary white LED will generate generates tens of millivolts of voltage at 4.7M resistance if exposed to slightly strong light (For high-power LEDs, the voltage generated is even higher).
When the load is 4.7M, the measurement results of several LED photovoltaic effects in the room near the window:
1, white LED:
2, green LED:
3, red LED
Step 2: Code
Here, Arduino take advantage of the feature
of the LED for self-control. When there is no light, the LED doesn’t generate photovoltaic current or the current is small. And the circuit controls its connection. When exposed to light, the generated photovoltaic current is large and the circuit controls its extinguishing. The control sensitivity threshold is set by the program.
LED goes out during normal lighting
LED shine after block light
pinMode( A0 , INPUT);
if (analogRead(A0) < temp )
pinMode( A0 , OUTPUT);
digitalWrite( A0 , HIGH );