Interfacing 433MHz RF Modules with 8051 Microcontroller

Hello Friends Today I am going to show you how to use a 433MHz RF module in your 8051 Projects. The 433MHz RF module is one of the cheapest ways of wireless communication other than IR that you can use in your 8051 projects.There is a receiving and Transmitting module that we will need. You can easily find them online for3-4$(150-200 Indian Rs).

Components required

  • Microcontroller (P89V51RD2) (2)
  • Resistor 10K (1)
  • Capacitor 33pF (2)
  • Capacitor 10uF (1)
  • 11.0592MHz Crystal (1)
  • 433MHz RF Transmitter (1)
  • 433MHz RF Receiver (1)
  • Buzzer(optional) (1)

Circuit Diagram and Description

Receiving circuit
Receiving circuit
Transmitting Circuit
Transmitting Circuit

Connections of the Transmitter Module:

The smaller module of the two with a crystal on it is the Transmitter module. The Pin connections for the module are as below

Pin on Module            Connection

GND               GND on 8051 Board

DATA             P3.1 on 8051 Board

Vcc                  Vcc on 8051 Board

ANT                Connected to 17.25cm long wire

Connections for the Receiver Module:

The Larger module of the two is the Receiver module.The Module has multiple GND and Vcc pins which need to be connected externally. The Pin connections for the module are as below

Pin on Module            Connection

GND              GND on 8051 Board

DATA            P3.0 on 8051 Board

Vcc                 Vcc on 8051 Board

ANT               Connected to 17.25cm long wire

About the Program

In this particular program, we are using UART to transmit 8-bit data over the RF module. The data pin of the transmit module is connected to the transmit pin of the 8051. When the Switch 4 is pressed on the 8051 Board then the ASCII value of character t is sent over the RFmodule.If this is received at the receiving 8051 then the Buzzer will turn on for 5 Seconds.

Download: Click here to download the C, Assembly and Hex file.

This article is written by Aditya Wani.

I hope you liked this microcontroller project. If you have any queries feel free to ask in the comment section below. Like our facebook page and subscribe to our newsletter for future updates. Hava a nice day!

Digital clock using 8051 microcontroller & LCD display – mini project

Hello friends, today we are going to make a simple digital clock using 8051 microcontroller which you can make as your engineering mini-project. In this mini project we are using one 8051 family based microcontroller, one 16×2 LCD display and one 4×4 keyboard for settling the time.

Components required:

For making simple digital clock using microcontroller you will require following components:

Sr. no. Component Quantity
1 Microcontroller (P89V51RD2) 1
2 LCD display (16×2) 1
3 4×4 keyboard 1
4 Resistor 10K 1
5 Capacitor 33pF 2
6 Capacitor 10uF 1
7 12MHz Crystal 1

Circuit diagram:

A circuit diagram for simple digital clock using 8051 microcontroller is shown below:

digital clock using 8051 microcontroller and LCD display

Circuit building:

Connect the 4×4 keypad with port 1 of microcontroller. Connect 16×2 LCD display with port 2 of microcontroller (make sure that all the data pins of LCD display are connected to the microcontroller correctly). The rs (register set) pin of  LCD is connected to pin 3.5 (pin number: 15) and en (enable) pin is connected to pin 3.6 (pin number 16) of microcontroller. Connect crystal to pin 18 and 19 of micro controller. We are using 12MHz frequency Crystal. For reset circuitry connect a push button to pin 9 of micro controller. We can also use a potentiometer to adjust the contrast of LCD.

Pin description of LCD display:

lcd pin diagram

Pin number Name Description
1 Vss Ground
2 Vdd +5V
3 Vee Contrast Adjustment ‐2V to ‐5V
4 RS Register Select
5 RW 1 ‐Read , 0‐Write
6 E Enable Strobe
7 D0 Data Line
8 D1 Data Line
9 D2 Data Line
10 D3 Data Line
11 D4 Data Line
12 D5 Data Line
13 D6 Data Line
14 D7 Data Line
15 LED+ Backlit LED +V Vdd (Optional signal)
16 LED- Backlit LED +V Vdd (Optionalsignal)

