Download Embedded Control of Solid-State Lighting Systems

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Control system wikipedia , lookup

War of the currents wikipedia , lookup

Transistor wikipedia , lookup

Islanding wikipedia , lookup

Power inverter wikipedia , lookup

Ohm's law wikipedia , lookup

Electrification wikipedia , lookup

Electrical substation wikipedia , lookup

Power engineering wikipedia , lookup

Current source wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Power MOSFET wikipedia , lookup

Rectifier wikipedia , lookup

Voltage regulator wikipedia , lookup

Stray voltage wikipedia , lookup

Electrical ballast wikipedia , lookup

LED lamp wikipedia , lookup

Surge protector wikipedia , lookup

History of electric power transmission wikipedia , lookup

Voltage optimisation wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Mains electricity wikipedia , lookup

Alternating current wikipedia , lookup

Buck converter wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
Embedded Control of SolidState Lighting Systems
Arjuna Madanayake, Post Doctoral Associate
Ganesh Doluweera, Instructor and PhD Candidate
Electrical and Computer Engineering
Schulich School of Engineering
University of Calgary
Overview
•
•
•
•
•
Introduction
Solid State Lighting
Some fundamentals
Basic embedded systems
Putting it all together
The Real-World Engineering Problem: Lighting
Approximately 1.6 billion people, 1/4 of the world’s population,
have no access to electricity and the vast majority live in rural
areas in developing countries (IEA,2004).
• Home lighting is often
associated with electricity
• Those who have no access to
electricity, rely on fuel based
lighting sources
• Eg.: Kerosene wick lamps,
candles etc.
Typical environment inside a
non-electrified home after dark.
• Kerosene lamps are by far the
most common fuel based
lighting source
3
Smoke and fumes
from wick lamps
are a serious health
concern.
Typical kerosene wick lamp, in a village called “Somlavari Thanda” in
Andhra Pradesh, India 14th July 2004
Photo credit: Light Up The World (LUTW), www.lutw.org
4
Homemade
Kerosene
Wick
Lamp
Leye County Village, Guangxi (China, 2005)
Photo credit: LUTW
5
An unsafe way
for achieving
portable light
Accidental
upset
of kerosene
lamps
cause fires
and
burn injuries
Kerosene Bulb Lamp and Bamboo Torch
Knuckles Range, Sri Lanka - June 2002
Photo credit: LUTW
6
Kerosene Lamps
 Expensive
Even with government subsidies kerosene
consumes 10% to 25 % of a villager’s annual
income. ($2-$15 per month)
 Low Levels of Illumination
Reading with kerosene lamps, besides being
unhealthy, is a difficult task and creates a
significant barrier to education.
 Inefficient
The efficacy of a typical kerosene is 0.02 lm/W –
1/500 of an incandescent lamp
 Scarcity and remoteness of suppliers
