Docstoc

IR Remote Lamp Dimmer

Document Sample
IR Remote Lamp Dimmer Powered By Docstoc
					IR Remote Lamp Controller
          Thomas Chia
       Project Description
  Western Washington University
        2006-2007
Introduction

The IR remote control has become a family room staple since its commercial production in the

1950’s. From televisions to cable boxes, people instinctively reach for the remote for the

operation of these devices because of its added convenience and efficiency. But one device

found in the living room that is still controlled manually is the light source. Therefore the

proposed project is an IR remote lamp controller unit. A standard lamp using an incandescent

light bulb can be plugged into the unit and the unit will then plug into the wall outlet. The user

will then be able to turn the lamp on and off, control its brightness and set a sleep timer with a

standard IR remote. In the idle state the unit will display the time since it must be in plane sight

of the user. This unit should add another level of convenience to the family room that is long

overdue.


Functional Description

A preliminary sketch of the unit is shown in figure 1. As can be seen from figure 1 the unit will

at least be able to be housed in an eight-inch long, five-inch wide and four-inch tall box. As

mentioned above the lamp will plug into the unit and the unit will have a cord feeding to the AC

main. Figure 2 shows the back view of the unit showing these power cord connections. From

the IR remote, the unit will only respond to volume up/down, power, and sleep commands; all

other commands will be ignored. The unit should be placed in a location with a clear line of

sight to the user since it will display the current time when idle and can be controlled via an IR

remote.




                                                  1
To Wall Outlet                                               From Lamp
                                      8 inches




                              7 Segment
           4 inches           Display                      IR Reciever

                                                                5 inches
            On/Off
                                                           Clock Set
                                          Sleep Function
                      Brighter/Dimmer
                      (Hours)/(Minutes)

 Figure 1. Preliminary sketch of the IR Remote Lamp Controller with maximum
           housing dimensions




   Lamp
   Cord
   Input

                                                                  To AC
                                                                  Main



  Figure 2, Back view of the IR Remote Lamp Controller




                                                 2
Hardware Description

The project will be implemented using the MC9S12C32 microcontroller. This microcontroller

was primarily chosen because of its availability and familiarity. With 32Kbytes of flash and

2Kbytes of RAM, it should provide ample room for software development; though designing the

code for portability and efficiency will still be a top priority. The seven segment display will be

implemented using the SPI. Figure 5 shows a functional block diagram of the project.




     Earth Ground                                                                      Neutral
                                    Hot
                                                   AC Main
                                                                     Hot
                          Neutral



                                          32K Flash          PT0           Dimmer                 Lamp
                                                                           Circuitry
                                          2K RAM             PT2
                                                                           Zero- Crossing
                                                                           Detection
                                                                           Circuitry
                    IR                    PT1
                    Receiver                                 AN00-
                                                             AN04           5 Push
                                                                            Buttons
                                                MC9S12C128
                                                                           7-Segment
                                                                           Display

                    AC to DC              VDD                              LED
                    Power                 VSS                SPI           Driver
                    Supply                                                                       Real Time
                                                             XTAL                                Clock
                                                                           8MHz
                                                                           XTAL




                                                      3
Figure 5. Functional block diagram

IR Receiver

As can be seen from figure 5 the IR receiver module will be connected to port T bit 0.

The output of the IR receiver module will be in digital form ready to be processed by the MCU.

There are many coding protocols for IR remote controls depending on the company. I will use

the RC5 protocol from Phillips. I chose this protocol because it is one of the older and more

widely used IR protocols. The RC5 protocol modulates a carrier frequency of 36MHZ in what is

known as bi-phase coding. Figure 6 illustrates this protocol. As can be seen, bi-phase coding

has a constant bit length and a 50% duty cycle. The second part of the bit represents the logical

“1” or “0”. The first two bits are the start bits and are always high. The third bit is a toggle bit,

which only changes if a button was pressed and released, thus holding a key down will only

execute the command once. The next 5 bit lengths are the address and the last 6 bit lengths are

the command. I will use the TV2 address for the receiver since there is a sleep button on most

television remotes, which can be used for the sleep command for the project.




Figure 6. The RC5 protocol


                                                  4
Lamp Dimmer

The lamp dimmer functionality will be implemented using a triac to control the conduction angle

of the lamp. A normal lamp’s conduction angle is 180° for half of the 60Hz AC waveform, so it

conducts all the time. By making the conduction angle smaller the average power supplied is

smaller, thus the amount of light the light bulb emits will also be less. The MCU can be

synchronized to the AC line whenever the voltage a across the triac is zero. This