Download:

You can download C program and HEX file for this mini project using following link.

Download

You may also like:

I hope you liked this microcontroller project. Share it with your friends and like our facebook page to keep in touch with us. Have a nice day!

Digital Thermometer using 8051 Microcontroller: Mini Project

Today we are going to make a simple mini-project using 8051 microcontroller. A digital thermometer using 8051 microcontroller. A thermometer is a device that measures temperature or temperature gradient using a variety of different principles. Let us see how to make Digital Thermometer using 8051 microcontroller.

Digital Thermometer using 8051 Microconroller

Components required:

  • 8051 microcontroller (like AT89c51, 89C51RD2, etc.)
  • ADC0804
  • LM35 temperature sensor
  • Resistors, Potentiometer, etc.

Circuit diagram:

Digital Thermometer using 8051 Microcontroller
digital thermometer using 8051 microcontroller

Working of Digital Thermometer:

The output of digital thermometer is in Celsius scale. To display the output i.e. the temperature we have used a 16*2 LCD display. LM 35 is temperature sensor IC which is used to sense the temperature. Normally LM35 generates a 10mV change in output voltage per degree celsius change in temperature. This temperature is then converted into Celcius scale using analog to digital converter i.e. ADC0804.

LM 35 Temperature sensor:

LM 35 Pin diagram
LM 35 Pin diagram

Specifications of LM 35 temperature sensor IC are as follows:

  • Accuracy of LM35 is +-0.5 degree celsius.
  • Its temperature range is from -55 to 150 degree celsius.
  • Sensor gain = 10 (mV/Deg C)
  • Output impedance = 0.4 Ohm
  • Supply Voltage (Min) = 4V
  • Supply voltage (Max) = 30V

Applications of Digital Thermometer:

  1. Thermometers are used in a wide variety of scientific and engineering applications, especially measurement systems.
  2. Digital thermometers can be used in roadways in cold weather climates to check if icing condition exists or not.

Download C program and proteus simulation file by using below link

Digital Thermometer

You may also like:

I hope you like this Digital Thermometer Mini Project. Please subscribe to our newsletter and like our facebook page for future updates. Have a nice day!

Digital stopwatch using 8051 microcontroller mini project

In this mini-project we are going to make a simple Digital Stopwatch by using a Microcontroller from 8051 family. Digital Stopwatch allows you to record the exact number of hours and minutes you worked on a task/activity. It is a special type of watch with buttons that start, stop, and then zero the hands, used to time races.

Digital Stopwatch using 8051 Microcontroller

Components required:

  • 8051 Microcontroller (89C51)
  • Resistor – 10K
  • Capacitor – 10uF, 33pF (two)
  • Crystal oscillator – 12MHz
  • LCD display.

Circuit diagram:

Digital Stopwatch using 8051 Microcontroller
Digital stopwatch using 8051 microcontroller

Pin description of LCD display:

lcd pin diagram
lcd pin diagram
Pinnumber Name Description
1 Vss Ground
2 Vdd +5V
3 Vee Contrast Adjustment ‐2V to ‐5V
4 RS Register Select
5 RW 1 ‐Read , 0‐Write
6 E Enable Strobe
7 D0 Data Line
8 D1 Data Line
9 D2 Data Line
10 D3 Data Line
11 D4 Data Line
12 D5 Data Line
13 D6 Data Line
14 D7 Data Line
15 LED+ Backlit LED +V Vdd (Optional signal)
16 LED- Backlit LED +V Vdd (Optionalsignal)

C program:

