For our project, we thought it was necessary to equip the aquarium of a LEDs. In this way, the aquarium will be enlightened when the room become dark.
For this, it was necessary first to buy a light sensor (or photoresistance). The principle is quite simple: more there is light, more the resistance is low. Darkness causes significant resistance. Then we have to connect the sensor to the analog port of the Arduino. Thus, the analog pin transforms the received voltage, between 0 and 5V, to a value between 0 and 1024. However, we have transformed these values in programming to a percentage of brightness between 0 and 100%.
For wiring, we used a resistor as a voltage divider bridge. For this type of sensor, it was a resistance of 10k ohms.
In programming, we set a value (for example 20%) which will instruct the relay to change state. Thus, the relay passes to “normally open” in “normally closed” to power the LEDs.
Note that it is possible to improve this system because the user want not necessarily light the LEDs when the room is dark. For this, it is necessary to install a switch that will allow to voluntarily cut the supply of LEDs.
See you soon everyone!