Sunteți pe pagina 1din 16

Program 01: Interface 4 LED and 4 Push Buttons with 8051(AT89C51)

microcontroller using µVision


Description: In this project 4 led’s and 4 push buttons are connected with 8051 microcontroller. When a
specific push button is pushed to on a specific LED. To implement this project Keil µVisoion and Proteus
8.6 Professional software were used. The program was in written in C Language.

Components:

1. AT89C51 IC (8051 Microcontroller IC)


2. Led Red
3. Push Button

Circuit Diagram:

Program:

#include <reg51.h>

sbit led1 = P1^0;

sbit led2 = P1^1;

sbit led3 = P1^2;

sbit led4 = P1^3;

sbit sw1 = P2^0;

sbit sw2 = P2^1;

sbit sw3 = P2^2;


sbit sw4 = P2^3;

void main(void)

P1 = 0x00;

P2 = 0xff;

while(1)

if(sw1 == 0)

led1 = 1;

if(sw2 == 0)

led2 = 1;

if(sw3 == 0)

led3 = 1;

if(sw4 == 0)

led4 = 1;

led1 = led2 = led3 = led4 = 0;

}
Program 02: Interfacing a 7-Segment with 8051(AT89C51)
microcontroller using µVision
Description: In this project a 7-segment display is connected with 8051 microcontroller to display 0 to 9
on 7-segment with some time delay. To implement this project Keil µVisoion and Proteus 8.6 Professional
software were used. The program was in written in C Language.

Components:

4. AT89C51 IC (8051 Microcontroller IC)


5. 7SEG-COM-ANODE (7 Segment IC)

Circuit Diagram:

Program:

#include <reg51.h>

void main(void)

unsigned char disp[10] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};

unsigned char x;

unsigned int i,j;

P1 = 0x00;

while(1)

for(x=0; x<10; x++)

{
P1 = disp[x];

for(i=0; i<50000; i++) ;

}
Program 03: Interfacing 4 7-Segment with 8051(AT89C51)
microcontroller using µVision
Description: In this project four 7-segment displays is connected with 8051 microcontroller to display a
four digit number on 7-segment. To implement this project Keil µVisoion and Proteus 8.6 Professional
software were used. The program was in written in C Language.

Components:

1. AT89C51 IC (8051 Microcontroller IC)


2. 7SEG-MPX4-CA (IC have four 7 Segment display)

Circuit Diagram:

Program:

#include <reg51.h>

sbit seg1 = P1^0;

sbit seg2 = P1^1;

sbit seg3 = P1^2;

sbit seg4 = P1^3;

unsigned char disp[10] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};

void main(void)

seg1 = seg2 = seg3 = seg4 =0;


while(1)

unsigned int i;

seg1 = 1;

P2 = disp[0]; //0xc0 hex code for digit 0

for(i=0; i<2000; i++) ;

seg1 = 0;

seg2 = 1;

P2 = disp[9]; //0x90 hex code for digit 9

for(i=0; i<2000; i++) ;

seg2 = 0;

seg3 = 1;

P2 = disp[1]; //0xf9 hex code for digit 1

for(i=0; i<2000; i++) ;

seg3 = 0;

seg4 = 1;

P2 = disp[5]; //0x82 hex code for digit 0

for(i=0; i<2000; i++) ;

seg4 = 0;

}
Program 04: LED turn ON/OFF using switch connected by Arduino &
Proteus
Description: In this project a push button and a led is connected to Arduino UNO R3. When push button
is pressed then led should be ON otherwise led should be OFF. To implement this project Arduino IDE and
Proteus 8.6 Professional software were used.

Components:

1. Arduino UNO Board


2. LED
3. Push Button

Circuit Diagram:

Program:

const int buttonPin = 2;

const int ledPin = 13;

int bs = 0;