// ************************************************
// Project:   Digital Stopwatch using 8051 microcontroller
// Author:    Mayuresh Joshi
// Blog: myclassbook.org
// ************************************************
#include<reg51.h>
//Function declarations
void cct_init(void);
void delay(int);
void lcdinit(void);
void WriteCommandToLCD(int);
void WriteDataToLCD(char);
void ClearLCDScreen(void);
void InitTimer0(void);
void UpdateTimeCounters(void);
void DisplayTimeToLCD(unsigned int,unsigned int,unsigned int);
//*******************
//Pin description
/*
P2.4 to P2.7 is data bus
P1.0 is RS
P1.1 is E
*/
//********************
// Defines Pins
sbit RS = P1^0;
sbit E  = P1^1;
// Define Clock variables
unsigned int usecCounter = 0;
unsigned int msCounter   = 0;
unsigned int secCounter  = 0;
unsigned int minCounter  = 0;
unsigned int hrCounter   = 0;
// ***********************************************************
// Main program
//
void main(void)
{
cct_init();             // Make all ports zero
lcdinit();              // Initilize LCD
InitTimer0();           // Start Timer0
while(1)
{
if( msCounter == 0 )                                       // msCounter becomes zero after exact one sec
{
DisplayTimeToLCD(hrCounter, minCounter, secCounter);   // Displays time in HH:MM:SS format
}
UpdateTimeCounters();                                      // Update sec, min, hours counters
}
}
void cct_init(void)
{
P0 = 0x00;   //not used
P1 = 0x00;   //not used
P2 = 0x00;   //used as data port
P3 = 0x00;   //used for generating E and RS
}
void InitTimer0(void)
{
TMOD &= 0xF0;    // Clear 4bit field for timer0
TMOD |= 0x02;    // Set timer0 in mode 2
TH0 = 0x05;      // 250 usec reloading time
TL0 = 0x05;      // First time value
ET0 = 1;         // Enable Timer0 interrupts
EA  = 1;         // Global interrupt enable
TR0 = 1;         // Start Timer 0
}
void Timer0_ISR (void) interrupt 1     // It is called after every 250usec
{
usecCounter = usecCounter + 250;   // Count 250 usec
if(usecCounter==1000)              // 1000 usec means 1msec
{
msCounter++;
usecCounter = 0;
}
TF0 = 0;     // Clear the interrupt flag
}
void UpdateTimeCounters(void)
{
if (msCounter==1000)
{
secCounter++;
msCounter=0;
}
if(secCounter==60)
{
minCounter++;
secCounter=0;
}
if(minCounter==60)
{
hrCounter++;
minCounter=0;
}
if(hrCounter==24)
{
hrCounter = 0;
}
}
void DisplayTimeToLCD( unsigned int h, unsigned int m, unsigned int s )   // Displays time in HH:MM:SS format
{
ClearLCDScreen();      // Move cursor to zero location and clear screen
// Display Hour
WriteDataToLCD( (h/10)+0x30 );
WriteDataToLCD( (h%10)+0x30 );
//Display ':'
WriteDataToLCD(':');
//Display Minutes
WriteDataToLCD( (m/10)+0x30 );
WriteDataToLCD( (m%10)+0x30 );
//Display ':'
WriteDataToLCD(':');
//Display Seconds
WriteDataToLCD( (s/10)+0x30 );
WriteDataToLCD( (s%10)+0x30 );
}
void delay(int a)
{
int i;
for(i=0;i<a;i++);   //null statement
}
void WriteDataToLCD(char t)
{
RS = 1;             // This is data
P2 &= 0x0F;                         // Make P2.4 to P2.7 zero
P2 |= (t&0xF0);     // Write Upper nibble of data
E  = 1;             // => E = 1
delay(150);
E  = 0;             // => E = 0
delay(150);
P2 &= 0x0F;                         // Make P2.4 to P2.7 zero
P2 |= ((t<<4)&0xF0);// Write Lower nibble of data
E  = 1;             // => E = 1
delay(150);
E  = 0;             // => E = 0
delay(150);
}
void WriteCommandToLCD(int z)
{
RS = 0;             // This is command
P2 &= 0x0F;                         // Make P2.4 to P2.7 zero
P2 |= (z&0xF0);     // Write Upper nibble of data
E  = 1;             // => E = 1
delay(150);
E  = 0;             // => E = 0
delay(150);
P2 &= 0x0F;                         // Make P2.4 to P2.7 zero
P2 |= ((z<<4)&0xF0);// Write Lower nibble of data
E  = 1;             // => E = 1
delay(150);
E  = 0;             // => E = 0
delay(150);
}
void lcdinit(void)
{
///////////// Reset process from datasheet /////////
delay(15000);
P2 &= 0x0F;                           // Make P2.4 to P2.7 zero
P2 |= (0x30&0xF0);    // Write 0x3
E  = 1;               // => E = 1
delay(150);
E  = 0;               // => E = 0
delay(150);
delay(4500);
P2 &= 0x0F;                           // Make P2.4 to P2.7 zero
P2 |= (0x30&0xF0);    // Write 0x3
E  = 1;               // => E = 1
delay(150);
E  = 0;               // => E = 0
delay(150);
delay(300);
P2 &= 0x0F;                           // Make P2.4 to P2.7 zero
P2 |= (0x30&0xF0);    // Write 0x3
E  = 1;               // => E = 1
delay(150);
E  = 0;               // => E = 0
delay(150);
delay(650);
P2 &= 0x0F;                           // Make P2.4 to P2.7 zero
P2 |= (0x20&0xF0);    // Write 0x2
E  = 1;               // => E = 1
delay(150);
E  = 0;               // => E = 0
delay(150);
delay(650);
/////////////////////////////////////////////////////
WriteCommandToLCD(0x28);    //function set
WriteCommandToLCD(0x0c);    //display on,cursor off,blink off
WriteCommandToLCD(0x01);    //clear display
WriteCommandToLCD(0x06);    //entry mode, set increment
}
void ClearLCDScreen(void)
{
WriteCommandToLCD(0x01);   // Clear screen command
delay(1000);
}

