Download MT3 Interfacing light-emitting diodes (LEDs) and push buttons to the

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

Resistor wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Stepper motor wikipedia , lookup

Three-phase electric power wikipedia , lookup

History of electric power transmission wikipedia , lookup

Ground (electricity) wikipedia , lookup

Islanding wikipedia , lookup

Electrical substation wikipedia , lookup

Switch wikipedia , lookup

Transistor wikipedia , lookup

Schmitt trigger wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Mercury-arc valve wikipedia , lookup

Voltage regulator wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Voltage optimisation wikipedia , lookup

Electrical ballast wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

TRIAC wikipedia , lookup

Semiconductor device wikipedia , lookup

Ohm's law wikipedia , lookup

Metadyne wikipedia , lookup

Power MOSFET wikipedia , lookup

Stray voltage wikipedia , lookup

Rectifier wikipedia , lookup

Mains electricity wikipedia , lookup

Alternating current wikipedia , lookup

Surge protector wikipedia , lookup

Current source wikipedia , lookup

Current mirror wikipedia , lookup

Network analysis (electrical circuits) wikipedia , lookup

Buck converter wikipedia , lookup

Diode wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
MT3 Interfacing light-emitting diodes (LEDs) and push buttons to the microcontroller
MT3.1 Interfacing light-emitting diodes (LEDs) to a microcontroller
A light-emitting diode (LED) is a light source which is made out of semiconductor materials. A schematic
diagram of an LED is given in figure below. Its emitter comprises of a semiconductor die. It has a cathode
and an anode. An LED is a diode. Hence, it has nonlinear current-voltage characteristics. Usually a diode
allows an electric current to pass only in one direction. This is known as the diode's forward direction. It
blocks the current in the opposite direction of the diode. This is known as the reverse direction of the
diode. When an LED is connected to a circuit its forward current should not exceed a maximum
allowable limit.
Source: Wikipedia (http://en.wikipedia.org/wiki/Light-emitting_diode)
Some of the optical and electrical characteristics of an LED is given in table below. When interfacing an
LED the forward voltage should be taken into consideration. According to the diode characteristics the
forward voltage should be between 1.8 - 2.2 V. The operation voltage could be selected as any value
within this range. Once the forward voltage of a diode is known the maximum allowable current has to
be determined. This is done using the forward current vs forward voltage graph.
A typical forward current vs forward voltage graph is shown for the diode. It is seen from this graph that
if we select the operating voltage as 1.8 V, the forward current at this voltage is 20 mA. The LED should
be interfaced with the circuit so that the current across the LED does not exceed 20 mA. This is done by
connecting a resistor in series with the LED. This is known as a current limiting resistor.
Calculation of the value of the current limiting resistor for the given LED.
There are two methods for interfacing an LED to a MUNDer board.
Method 1:
In this method the cathode of the LED is connected to the ground. The anode of the LED is connected to
a current limiting resistor. The other end of the resistor is connected to a pin in the MUNDer board. The
LED is blinked by making the pin high (1) and low (0).
Method 2:
In this method the cathode of the LED is connected to a pin in the MUNDer board. The anode of the LED
is connected to a current limiting resistor as before. However the other end of the resistor is connected
a +5 V voltage. The LED is blinked by making the pin high (1) and low (0).
MT3.2 Interfacing push buttons to the microcontroller
Switches are used to make, break or change connections in an electrical circuit. Push button switches
are usually spring loaded so it returns the moving element to the original position when the pushing
force is removed. There two types of push buttons. These are namely normally open and normally
closed types.
A “normally open” push button is shown in figure below. It is in open circuit when it is not pressed.
A “normally closed” push button is shown in figure below. It is in short circuit when it is not pressed.
Interfacing a “Normally Open" Push Button
Interfacing a “Normally Closed" Push Button
Switch Bounce
When the switch is closed or opened, the switch contacts bounces against each other before settling.
Sometimes the microcontroller picks this up as bouncing noise. This could lead to undesirable
conditions. For example the microcontroller may receive multiple triggers even when the button is
pressed only once. The simplest way to correct this is by adding a time delay in the code after each
initial button press so that the switch contacts settle down.
In the above figure it shows the undesirable effects due to switch bouce. It has multiple triggers even if
the push button is pressed only once. So by considering a time delay between the high and low states of
the logic this problem could be overcome.