This project helps you build a smart light that turns on or off based on the ambient light levels.
• Cloudio - Raspberry Pi setup
• Relay
• Bulb
Connect a relay to port X1 of Cloudio. Further, connect a bulb to it as shown.
1.If block is used to check the ambient light value.
Digital blocks are used in the True and False sections of the If block to turn the bulb on or off via a relay connected to any of the Digital ports X1/X2/X3.
Use Read to set the trigger value; cover and uncover the LT sensor when you do this so you know the exact reading to set the trigger value at.
Upload and test this snippet to check if you have set the appropriate trigger value for the ambient light readings.
Note: This test snippet runs ONCE and only AT the time of upload.For this snippet, the bulb should turn on if the Light sensor is covered AT the time of upload.
A Loop(∞) is used to ensure that the Light value is checked for the entire duration that the project is running on the board.
The final project is shown below.
Upload the project.
Once the project has been uploaded, vary the light levels to check if the bulb is being turned on when the ambient light level drops.
Note: You can use Read within the Light block's parameter area to set the correct threshold light value/ trigger value.