synchronization will be accomplished by polling PTAD0 (which will be connected to the AC

main via a zero-detection circuit) for a voltage that falls within a specified range of zero.


Power

The MCU will be powered via the AC line though a voltage regulator circuit that will provide a

regulated 5V DC power supply. This circuit will consist of a step down transformer, bridge

rectifier, smoothing capacitors and a 5V voltage regulator IC.

        The dimmer circuitry and thus the lamp will be powered directly by the AC mains. The

maximum voltage to the lamp will be a little less then the full 120VAC since it will be powered

through the traic. The max current for the MCU and its peripherals is estimated to be about

268mA, and for a 60W incandescent light bulb the max current is about 785.4mA. This gives a

total system max current of about 1.05A.


Seven-Segment Display

The seven-segment display will be a 4 digit clock driven by an LED diver. The LED driver is

controlled using the SPI.




                                                  5
Software

There will be four major software components to this project. The first is interpreting the IR

signals using the RC5 protocol mentioned above. The second will be the dimming control of the

lamp using the triac. The third will be implementing the real time clock. The fourth will be the

seven-segment display module. These modules will be written in C and assembly using the

UCOS-II kernel and its modules.


User Interface

In idle mode the unit will display the current time on the seven-segment display (figure 3).

When either the brightness “up” or “down” command is received either from an IR remote or

from the manual inputs the display will change showing the numerical value of the brightness

level (figure 4). The brightness level ranges from 1 to 20. The intention is to emulate

controlling the brightness of the lamp like controlling the volume of a television. If no inputs are

detected for two seconds the unit will return to the idle state displaying the current time.




Figure 3. Display of the current time



                                                  6
       Figure 4. Display of brightness level “10”



       The sleep function is also very much like the sleep function on a television. If the “sleep”

command is received either via the IR remote or manually, the display will show SPX, with X

corresponding the sleep duration (figures 5-8). If no input is detected for three seconds, the

displayed sleep duration will be accepted and the unit will return to the idle state. If the sleep

command is detected before the three seconds then the next sleep duration will be displayed. In

this way the user can select a sleep duration time by cycling though the sleep duration time

displays. The sleep duration displays will be SP15, SP30, SP45, SP1h, OFF and NULL. The

first five displays correspond to 15, 30, 45, minutes, 1 hour and sleep off respectively. The

NULL doesn’t do anything, meaning that if a sleep timer is already running and the sleep

command is received, there is a way to get out of the cycle without resetting the sleep timer.

Figures 5-10 shows all of these sleep displays.




                                                  7
Figure 5. Display of “SP15” indicating sleep timer will be set to15 minutes




Figure 6. Display of “SP30” indicating sleep timer will be set to 30 minutes




                                               8
Figure 7. Display of “SP30” indicating sleep timer will be set to 45 minutes




Figure 8. Display of “SP1h” indicating sleep timer will be set to 1 hour




                                               9
Figure 9. Display of “OFF” indicating that the sleep timer will be turned off




Figure 10. Display of “cont” indicating that the current state of the sleep timer will not be
           effected.


       Setting the clock is very much like setting the clock on a digital alarm, and can only be

done manually. The user must hold down the “set clock” button to set the time using the “up”

and “down” buttons. Holding down the “set clock” button will have no effect on the current


                                                10
display. The “up” button controls the hour and the “down” button controls the minutes. For

clarity these secondary commands will be labeled on the unit as well. A state diagram of the unit

is shown in figure 4.




                                        Hour or Minutes
                                                                                                 *Note- Inputs an be
             All other inputs                                                                    from the IR remote
                                                                                                 or from manual
                                                                                                 inputs
                                      Clock
                                      set                         Clock Set Depressed

                                                                                                                Up or Down
       Reset                     Clock Set Released

                                                                                      2 seconds
                                                                                      no input
                                                                                                         Light
                                                                  Idle
                                                                                   Up or Down            Intensity
                                      Sleep

                                              3 seconds
 All other inputs                             no input                                                     All other inputs
                           Sleep 15

               Sleep


 All other                       3 seconds
 inputs        Sleep 30          no input



                                                                                                                           Sleep
               Sleep
                                      3 seconds
                                      no input       3 seconds
                                                     no input                   3 seconds
               Sleep 45                                                         no input            3 seconds
                                                                                                    no input
                                        Sleep 1
                         Sleep          hour
                                                                         OFF                               Null
      All other inputs                                    Sleep                             Sleep


                                 All other inputs
                                                                              All other inputs                  All other inputs



Figure 4. State diagram




                                                                         11
Development Plan

The project will mainly be developed using resources of the EET lab, ET340 at Western

Washington University. The software will be written using the CodeWright code editing

