Mobile devices like the tablets and phones come with a built-in light sensor to facilitate the automatic change of screen brightness with changing ambient light intensity. I was wondering if the same action could be replicated for laptops and thus this project's idea was born.
Making use of fundamental electronic principles, this instructable shows as to how you can make your laptop change its screen brightness depending upon the ambient light intensity.
Step 1: Parts Required
- Adafruit Trinket M0.
- 100KOhm resistor (you can use other resistors depending upon the value of your LDR).
- Light Dependent Resistor(LDR).
- Female and male headers.
- General purpose PCB.
Step 2: Working
A Light Dependent Resistor (LDR) is a resistor whose resistance varies with changing intensity of light falling on it. Typically as shown in the graph, the resistance increases with decreasing light intensity and the resistance decreases with increasing light intensity.
The full potential of the LDR is made use by connecting them in a voltage divider circuit. In the second image, the resistance R2 is replaced with the LDR and using the given formula the voltage accross the LDR is measured. As the resistance of the LDR changes, the voltage across it changes as well. Thus by monitoring the changing voltage the intensity of light falling on the LDR can be quantified.
Note: Light intensity measurements using LDR are relative measurements and not absolute.
Step 3: Putting Everything Together
The Trinket, Fixed Resistor and LDR were interconnected as shown in the wiring diagram. A piece of Velcro was used to hold the fixture in place on the laptop display.
The test code was renamed to code.py and loaded on the Trinket. The light in the room was varied and the voltage variation across the LDR was noted.
Powershell scripts for changing screen brightness in steps of 10 from 0-100 was drafted. Sample script for setting brightness to 10% is attached here. In order to make them executable on double click, shortcuts were created.
The test code was modified to initiate the keyboard shortcut actions, upon changing voltages across the LDR. Upon loading the code onto the Trinket, and connecting the Trinket to the laptop through a USB cable, the laptop starts to respond to the changing ambient light.
Participated in the
Electronics Tips & Tricks Challenge