Download C program, Proteus simulation file, HEX file, etc using below link.

Download ButtonYou may also like:

I hope you liked this Digital Stopwatch mini project. If you have any queries  feel free to ask in comment section below. Subscribe to our newsletter and like our facebook page for future updates. Have a nice day!

 

Digital Voltmeter using 8051 microcontroller – Mini-Project

Voltmeter is a voltage measuring instrument. We can measure the potential difference between any two points in an electrical network using voltmeter. Let us design and make a simple voltmeter using 8051 microcontroller which you can use as a mini-project in your college.

There are two types of voltmeter as analog voltmeter and digital voltmeter. Analog voltmeter moves pointer on a scale but it has some limitations like accuracy of few percent of full scale.

Digital Voltmeter using 8051 Microcontroller.

In this section we are going to make a digital voltmeter using 8051 microcontroller. Digital voltmeter can display numerical value of voltage on a display by use of analog to digital converter (ADC). All the data processing and manipulating is in digital form, so it is very essential to use ADC. We have used ADC0804 analog-to-digital converter IC. The range of input voltage is 0-15V. Here the input voltage should be DC voltage so as to get the steady output on the LCD display. If you give the AC voltage as an input, it will display continuously running numbers as the nature of AC voltage.

Components required for Digital Voltmeter using 8051 Microcontroller:

  1. Microcontroller,  AT89C51
  2. Analog‐to‐Digital  Converter,  ADC0804
  3. 16×1  LCD
  4. Oscillator  circuit  for  the  microcontroller
    1. 12MHz  Crystal  Capacitor
    2. 33pF  Capacitors
  5. Voltage  divider  circuit/  Input  terminals
    1. 200k,  100k  Resistors
    2. 100nF  Capacitor
  6. ADC  Clock  Circuit  100k  Potentiometer  (to  adjust  the  back‐light  of  the  LCD)
    1. 10k  Resistor
    2. 150pF  Capacitor
  7. 100k  Potentiometer  (to  adjust  the  back‐light  of  the  LCD)

