Have you ever wondered how in autobrightness mode our phone screen brightness is being adjusted to make screen visible as well as extend battery life. That is what is done by Ambient light sensor present above screen in most phones. Ambient light sensor makes screen brightness at maximum intensity when there is much light in surroundings so that screen content is visible to user. At th same time since using phones at very high intensity brightness and in dark surroundings would lead to damage to eyes. And also content could be visible with low brightness, usage of high intensity brightness would be battery draining.
Since this is a small scale project meant for making you understand the phenomena behind autobrightness mode in smartphones, instead of screen I have used a small LED.
In this project I have made an ambient light sensor that adjusts the brightness of its LED attached with respect to surrounding lights. It senses the surrounding lights with LDR and then adjust the brightness of LED by changing it in every 10 seconds of interval of time.
When light goes dim in surroundings, the LED also gets dim(or even doesn't glows) thus making it favourable for python code to send message to us via Telegram channel informing thast light is dim. If we want more brightness we can visit link attached with telegram alert message and can adjust LED brightness with the help of 5 buttons present on webpage whose link is attached with alert message. But when the LED light is adjusted manually, the same light brightness lasts for about and hour and after that brightness is adjusted automatically in order to save bateery in case of brightness with very high intensity when adjusted manually.
Steps to setup this project
1. Collect all required materials and make hardware configurations as per scematics
2. Now make a device on bolt cloud name ambient_sensor, selecting device type as output device and using GPIO for collecting data. Afterwards make a file of type.html in code window with your suitable name and code as attached with this project named Amhardware_conf.html
3. Afterwards, make your bolt module connected to boltcloud and then linking product newly made to the device.
4. you must have telegram app that has already created public channel and a bot as an administrator to that channel that would be helpful in sending messages to your telegram channel.
5. import bolt python libraries to ubuntu based server with the help of terminal
6. Import both the python files attached with this project to ubuntu based operating system keeping both of them in same directory and add add your api key, device id, channel id, bot id etc at the convinient places.
7. Run Ambientlight.py file on terminal and your device is ready to work.
8. After running you would not see anything on output screen because I dont have specified code to be set as output for that particular case but you can see the results on the led connected to hardware setup as it starts glowing and changing its value after every 10 seconds. As soon as the sensor value reaches beyond 5 and led light decreases to minimum intensity, an output would be shown on screen.
9. Parallely, a telegram message would be delivered to your channel whichever channel you have entered in conf2.py by bot in the channel which is controlled by you using Ambientlight.py code
10. After clicking on the link attached with the message, go to the link and you would be redirected to page that containes all controlling buttons. You can also install bolt iot app and open that app to get to same page
11. This controlling of LED manually lasts for 1 hour after you receive message, afterwards the LED light automatically adjusts the brightness according to light from surroundings.
Thank you for visiting my project.
Comments