Light Guard 1.0 - Final product - 3D Printed Casing PIR MCU LED Sleep Low power AVR Dimmer PWM
Features:
-Highest efficiency powered by PWM in sleep mode
-1 Button controls 2 power LED, a low power project
-Press to turn ON/OFF; Double click to cycle through 5 dimming levels and 1 blinking mode
-LEDs Turn ON and OFF gradually, fancy and easy on the eye
-Built-in Lithium-ion battery charger with reverse protection P-Mosfet
+PIR sensor is working fine, but the 3D printed PIR lens doesn't work at all, so it's not programmed.
Light guard is a prototype project that has been finely programmed even though it's a prototype and even though the final product is relatively simple. 1 button turns ON/OFF 2 LED, and the same button cycles through 5 brightness levels and 1 blinking mode using double-click, and that is it.
Sophistication is hidden in the simplest thing: 1, This is low power project, the MCU is in sleep mode most of the time. Yes, even when the LED are ON, the CPU is halted, powered by the PWM from the timer alone. 2, Responsive button code, it's the most sophisticated button code written so far. This tiny button is responsible of 3 main tasks. 3, High efficient heatsink-less LEDs driver, each LED is powered by a different MOSFET and PWM channel; This type of redundancy emphasizes reliability. 60mA of current is enough to light up a small room. 2.2mA as a book reading light. 4, 3D-printing is part of the test, and the casing is made precisely with wall thickness of 1mm. The two 3D printed ball-shaped spheres are used as light defuser which works very nicely, but the center ball intended as a PIR lens failed completely. 3D printing PIR lens is not easy noted.
Sleep code:
The code has become a bit sloppy with more features added. Good planning is the key, and try not to over-use sleep and watchdog in a way that makes it very hard to debug. Here watchdog is used as a timer for the button denounce and the blinking of 2 LEDs and as a waking up source. 99% of the flash memory has been used. Have to remove few lines of code for the program to fit the 1024 bytes Atiny13A.
More about LED:
2 1-watt LEDs are under powered 80mA consumed means they are powered at about 80/(350*2)=0.11 or 11% at is max rated power.
The heatsink-less design is very efficient and cool to touch. The key term here is something called thermal resistance, for this type of LED bulb, it's about 15°C/W, which can be translated into that the temperature of the LED will raise 15°C if it's dissipating 1 watt. Assuming it's 30°C for the ambient environment, then at 1 watt, the LED would at about 30+15=45°C, of which is way under the maximum rated temperature of 75°C, so a 1-watt LED doesn't require a heatsink at all, but this is clearly false. The 15°C/W is the thermal resistance between the LED chip and the case, but the case to air is not given, so the actual rating is definitely more than 15°C/W. Firstly the true value for this parameter is a varying value ranging from 15-105°C/W; and secondly, this value can only be used as a reference, so an important parameter is meaningless here. To determined the heatsink-less power dissipation, simply gradually increase the PWM value just right before the LED bulb is getting warm to touch.