Circuit Diagram of Digital Voltmeter using 8051 Micrcontroller:

Digital voltmeter using 8051 micrcontroller
Digital voltmeter using 8051 micrcontroller

Pin description of 16×1 LCD Display:

lcd pin diagram
lcd pin diagram
Pin  No Name Description
1 Vss Ground
2 Vdd +5V
3 Vee Contrast  Adjustment  ‐2V  to  ‐5V
4 RS Register  Select
5 RW 1  ‐Read  ,  0‐ Write
6 E Enable  Strobe
7 D0 Data  Line
8 D1 Data  Line
9 D2 Data  Line
10 D3 Data  Line
11 D4 Data  Line
12 D5 Data  Line
13 D6 Data  Line
14 D7 Data  Line
15 LED+ Backlit  LED  +V   Vdd  (Optional  signal)
16 LED‐ Backlit  LED  –V   Vss  (Optional  signal)

C program for digital voltmeter using 8051 micrcontroller:

#include <REGX51.H>
#include "lcd.h"
#define adc_port P1              //ADC Port
#define rd P3_7                  //Read signal P3.7
#define wr P3_6                  //Write signal P3.6
#define cs P3_5                  //Chip Select P3.5
#define intr P3_4                //INTR signal P3.4
void conv();                     //Start of conversion function
void read();                     //Read ADC function
unsigned int adc_avg,adc;
void main(){
char i;
LCD_INI();
while(1){                                                              //Forever loop
adc_avg = 0;
for(i=0;i<10;i++){
conv();                  //Start conversion
read();                  //Read ADC
adc_avg += adc;
}
adc_avg = adc_avg/10;
wrt_cmd(0x80);
wrt_string("V(DC): ");
adc = adc_avg * 59;
hex2lcd((unsigned char)(adc/1000));
wrt_data('.');
adc = adc%1000;
hex2lcd((unsigned char)(adc/10));
wrt_data('V');
}
}
void conv(){
cs = 0;                                    //Make CS low
wr = 0;                                  //Make WR low
wr = 1;                                  //Make WR high
cs = 1;                                    //Make CS high
while(intr);         //Wait for INTR to go low
}
void read(){
cs = 0;                                    //Make CS low
rd = 0;                                   //Make RD low
adc = adc_port; //Read ADC port
rd = 1;                                   //Make RD high
cs = 1;                                    //Make CS high
}

C Program:

Click here to download the C program, Hex file and project report of digital voltmeter using 8051 microcontroller.

You may also like:

If you liked this post please share it with your friends and like our facebook page for future updates.

 

How to create HEX file in keil for 8051 microcontroller

How to create and burn HEX file for 8051 microcontroller in keil:

Hello friends, today I am going to tell you how to create a microcontroller program file (.HEX format) and how to burn HEX program file in our 8051 microcontroller for any desired project.

Let me tell you one thing in this tutorial I am not going to learn you ‘C’ program, I am just telling you how to create and burn .hex program file in  a 8051 microcontroller (assuming that you have c program with you).

For programming a microcontroller we are going to use one of the best microcontroller programming software called “Keil”. Using this software you can compile your ‘C’ program and can check is their any errors in your program or not. After removing all errors (if any), you can create program file also known as .hex file which we are going to use for our microcontroller programming.

So let us learn – How to create a hex file for 8051 microcontroller using Keil software step by step:

(Before proceeding to our main tutorial make sure that you have your c program file (.c format or in word document), which we are going to convert into .hex file using ‘Keil’ software)

Step 1: DownloadKeil uVision3’: Click here to download keil uVision software. (After downloading install it in your computer).

