Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

LED Light Bulb Controller using AVR Microcontroller

By Ashutosh Bhatt

 

Previously before 10-15 years the majority of electrical lights were either light bulbs (with yellow light) or tube-light sticks (with white light). The major disadvantage of these lighting devices was they consume more electrical energy (in terms of Watt) and gives less luminance (brightness). Light bulb wastes their most of the energy in form of heat. Also the life time of such devices was also short.

Next comes compact fluorescent light (CFL) bulbs. They consume much less electrical energy than light bulbs and tube-light sticks and give more light. But their disadvantage is their intensity cannot be varied. Also their life time is limited to few thousand hours. But because their energy consumption is very less compare to light bulbs, they almost replace them.

Prototype of AVR ATMega32 based LED Bulb Controller

Fig. 1: Prototype of AVR ATMega32 based LED Bulb Controller

Now a days LED light bulbs  are becoming more and more popular because they have several advantages over light bulbs and CFL bulbs. Some of their advantages are listed below

·         Their energy (electrical) consumption is much more less

·         Their luminance is more

·         Their intensity can be varied

·         Their life time is more

 

Looking at these advantages one might think LED light bulb must replace all CFL and other light bulbs but it is not so because there are some disadvantages also

·      They are much more costlier

·      They cannot be directly connected to AC, rectifier – converter is required

·      Additional DC driver circuit is required

 

However they will replace all other light bulbs because their energy consumption is very less. Today all the nations are facing crisis of electrical energy. The electrical energy generated using conventional energy sources like coal, petrol or diesel are becoming scares now. So any how to save such resources saving electrical energy is the ultimate requirement. So the LED light will be used everywhere in near future.

 

Here I am presenting the tutorial for controlling intensity of LED light using micro controller. For this project Reader should have knowledge of How to Start with AVR.The LED light intensity can be controlled by feeding PWM to it. As the width of applied signal increases the average voltage applied to LED increases that increases its intensity and vice versa. This can be done using any simple PWM generator IC like IC555 or IC741 etc any. But using microcontroller the light intensity can be controlled in precise steps like 10%, 20%, 30%…….. to 100%. Also the light intensity can be varied in accordance to sunlight (day light). Like during day with full sunlight the LED light is off. In the evening as day light decreases LED light intensity increases and in the night LED is fully ON.

So in this simple project 10 V LED light bulb is used. Its intensity is varied using PWM. PWM is generated using AVR micro controller ATMega16. Three push buttons are given to ON/OFF LED bulb and to increase / decrease its intensity. ATMega16 micro controller has built in 4 PWM channels. Out of these four one channel is used to vary intensity of bulb.

 Connections

Connections: – three push buttons are connected to PORTA pins PA0 – PA2. These pins are grounded through 1 K resistors so when push button is not pressed input to pins is 0. But when any push button is pressed that pin will get input 1. Two RED LEDs are connected to PORTC pins PC0 and PC1 with current limiting resistors. They indicate maximum and minimum brightness. White LED bulb is connected to PWM 0 channel output that is PORTB pin PB3. One 8 MHz crystal with two 22 pF capacitors is connected to crystal input pins XTAL1 and XTAL2. It provides 8 MHz clock for internal operation.

Operation: – initially bulb is ON. When 3rd button is pressed, the bulb becomes OFF. Alternatively pressing this button will make bulb ON and OFF. While bulb is ON, if 1st button is pressed the width of pulse is increased by 8%. If anyone keeps pressing this button then pulse width increases up to 98% of total time period. This is maximum limit. The bulb intensity is maximum. It is indicated by LED2. Similarly if any one keeps pressing 2nd button then pulse width decreases up to 4%. This is minimum limit. The bulb intensity is minimum. It is indicated by LED1. So pulse width is varied from 4% to 98% in 12 steps of 8% each. Same we can say for light intensity.

 

Further advancement:

The brightness (intensity) of LED bulb can be varied in accordance to daylight. Complete operation can be made automatic like bulb will be automatic ON/OFF, intensity increases/decreases etc as per daylight changes. The daylight can be sensed using LDR (or any other light sensor like photo-diode, photo transistor etc)

A solar operated LED street light can be build that can work as standalone automatic unit. Complete unit consist of solar panels, battery, charging circuit, LED driver-controller circuit and LED bulb. It can be installed at any place like in gardens, open air theatres, stadiums or in places where it is not feasible to lay down electrical cables

 

 

Project Source Code

###



#include <avr/io.h>                 // necessary header files
#include <util/delay.h>
unsigned int duty=130,c=0;        // initialize duty cycle at 50%
int main(void)
{
      DDRB = 0x08;                  // PB3 pin as output
      PORTB = 0x00;                 // clear output
      DDRC = 0x03;                  // PC0 and PC1 pins as output
      PORTC = 0x00;                 // both LEDs OFF       
      TCCR0=0x6B;                   // start timer         
    while(1)
        {
            OCR0 = duty;           // PWM with current duty cycle             if(PINA==0xF1)          // if 1st button is pressed            {
             PORTC=PORTC & 0xFD;           // LED1 off
             if(duty<250) duty=duty+20;    // increase duty cycle
             _delay_ms(300);
             if(duty==250) PORTC=PORTC | 0x01;// LED2 ON for max                                                        limit
           }
           else if(PINA==0xF2)     // if 2nd button is pressed
           {
            PORTC = PORTC & 0xFE;         // LED2 off
            if(duty>10) duty=duty-20;     // decrease duty cycle
            _delay_ms(300);
             if(duty==10) PORTC=PORTC | 0x02; // LED1 ON for min                                                       limit
            }
            else if(PINA==0xF4)     // if 3rd button is pressed
            {
            c++;              // alternatively make
            if((c%2)==1) {TCCR0=0x00;PORTB=0x00;}     // PWM OFF                                                                or
            else TCCR0=0x6B;                          // PWM ON
            _delay_ms(300);
             }
         }             
  }

###

 


Circuit Diagrams

Circuit-Diagram-AVR-ATMega32-Based-LED-Bulb-Controller

Project Video


Filed Under: Electronic Projects
Tagged With: avr, LED Bulb
 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What is a loop calibrator? 
  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • What was before microcontrollers ?
  • Measure AC current accurateley (100mA to 10A)
  • 74HC595 creating Fake output
  • NEED HELP FOR OP-AMP IN BGR
  • Check undesired substrate mode...

RSS Electro-Tech-Online.com Discussions

  • Control Bare LCD With ATmega328p
  • Need a ducted soldering fan for solder smoke extraction
  • Sla ir li ion
  • Question about ultrasonic mist maker
  • Best way to reduce voltage in higher wattage system?
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering