Build Bipolar LED Driver Circuit Using 8051 Microcontroller

In this project, I will show you how to implement a Bipolar LED driver using 8051 microcontroller. A Bipolar LED is totally different from a regular Bi-colour LED. A regular Bi-colour LED has three leads whereas a Bipolar LED has only two leads.

What is a Bi-Colour LED?

A Bi-color LED is a special type of LED which consists of two diodes connected in inverse biased to each other inside a package. A bi-colour LED generally consists of three terminals (a common pin and two separate pins). The common pin can be connected to ground if it is a common cathode LED or connected to +5V supply if it is a common anode. However, there is another type of bi-colour LED with two terminals called the Bipolar LED.

The device functions as per the positive signal given to one of the terminals. For instance, for a green and red bi-colour LED, a positive signal at the green terminal and negative signal at red terminal ensures the green LED to be forward biased and red LED to be reverse biased. This happens the green light to glow. Also the same for the red LED.

However, if both the terminals are given negative signals, neither of the diodes would conduct and the LED would remain off. If a positive signal is applied to both the terminals, a different colour, based on the combination of the LED colours, would glow.

The following is the image of a red – green Bipolar LED.

In this project, we are establishing a simple Bipolar 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 8051 microcontroller, based on the inputs given from two push buttons.

Must Read Automatic Emergency Light

Principle of Bipolar LED Driver

The circuit uses here an 8051 microcontroller to drive the bipolar LED. The input command is given from the two pushbuttons and based on the inputs; while 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 bipolar LED respectively.

Circuit Diagram

led driver

Components Required

  • 8051 Microcontroller (AT89C51)
  • Programmer for 8051 Microcontroller
  • 11.0592 MHz Crystal
  • Capacitors (33pF, 10µF/25V)
  • Resistors (150Ω, 10KΩ)
  • Push Buttons
  • Bipolar LED
  • Connecting Wires
  • Breadboard
  • 5V Power Supply

Circuit Connection

First we need to connect the infrared transmitter in series with a 220 Ω resistor as follows. The cathode(+) of the led to the plus, and the anode(-) of the led with resistance and the resistance to ground.

Next, we will connect the receiver in reverse biased mode and in parallel with the transmitter. The anode(-) will be connected to plus and the cathode(+) in series with the 10 KΩ resistance and the resistance to the ground.

At the point when the infrared sensor doesn’t capture infrared radiation, it has an extremely high internal resistance and the output voltage will be little. Also, when it begins to capture the radiation, its internal resistance will be exceptionally low and the output voltage will get higher.

At this point, the sensor is functioning and we will add a 1 KΩ resistance in series with led. The resistor is connected to pin 1 and in series with the led that is grounded.

Software for The Microcontroller

The following steps for the microcontroller is below.

  • Create a new project in the Keil µVision IDE window
  • Select the target device for the project. Here, we are using AT89C51 from Atmel
  • 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 the target folder
  • Create a Hex file by clicking the ‘Configure Flash Tools’ under the ‘Flash’ menu

Working of Bipolar LED Driver

When the whole circuit is switched on, the microcontroller continuously scans the input pins at port P0. Suppose the first button (P0.6) is pressed, the microcontroller receives a low logic signal at the corresponding input pin. Accordingly it assigns a high logic signal to pin P0.0 and low logic signal to pin P0.1. This happens the red LED 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 happens the green LED to glow.

The LED stays on until the button is released.

Must read 230v LED Driver Circuit

Microcontroller 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);
		}
	}
}

Application of Bipolar LED Driver

  • This circuit can be used for indication purposes.
  • This circuit can be used at applications where flashing of light is required, as in case of police or ambulance siren light.

Leave a comment