Step 2: Open the Keil software, you will see following window.

Keil tutorial for programming a microcontroller 1
Keil tutorial for programming a microcontroller 1

Step 3: Now be ready for your first microcontroller project using keil software. Now we are going to do our new project, this can be done by by using following steps:

  • Click on ‘Project’ then ‘New project’. A new window will appear on the screen (Create new project). Simply type your project name (in my case it is ‘my first keil project’) and click ‘Save’.

    Keil tutorial for programming a microcontroller 2
    Keil tutorial for programming a microcontroller 2
  • When you click on save button, a new window will appear (Select Device for Target ‘Target 1’) here we are required to tell – which microcontroller we are going to use? (For example, if we are using famous 8051 family or AT89C51, then double click on ‘Atmel’ here you will see all the microcontrollers made by ‘Atmel’. Click on any one (in my case it is AT89C51) which you are going to program). Then click on OK.

    Keil tutorial for programming a microcontroller 3
    Keil tutorial for programming a microcontroller 3
  • After that another window will appear asking for “Copy Standard 8051 Startup Code to Project Folder and Add File to Project?” Click on ‘yes’.

    Keil tutorial for programming a microcontroller 4
    Keil tutorial for programming a microcontroller 4

If you observe ‘Project workspace’ which is located at the left side, you will see ‘STARTUP.A51’ file is their. It means it is the file which contains the assembly language commands of 8051 microcontroller.

Step 4: Now we are required to configure option value of our microcontroller project. For doing this click on ‘Project’ then “Option for Target ‘Target 1’”.

  • Select Tab of Target to configure value of MCU Target as : Configure X-TAL to be 12 MHz (which is initially 24 MHz)

    Keil tutorial for programming a microcontroller 5
    Keil tutorial for programming a microcontroller 5
  • Select Tab of Output and click on checkbox of “Create HEX file”. Click OK.

    Keil tutorial for programming a microcontroller 6
    Keil tutorial for programming a microcontroller 6

Step 5: Now we are ready for writing a first C program.

  • Click on ‘File’ and then click on ‘New’. A new window will appear in which we are going to write our C program. If you already have, simply paste it in this window. After completing your C program click on ‘File’ and then ‘Save’ (Shortcut ‘Ctrl+S’) . We are required to save this file with extension ‘.c’ Don’t forgot to write .c after name of c program. Figure is shown below:
  • Add Files into Project File, click command Project Components, Environment, Books…, select Tab Project Components and then select desired Add File to add into Project File.

    Keil tutorial for programming a microcontroller 8
    Keil tutorial for programming a microcontroller 8
  • In the first time, we must select Files of type to be “C Source files (*.c)” and it will display Files name that is C Language Source Code. Click icon of File named “my first keil project.c” and then click Add then close then OK.
  • Now if there is ‘my first keil project.c’ file present in the Project workspace which is at upper left of the screen, you are on your way!

Step 6: Now this is our last step of this tutorial. Here in the last step we are going to check is everything is fine without errors or not. We are checking our c program and converting it into hex file. So for doing this click on ‘Project’ and then click on ‘Rebuild all target files’ (There is also shortcut for this command on upper left). So when you click on this button you will see that your program is being compiled. If there is massage like “my first keil project” – 0 Error(s), 0 Warning(s)”. it means you have not any errors in your program and you can use its HEX file for your microcontroller.

Keil tutorial for programming a microcontroller 9
Keil tutorial for programming a microcontroller 9

Now close the software and open the directory where you save your project. Generally it is in (C:KeilC51Examples……). So there is one file containing .hex format this is your program file. You can burn this program in your microcontroller using microcontroller kit.

tags: how to program a 8051 microcontroller. how to write a program for 8051 microcontroller. keil – microcontroller programming software. step by step tutorial for programming a microcontroller. How to burn program in a 8051 microcontroller. How to create hex file in keil software for 8051 microcontroller.