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.
Outline
- 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-color LED is a specific type of LED containing two diodes within a single package, and these diodes are connected in opposite directions. Typically, a bi-color LED has three pins: one common pin and two separate pins. In the case of a common cathode LED, the common pin can be connected to the ground, while for a common anode LED, the common pin can be linked to a +5V power supply. On the other hand, a Bipolar LED is a variation of a bi-color LED that has only two terminals.
The functionality of these devices comes into play when one of the terminals receives a positive signal. For instance, in a red-green bi-color LED, when a positive signal is applied to the green terminal and a negative signal to the red terminal, it results in the green LED being forward-biased while the red LED is reverse-biased. Consequently, the green light will illuminate. The red LED behaves similarly.
If both terminals receive negative signals, neither diode conducts, and the device remains off. However, if a positive signal is applied to both terminals, a different color will appear depending on the combination of LED colors.
Shown below is an image of a red-green Bipolar LED, which outwardly resembles a standard 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
In this circuit, a microcontroller is employed to control the Bipolar LED. Input commands are generated via two push buttons, and depending on these inputs, the microcontroller is programmed to transmit either HIGH or LOW signals to the two output pins. These output pins are subsequently linked to the terminals of the Bipolar 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
The circuit is straightforward in its design, primarily focusing on three key aspects: Microcontroller interfacing, oscillator design, and LED resistor selection.
Microcontroller interfacing involves connecting two push button switches to Port P0 Pins P0.6 and P0.7, as well as linking the terminals of the Bipolar LED to Port P0 Pins P0.0 and P0.1.
For the oscillator design, stability is ensured by choosing two 33pF ceramic capacitors. The clock signal is generated using an 11MHz Crystal Oscillator.
In terms of the reset circuit, it is fashioned by selecting a 10uF electrolytic capacitor and a 10K resistor to achieve a reset pulse width of 100ms. This configuration also maintains a voltage drop of approximately 1.2V across the resistor.
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
Upon circuit activation, the microcontroller continuously monitors the input pins on Port P0. If the first button (connected to P0.6) is pressed, the microcontroller detects a low logic signal at the corresponding input pin. Subsequently, it sends a high logic signal to pin P0.0 while maintaining a low logic signal on pin P0.1. As a result, the red light of the LED illuminates.
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.