Bipolar LED Driver Circuit
In this project, I will show you how a Bipolar LED Driver Circuit can be implemented using 8051 Microcontroller. A Bipolar LED is different from a regular Bi-color LED in the sense that a Bipolar LED has only two leads whereas a regular Bi-color LED has three leads.
- Introduction
- Principle behind Bipolar LED Driver Circuit
- Bipolar LED Driver Circuit Diagram
- Components Required
- Bipolar LED Driver Circuit Design
- Software Part of the Project
- Code
- Working of Bipolar LED Driver Circuit
- Bipolar LED Driver Applications
- Limitations of Bipolar LED Driver Circuit
Introduction
A bi colour LED is a type of LED that comprises of two diodes inside a package that are connected in the opposite way. A bi colour LED typically has three pins: one common pin and two independent pins. If the LED is a common cathode, the common pin can be connected to ground; if it is a common anode, the common pin can be linked to the +5V supply. The Bipolar LED, on the other hand, is a sort of bicolor LED having two terminals.
The device works when one of the terminals receives a positive signal. A positive signal at the green terminal and a negative signal at the red terminal, for example, ensures that the green LED is forward biassed and the red LED is backward biassed in a green and red bi colour LED. The green light will flash as a result of this. The red LED is in the same boat.
If both terminals receive negative signals, neither diode will conduct, and the gadget will remain turned off. If a positive signal is applied to both terminals, a different colour will flash depending on the combination of LED colours.
The following is the image of a red – green Bipolar LED. It looks like a regular LED.
In this project, we are designing a simple bi color LED driver circuit using an 8051 Microcontroller. The LED used here has a forward voltage drop of 2.2V and hence can be biased using a 5V supply. The control is done by the microcontroller program, based on the inputs given from two push buttons.
Principle behind Bipolar LED Driver Circuit
The circuit uses a microcontroller to drive the bipolar LED. The input command is given from the two push buttons and based on the inputs; the microcontroller is configured to send appropriate HIGH or LOW signals to the two output pins. These output pins are connected to the terminals of the bi-polar LED.
Bipolar LED Driver Circuit Diagram
Components Required
- 8051 Microcontroller (AT89C51 is used here)
- Programmer for 8051 Microcontroller
- 11.0592 MHz Crystal
- Capacitors – 2 X 33pF, 10µF
- Resistors – 150Ω, 10KΩ X 2
- Push Buttons X 3
- Bipolar LED (two leads)
- Connecting Wires
- Breadboard
- Power Supply
Bipolar LED Driver Circuit Design
It is a simple circuit and the design mainly involves designing the interfacing of Microcontroller, designing the oscillator and reset circuits for the microcontroller and selection of the LED resistor.
The microcontroller interfacing is accomplished by connecting two push button switches to port P0 Pins P0.6 and P0.7 and connecting the two terminals of bipolar LED to port P0 Pins P0.0 and P0.1.
The oscillator design is done by selecting two 33pF ceramic capacitors in order to provide stability. The clock signal is generated using an 11MHz Crystal Oscillator. The reset circuit is designed by selecting an electrolyte capacitor of 10uF and a resistor of 10K to achieve a reset pulse width of 100ms. The voltage drop across the resistor is kept around 1.2V.
Software Part of the Project
The software part of design involves writing the code for the microcontroller and generating the .hex file. This involves the following steps.
- Create a new project in the Keil µVision IDE window.
- Select the target device for the project. Here, we are using AT89C51 from Atmel (now Microchip).
- Create a new file such that a blank text field appears.
- Write the code using the following algorithm.
- Assign variables to the input and output port.
- Check if one of the inputs is active low.
- In case one of the inputs is at logic low, assign a logic high signal to one of the LED terminals.
- In case none are at logic low, make sure the LED is switched off.
- Save the code with .c extension.
- Add the code to the source folder under target folder.
- Create a Hex file by clicking the ‘Configure Flash Tools’ under ‘Flash’ menu.
Code
#include<reg51.h> | |
sbit red = P0^0; | |
sbit green = P0^1; | |
sbit red_switch = P0^6; | |
sbit green_switch = P0^7; | |
unsigned char i=0; | |
void delay (int); | |
void main() | |
{ | |
red=0; | |
green=0; | |
while(1) | |
{ | |
if(red_switch==0) | |
{ | |
green=0; | |
red=1; | |
while(red_switch==0); | |
} | |
else if(green_switch==0) | |
{ | |
green=1; | |
red=0; | |
while(green_switch==0); | |
} | |
} | |
} |
Working of Bipolar LED Driver Circuit
The microcontroller constantly checks the input pins at port P0 after the circuit is turned on. If the first button (P0.6) is pressed, the microcontroller will receive a low logic signal at the appropriate input pin and will send a high logic signal to pin P0.0 and a low logic signal to pin P0.1. This causes the LED’s red light to glow.
Now when the second button is pressed, the microcontroller will accordingly assign a low logic signal to the pin P0.0 and a high logic signal to pin P0.1. This causes the green light to glow.
The LED stays on until the button is released.
Bipolar LED Driver Applications
- This circuit can be used for indication purposes.
- This circuit can be used at applications where flashing of light is required, as in beacon flashing.
Limitations of Bipolar LED Driver Circuit
- The main limitation of the project is not in terms of the functionality but rather the availability of the Bipolar LEDs.