22

Click here to load reader

IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

  • Upload
    ngophuc

  • View
    218

  • Download
    6

Embed Size (px)

Citation preview

Page 1: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

IR Remote Lamp Controller

Thomas ChiaProject Description

Western Washington University2006-2007

Page 2: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

Page 3: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

IR Reciever4 inches

5 inches

8 inchesFrom Lamp

2

7 Segment Display

To Wall Outlet

On/Off

Sleep FunctionBrighter/Dimmer(Hours)/(Minutes)

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

Clock Set

Page 4: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

Figure 2, Back view of the IR Remote Lamp Controller

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.

Lamp Cord Input

To AC Main

3

Page 5: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

32K Flash

XTAL

2K RAM

SPI

MC9S12C128

PT1

PT0

VDDVSS

AN00-AN04

AC to DC Power Supply

IR Receiver

Dimmer Circuitry

5 Push Buttons

LED Driver

8MHz XTAL

Lamp

AC Main

PT2Zero- Crossing Detection Circuitry

7-Segment Display

Real Time Clock

Neutral

NeutralHot

HotEarth Ground

4

Page 6: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

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

5

Page 7: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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.

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.

6

Page 8: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

7

Page 9: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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.

8

Page 10: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

9

Page 11: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

10

Page 12: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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

11

Page 13: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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.

Figure 4. State diagram

Idle

Sleep 15

Sleep 30

Sleep 45

Sleep 1 hour OFF Null

Light Intensity

Sleep

Sleep

Sleep

Sleep

Sleep Sleep

Sleep

3 seconds no input

3 seconds no input

3 seconds no input

3 seconds no input

3 seconds no input

3 seconds no input

2 seconds no input

Up or Down

Up or Down

All other inputs

All other inputsAll other inputsAll other inputs

All other inputs

All other inputs

Clock set

Hour or MinutesAll other inputs

Clock Set Depressed

Clock Set ReleasedReset

*Note- Inputs an be from the IR remote or from manual inputs

All other inputs

12

Page 14: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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.

13

Page 15: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

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 DescriptionWeek 10 (Winter) Order PartsSpring Break Research/Work on HousingWeek 1 Assemble Hardware/Hardware DescriptionWeek 2 Test Hardware/Start IR demodulating moduleWeek 3 Test/Finish IR demodulating moduleWeek 4 Dimmer Software/TestWeek 5 Display ModuleWeek 6 Real time Clock ModuleWeek 7 Main programWeek 8 Put it all together/TestingWeek 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

14

Page 16: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

Preliminary Parts List

Part Name Part Number/Value

Source Lead Time

Power Dissipation

Quantity Cost($)

MCU MC9S12C32 Todd Morton

On Hand 35mA 1 11.28

IR Receiver TSOP1836 Electronic Goldmine

1-2 weeks 1.5mA 1 1.15

Resistor 470Ω EET On Hand 5mA 1 .15Resistor 470KΩ EET On Hand 50mA 4 .60Resistor 100Ω EET On Hand 10mA 1 .15Resistor 10KΩ EET On Hand 15mA 1 .15Capacitor 4.7uf Electronic

Goldmine1-2 weeks ~0mA 1 1.00

Electrolytic Capacitor

470uf/22V Electronic Goldmine

1-2 weeks ~0mA 1 1.00

Capacitor .1uf EET 1-2 weeks ~0mA 1 .50Capacitor 1uf/600V Tedss 1-2 weeks ~0mA 2 10.007 Segment LED Driver

MAX6954 Maxim 1-2 weeks 30mA 1 5.26

Electrical Chord

N/A On Hand On Hand N/A 2 6.99

Diode 1n4007 Electronic Goldmine

1-2 weeks 2.5mA 4 2.00

Zener Diode

5V1/.5W1N473

Cascade Surplus Electronics

1-2 weeks 1ma 1 .25

Triac BTA 16-6006BW

Electronic Goldmine

1-2 weeks 10mA 1 1.00

XTAL 32.7Mhz Digikey 1 week 15mA 1 2.54Real Time Clock Chip

DS1305-ND Digikey 2 weeks 15mA 1 5.06

Seven Segment Display

.8 inch single digit

All Electronics Corp

1 week 80mA 4 2.20

Bridge Rectifier

2A/30V Digikey 1 week 2.5mA 1 2.50

5V Voltage Regulator

LM7805 Digikey 2 weeks 1mA 1 2.04

Transformer 120/25.2V AC/2 Amp

Digikey 2 weeks N/A 1 10.75

Wall outlet Standard Lowes Immediate N/A 1 5.99Totals 268.5ma $87.41

15

Page 17: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

16

Page 18: IR Remote Lamp Dimmer - Western Washington …eet.etec.wwu.edu/chiat/project/Docs/IR Remote Lamp Dimmer... · Web viewThe IR remote control has become a family room staple since its

17