The burden of physically acquiring kerosene
keeps people away from educational and
productive activities.
7
Environmental and Health Impact
of Kerosene Lamps
VOC  Volatile Organic Compounds
• Eye infections
• Respiratory illnesses
NOx, SOx  Nitrogen and Sulphur Oxides
• Carcinogenic
• Lung and eye infections
• Respiratory illnesses
CO2  Carbon Dioxide
• Global warming
• CO2 emission from
fuel based lighting 244
tCO2/year (3.25 % of
global CO2 emission).
CO  Carbon Monoxide
• Lethal
(Mills, 2002)
8
Introduction to WLED Lighting
• What is a “Solid State Lamp” ?
• What is a White Light Emitting Diode
(WLED) ?
• Why are WLEDs a big deal ?
Solid State Lighting
• Solid state lighting
(SSL) use white light
emitting diodes
(WLED)
• Invented in late 1990s
• WLEDs have gone
through a dramatic
progress since then
Different types of WLEDs
10
Properties of WLEDs
(White Light Emitting Diodes)
• Low Power DC operation – 0.1W - 5W
• Efficient – present state of the art 80 - 100 lm/W
•
Long Life (50,000 + hrs) – virtually a one time capital investment. No
replacement bulbs or components.
•
Physically Robust – LEDs can withstand severe shock and vibration.
•
Reliable & Safe Lighting – LEDs are very much safer and cheaper than
kerosene.
•
Environmentally Friendly – WLEDs, unlike fluorescent tubes, do not
contain mercury, are safer to manufacture and free from end-of-life
problems. LEDs also reduce the amount of wood used for lighting.
11
Solid State Lighting - Trends
Manufacturers’
Expectations
State of the Art
80-100 lm/W
12
SSL Home Lighting Systems
• A typical rural house can be illuminated to an
adequate level using 2-3 WLED and 5W of
electrical generating capacity
• Needs energy generation & storage systems
~5W
• Due to the DC operation - preferred choice for
battery operated systems with RE based home
lighting systems
13
Need for Embedded Control of SSL
Systems
•
By “embedded controls” we mean a
tiny computer and program that
ensures the correct operation of the
SSL lighting system:
1.
To drive the WLEDs at required
voltage and current.
2.
To control energy flow to- and –from
the energy storage device.
3.
To controlling the rate of
consumption of scarce energy by
methods such as lamp dimming and
automatic shutoff when the batteries
are low.
White Light Emitting Diodes
(WLEDs) are awesome !
• Is a promising solution to
lighting requirements of
the future
• Great for solar and wind
power applications
• Lasts way longer than
incandescent bulbs and
CFLs
•Very rugged and
unbreakable (you can
break it if you try hard
enough..)
Some facts about WLEDs
• White light, great for reading and
studying
• Uses a blue light emitting diode
(LED) with a special chemical that
converts blue light to white light
• Needs about 1 Watt (W) of power
• 1W = 3.6 V * 350 mA using P=VI
• To get 1W of power consumption,
we make sure that the WLED
draws about 350 mA of direct
current (DC) and that the voltage
drop across its terminals is about
3.6 Volts.
Blue light
Yellow light from phosphor
From the datasheet of Luxeon III WLED
From Philips Lumileds.
How white light is produced from
blue
How do you measure the light
output from a white LED ?
•
The SI unit for luminous
flux (light) is called
“Lumen”.
•
The device for measuring
the amount of flux from a
lamp such as a WLED is
called an Integrating
Sphere.
•
The “Integrating sphere”
collects the light from the
lamp and measures it using
a sensor called a
“photopic”.
•
Typically, the measured
Lumens is available on a
digital display.
Photo: Advanced Solid State Lighting Laboratory at the Univ. of Calgary
Voltage-Current Behavior of a
WLED
• WLEDs are very similar to
Current
LEDs or diodes when
I (mA)
considering IV-curves.
• A certain minimum voltage is
required before current starts
to pass through a WLED –
this is called the Threshold
Voltage
• For input voltages greater
than the threshold, the
current starts to rapidly
increase (exponentially)
350 mA
1W
Point
VThtreshold
3.6
Terminal Voltage
Volts (V)
Energy Sources For WLED Lamps
•
•
•
•
Energy is scarce and expensive
Solar energy, pico hydro, pedal power
WLEDs lead to efficient lighting
WLEDs can get “More bang for your
bucks”
• But WLEDs are not cheap. But they will be
in the future!
• Huge market opportunities
Energy storage devices
• Storing electrical energy is a very big
problem
• A typical way to store energy is to use a
rechargeable battery
• Batteries can be Lead-acid (Pb-H2SO4),
Nickel Metal Hydride (Ni-MH), or LithiumIon
• A new technology is based on
“Supercapacitors”.
I-V Curve of a WLED
• The first part of
this project
requires you to
find the IV curve
of the WLED
using a Power
Supply,
Voltmeter,
Ammeter,
Variable resistor,
and WLED.
WLEDs
Variable R
DC Power
Supply
Measuring The I-V Curve
•
Basic setup
•
Log both voltage and
current
•
Start from 0 V.
Increase to 4V in 0.1
V steps
5V-12V DC Power Source
Variable resistor
+
0 Amps
WLED
If using Multimeters,
make sure you use the
correct connections when
measuring voltage and
current
V
DC
Voltmeter
A
-
+ ANODE
Milli Ammeter
For measuring
The current through
The WLED
Current
flow
WLED
Is a
2-terminal
device
- CATHODE
WLED Resistance
• DC resistance is defined by
R(V) = V/I and depends on the “bias point”. Bias
point refers to the voltage (V) and current (I)
value the WLED is operated at.
• AC (small-signal) resistance is defined by
R(V) = dV/dI and equal to the reciprocal of the
slope (tangent) of the I-V curve.
Biasing a WLED
• WLED needs a constant current source
(CCS)
• A CCS will adjust it’s output voltage so
that the required current is maintained.
• Our CCS will need to maintain 350 mA
through the WLED.
• Our design will be a simpler, voltage
controller using a method called Pulse
Wide Modulation (PWM).
Pulse Width Modulation (PWM)
• Look at the below square wave
Vo
Tx
Time (s)
T
Period = T,
Frequency = 1/T,
Duty Cycle K = Tx/T
The average value, that is DC value, is simply VAV = VoK
By changing the duty cycle, we can change the average (DC) value
This leads to a method called PWM …
PWM Driver Circuit
• PWM is very cool,
because we can
start with a
constant DC
power supply Vo
and obtain any
DC output voltage
between 0 V and
Vo by simply
changing the Duty
Cycle of a Square
Wave Generator.
DC input
Vo
PWM
Circuit
PWM DC
Output
Square Wave
DC Value
VOUT= VoK
PWM Control
Input sets duty
Cycle K to some fraction
between 0 and 1.
Voltage-Driven WLED
• Using
PWM to
set the
bias point
of a
WLED
WLED
DC input
Vo
PWM
Circuit
PWM DC
Output
Square Wave
DC Value
VOUT= VoK
1W
Point
VOUT
Embedded PWM Circuit
• The main part of our project is the come
up with ways to do PWM using a
microcontroller integrated circuit (IC) and
software control.
• There are many ways to do this, some of
which are quite advanced.
• We will do it the easiest, and simplest way!
• Simple but it works!
Getting Started With Embedded
Systems
• What’s a micro-controller ?
It’s a tiny self-contained computer you can
program in C or BASIC.
It has some input and output pins.
A micro-controller can communicate with other
devices, do measurements of voltages and
currents, and switch circuits on and off.
More on Micro-controllers
• Used extensively in cars, aircrafts, audio
equipment, DVD and CD players, TVs,
washing machines, microwaves, you
name it!
• Very flexible to program.
• Great for controlling various electronic
devices and gadgets.
• Cheap. Small. Reliable.
What Does a Micro-Controller Look
Like ?
Close up view of an INTEL 8742
micro-controller
[Wikipedia
http://en.wikipedia.org/wiki/Microcontroller]
Programming Tools for Microchip
PIC Devices
• We will use a microcontroller called
PIC12F675 from a
company called
“Microchip”.
• We will use a
programming tool from
Microchip called MPLAB ICD2 and a FREE
C-compiler called PICCLite.
• The programming
device needs Windows
XP and a USB port.
• The device driver needs
to be installed before it
can work.
Ask your TA: How can we locate our PIC
Chip on this connector ?
PIC 12F675 Basics
•
•
•
•
Eight Pin Device
Needs a regulated 5V DC power source.
Has internal analog-to-digital (A/D) converters.
An A/D converter can be used to measure a voltage that
is applied to one of the “Analog Input” pins of the chip.
• The measured voltage can be used in your program.
• External circuits and devices can be switched on and off
by setting output pins to logic 1 or 0 within your program,
which shows up on the chip’s pins as 5V and 0V.
• Normally, we will use a transistor as a switch to interface
logic outputs to analog circuits.
Review of Basic Circuit Design
• Transistor as a switch
Vcc
LOAD
Control current
input
Iout= BIin
B = current gain
Iin
Basic circuit
Basic Circuit Design
• Darlington Drive connected to PIC
Vcc
Control current
input
WLED
Iout= B1B2Iin
2N2222
Iin
PIN 2
Of PIC
BDARLINGTON = B1B2 current gain
R
Solar Photo-Voltaics
• The IV Curve of a solar panel:
• Operates like a current-source
in region A and, as a voltagesource in region B
CURRENT
I
ISC
A
• Open circuit voltage is about
19.5V typically, for 12V
systems, and about 9 V for 6V
systems.
B
• Current control is achieved by
connecting a shunt transistor
to create a short-circuit
(Region A)
VOC
V
VOLTAGE
Solar Charge Control
•
•
•
This diode
We use current-shunts for
prevents our
controlling the amount of charge current
flowing into the storage device
shunt from
(battery or supercapacitor).
draining (and
damaging)
the battery!
Setting Vcontrol = HIGH
in software will short-circuit
solar panel through the Darlington
+
transistor.
By setting Vcontrol = HIGH we
can prevent the battery from
overcharging or overheating.
solar
panel
current
shunt
+
Battery
-
LM7805
5V
Voltage
Regulator
Vcontrol
PIC
C HERE !
• We now see how the PIC micro-controller
can be programmed.
• We will use a version of C.
• Alternatives include Assembly language,
machine code, embedded Java, BASIC,
and Matlab.
• We will only go through the basics here.
More advanced coding will require more
detailed coding examples.
Grand order of things in PIC C..
• We will need to follow a
basic format in order
program the PIC microcontroller in C.
• This example to toosimple to work! We will
look at a real example
in the next slide …
#include <pic.h>
void some_function (void)
{
// do something now !!
}
void main (void) // main function
{
// execution starts here.
some_function (); //call function
}
PWM Code - Duty Cycle 75%
#include <pic.h>
Ignore
void main (void)
for now!
{
unsigned int index;
unsigned int dt;
INTCON = 0; // disable interrupts
TRISIO=0;
OSCCAL = _READ_OSCCAL_DATA();
dt=75; // sets duty cycle of PWM wave to 75%
while (1)
{
for (index=0;index<dt;index++) { GPIO=0x20;}
for (index=dt;index<100;index++) { GPIO=0x00;}
}
}
We need this
line to
make the internal
CLOCK
get going at about
2 MHz
These two lines
implement the
PWM algorithm by
setting an output (PIN 2)
high 75% of the time
Accessing the A/D Converter
• Embedded systems rely on the ability of reliably
measure voltage on an external circuit.
• Our PIC micro-controller has an in-built analogto-digital (A/D) converter, which makes
measurement very straightforward.
• We will learn to use the 16-bit A/D converter in
the PIC.
A/D Access in PIC
•
•
•
•
#include <pic.h>
Time to get our hands dirty.
Look at this code !
You can use it in your
projects without modification.
Let’s go through it step-by-step
and see how it works …
unsigned int adc_read (void)
{
unsigned int result;
GODONE=1;
This line
combines two
8-bit words
into a single 16-bit word
while(GODONE);
Value = 256*WHigh+WLow
}
It takes time for the
A/D converter to complete
a conversion.
We wait until the
A/D has gone about it’s
business and has
a value ready for us to use
result=(ADRESH<<8)+ADRESL;
return result;
Embedded Control Algorithms
START
Solar charge control flowchart:
Measure VBattery using
PIC A/D Converter
PV
Shunt
Off
Y
Is
VBattery < 5.8
RETURN
N
PV
Shunt
Off
Example algorithms cont..
•
WLED
intensity
selection
algorithm
Do
{
Vdd = Get_Battery_Voltage_using_A/D_Converter ();
If (Vdd>=4.4) Then DUTY_CYCLE = V_bright / Vdd ;
// full brightness
If (Vdd>4.0) and (Vdd<4.4) Then DUTY_CYCLE = V_dim / Vdd ;
// semi brightness
If (Vdd<=4.0) Then DUTY_CYCLE=0; // Switch off lamp
}
while(1);
Web References
•
http://www.technologystudent.com/pics/pic1.htm
•
http://www.lutw.org