void setup() {

pinMode(ledPin, OUTPUT);

pinMode(buttonPin, INPUT);

void loop() {

bs = digitalRead(buttonPin);

if(bs == LOW)

{
digitalWrite(ledPin, HIGH);

else

digitalWrite(ledPin, LOW);

}
Program 05: Simulate 3x4 Keypad and LCD 16x2 with arduino in proteus
Description: In this project a 3x4 Keypad and 16x2 LCD are connected to Arduino UNO R3. When push
button on keypad is pressed then that key will be displayed on the LCD. To implement this project Arduino
IDE and Proteus 8.6 Professional software were used.

Components:

1. Arduino UNO Board


2. 3x4 Keypad
3. 16x2 LCD (LM016L)

Circuit Diagram:

Program:

#include <LiquidCrystal.h>

#include <Keypad.h>

const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);


const byte ROWS = 4; //four rows

const byte COLS = 3; //three columns

char keys[ROWS][COLS] = {

{'1','2','3'},

{'4','5','6'},

{'7','8','9'},

{'*','0','#'}

};

byte rowPins[ROWS] = {4, 3, 2, A5}; //connect to the row pinouts of the keypad

byte colPins[COLS] = {7, 6, 5}; //connect to the column pinouts of the keypad

int i=0;

char arr[10];

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){

lcd.begin(16, 2);

lcd.setCursor(0,0);

void loop(){

char key = keypad.getKey();

if(key != NO_KEY)

lcd.print(key);

Program 06: Simulate Street Concept using Light Dependent Resistor


(LDR) with arduino in proteus
Description: In this project a LDR, three green leds and a 16x2 LCD are connected to Arduino UNO R3. The
value of LDR read from A0 pin as analog input and the displayed at LCD. This analog is checked, if it is
greater than 150 then leds should be OFF otherwise leds should be ON. To implement this project Arduino
IDE and Proteus 8.6 Professional software were used.

Components:
1. Arduino UNO Board
2. LEDs
3. LDR
4. LCD

Circuit Diagram:

Program:

// include the library code:

#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin

// with the arduino pin number it is connected to

const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

lcd.print("LDR Out: ");

pinMode(8,OUTPUT);

pinMode(9,OUTPUT);

pinMode(10,OUTPUT);

}
void loop() {

int ldrValue = analogRead(A0);

lcd.setCursor(12, 0);

lcd.print(ldrValue);

if(ldrValue >=200)

digitalWrite(8, LOW);

digitalWrite(9, LOW);

digitalWrite(10, LOW);

else

digitalWrite(8, HIGH);

digitalWrite(9, HIGH);

digitalWrite(10, HIGH);

Program 07: Simulate DC Motors using L293D with arduino in proteus


Description:

Components:

1. Arduino UNO Board


2. DC Motors
3. Push Buttons
4. L293D DC Motor Driver

Circuit Diagram:
Program:

int drection = 0;

void setup() {

pinMode(A0,INPUT);

pinMode(A1, INPUT);

pinMode(7,OUTPUT);

pinMode(6,OUTPUT);

pinMode(5,OUTPUT);

pinMode(4,OUTPUT);

digitalWrite(A0, HIGH);

digitalWrite(A1, HIGH);

void loop() {

if(drection == 0)

digitalWrite(7, HIGH);

digitalWrite(6, LOW);

digitalWrite(5, HIGH);

digitalWrite(4, LOW);
}

else

digitalWrite(7, LOW);

digitalWrite(6, HIGH);

digitalWrite(5, LOW);

digitalWrite(4, HIGH);

delay(1);

if(digitalRead(A0)==LOW)

drection = 0;

delay(1);

if(digitalRead(A1)==LOW)

drection = 1;

delay(1);

Program 08: Simulate Temperature and Humidity DHT11 Sensor with


arduino and proteus
Description: In this project a DHT11 sensor and a LCD 16x2 are connected to Arduino UNO R3. The values
of Temperature and Humidity are read from pin 8 as digital input where DHT11 sensor is connected and
these values are the displayed at LCD. This analog is checked, if it is greater than 150 then leds should be
OFF otherwise leds should be ON. To implement this project Arduino IDE and Proteus 8.6 Professional
software were used.

Components:

1. Arduino UNO Board


2. LEDs
3. LDR
4. LCD

Circuit Diagram:
Program:

#include <LiquidCrystal.h>

#include "DHT.h"

#define DHTPIN 8

#define DHTTYPE DHT11

LiquidCrystal lcd(7,6,5,4,3,2);

DHT dht(DHTPIN, DHTTYPE);

void setup() {

lcd.begin(16,2);

dht.begin();

void loop() {

delay(500);

byte RM = dht.readHumidity();

byte Temp = dht.readTemperature();

if (isnan(RM) || isnan(Temp))

lcd.clear();

lcd.setCursor(5,0);
lcd.print("Error");

return;

lcd.clear();

lcd.setCursor(0,0);

lcd.print("Temperature: ");

lcd.print(Temp);

lcd.setCursor(0,1);

lcd.print("Humidity: ");

lcd.print(RM);

delay(5);

S-ar putea să vă placă și