software and tested using the Noral debugging system provided in the lab. Hardware

construction and testing will be done primarily in the lab. The primary equipment used will be a

digital multi-meter, dual trace oscilloscope, programmable power supply, and an IR remote.

Since this is a prototype it will first be constructed using a solderless breadboard to save time and

to also reduce the risk of shorting something out. The testing of the circuit using the AC main

will be done by encapsulating the circuitry to prevent accidental contact with the live wires, and

under the supervision of either professors Frank David Harris, Todd Morton, or Thomas Grady.

Once operation is confirmed if time permits, a printed circuit board may be pursued.

Construction of the housing will also be delayed until after the operation of the unit is confirmed,

but it will be designed to fit within the maximum specified parameters of the box described

above. Obtaining the necessary components isn’t expected to be a problem since they are fairly

common. The longest lead-time for part is the IR receiver, which is 2 weeks.

For demonstration I would need an IR remote controller and a lamp, both of which I already

own. I will also make a PowerPoint presentation explaining my project in more detail.




                                                 12
The following is a weekly development schedule for the last weeks of Winter quarter and of

Spring quarter of 2007.


Week 9 (Winter)           Refine Project Description
Week 10 (Winter)          Order Parts
Spring Break              Research/Work on Housing
Week 1                    Assemble Hardware/Hardware Description
Week 2                    Test Hardware/Start IR demodulating module
Week 3                    Test/Finish IR demodulating module
Week 4                    Dimmer Software/Test
Week 5                    Display Module
Week 6                    Real time Clock Module
Week 7                    Main program
Week 8                    Put it all together/Testing
Week 9                    Testing/Housing Construction (If have time)
June 7, 2007              Demonstrations



Electrical Specifications

Power Source: 120VAC Main

Worst Case Power Dissipation (Unit): 268mA

Outlet Max Current (w/60W light bulb): 1.05A

Outlet Type: Three prong

Operating Temperature Range: 40°F-120°F

Time Accuracy: 4 seconds/6 months

Brightness Steps: 1-20

Sleep Time Durations: 15 minutes, 30 minutes, 45 minutes, 1hour

IR Protocol: RC5

IR Remote Commands: Volume Up/Down, Power, Sleep




                                               13
Preliminary Parts List


Part Name      Part Number Source           Lead        Power       Quantity   Cost($)
               /Value                       Time        Dissipation
MCU            MC9S12C32 Todd               On Hand     35mA        1          11.28
                           Morton
IR Receiver    TSOP1836    Electronic       1-2 weeks   1.5mA       1          1.15
                           Goldmine
Resistor       470Ω        EET              On Hand     5mA         1          .15
Resistor       470KΩ       EET              On Hand     50mA        4          .60
Resistor       100Ω        EET              On Hand     10mA        1          .15
Resistor       10KΩ        EET              On Hand     15mA        1          .15
Capacitor      4.7uf       Electronic       1-2 weeks   ~0mA        1          1.00
                           Goldmine
Electrolytic   470uf/22V   Electronic       1-2 weeks   ~0mA        1          1.00
Capacitor                  Goldmine
Capacitor      .1uf        EET              1-2 weeks   ~0mA        1          .50
Capacitor      1uf/600V    Tedss            1-2 weeks   ~0mA        2          10.00
7 Segment      MAX6954     Maxim            1-2 weeks   30mA        1          5.26
LED Driver
Electrical     N/A            On Hand       On Hand     N/A         2          6.99
Chord
Diode          1n4007         Electronic    1-2 weeks   2.5mA       4          2.00
                              Goldmine
Zener          5V1/.5W        Cascade       1-2 weeks   1ma         1          .25
Diode          1N473          Surplus
                              Electronics
Triac          BTA 16-        Electronic    1-2 weeks   10mA        1          1.00
               6006BW         Goldmine
XTAL           32.7Mhz        Digikey       1 week      15mA        1          2.54
Real Time      DS1305-ND      Digikey       2 weeks     15mA        1          5.06
Clock Chip
Seven          .8 inch        All           1 week      80mA        4          2.20
Segment        single digit   Electronics
Display                       Corp
Bridge         2A/30V         Digikey       1 week      2.5mA       1          2.50
Rectifier
5V Voltage     LM7805         Digikey       2 weeks     1mA         1          2.04
Regulator
Transformer    120/25.2V      Digikey       2 weeks     N/A         1          10.75
               AC/2 Amp
Wall outlet    Standard       Lowes         Immediate N/A           1          5.99
Totals                                                268.5ma                  $87.41




                                              14
15
16

				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:323
posted:2/13/2010
language:English
pages:17