Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Dual message display on LCD using 8051 microcontroller (AT89C51)

By Himanshu Choudhary August 6, 2010

 

This article presents an interesting approach for sound activated display system. This system displays two different messages for odd and even number of sounds. When the sound is produced for the first time the first message is displayed on the LCD. At the second sound, a second message is displayed. The first message reappears at the third sound. Thus alternate messages are displayed every time a sound, say clap, is detected by the system. The project is build around the 8051 microcontroller (AT89C51) along with LCD and a condenser microphone.

 

 


 

The circuit consists of four major modules, namely, a sound sensor, an amplifying circuit, a control circuit and a display module. A switching circuit is also employed after the amplifier. 

Any sound, say clap, is detected by a microphone (condenser mic) which acts as the sound sensor. This mic is connected to a two stage transistor amplifier. The mic output is thus amplified to a suitable level so that it can be detected at the TTL logic.

The output of the amplifier is coupled with a transistor switch. Whenever a high voltage output is received from the amplifier, it generates a pulse. The transistor switching circuit also ensures that a high TTL logic is not received at the microcontroller due to noise signals.

The pulses, from the switching circuit, are fed to the microcontroller’s pin which is programmed to detect the pulses. Whenever a high pulse is generated, it is received at the input pin of the microcontroller and is counted. The first message, ‘HELLO WORLD’, is sent to a 16×2 LCD on odd counts of the input. The second message, ‘WELCOME TO EARTH’ is displayed for even counts. Thus the messages are repeated whenever a high pulse (due to clap sound) is received by the microcontroller.

The data pins of the LCD are connected to port P2 of microcontroller AT89C51 while the control pins (RS, R/W & EN) are connected to pins 1-3 of port P1, respectively. The microcontroller receives sound pulses through the first pin of port P0.

 

 

Project Source Code

###

// Program to display two consequtive messages one after the other with the sound of a clap

#include<reg51.h>
#define port P1
#define dataport P2        //Data port for LCD
#define sec 1000

sbit rs = port^0;    //Control pins for LCD
sbit rw = port^1;
sbit e = port^2;
sbit sensor_input=P0^0;

void delay(unsigned int msec)    // Time delay function
{
    int i,j ;
    for(i=0;i<msec;i++)
        for(j=0;j<1275;j++);
}

void lcd_cmd(unsigned char item)    //Program to send command to LCD
{
    dataport = item;
    rs= 0;
    rw=0;
    e=1;
    delay(1);
    e=0;
    return;
}

void lcd_data(unsigned char item)    // Program to send data to LCD
{
    dataport = item;
    rs= 1;
    rw=0;
    e=1;
    delay(1);
    e=0;
    return;
}

void lcd_data_string(unsigned char *str) // Program to send string to LCD
{
    int i=0;
    while(str[i]!='')
    {
        lcd_data(str[i]);
        i++;
        delay(10);
    }
    return;
}

void main()
{
    int count=1;
    unsigned char str1[] ="HELLO";
    unsigned char str2[] ="WORLD";
    unsigned char str3[] ="WELCOME";
    unsigned char str4[] ="TO EARTH";
    sensor_input=1;
    sensor_input=0;
    lcd_cmd(0x38);
    lcd_cmd(0x0e);
    lcd_cmd(0x01);
    while(1)
        {
            count=1    ;
            sensor_input=0;
            while(count<=2)
            {
                while(sensor_input==0);
                if(sensor_input==1)
                {
                    lcd_cmd(0x01);
                    lcd_cmd(0x82);
                    lcd_data_string(str1);
                    lcd_cmd(0xc6);
                    lcd_data_string(str2);
                    count++;
                }
                while(sensor_input==0);
                if(sensor_input==1)
                {
                    lcd_cmd(0x01);
                    lcd_cmd(0x82);
                    lcd_data_string(str3);
                    lcd_cmd(0xc6);
                    lcd_data_string(str4);
                    count++;
                }
                }
        }
}

###

 


Circuit Diagrams

Circuit-Diagram-LCD-Based-Dual-Message-Display-Using-8051-Microcontroller-AT89C51

Project Components

  • AT89C51 Microcontroller
  • Condenser Microphone
  • LCD
  • Preset
  • Transistor BC547
  • Transistor BC548


Filed Under: 8051 Microcontroller
Tagged With: 8051, display, lcd, message display, microcontroller
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Right Half Plane Zero
  • Single ended measuring ports and balanced antenna
  • Thermal modelling of repetitive power pulse
  • Testing 5kW Grid Tied inverter over 200-253VAC
  • Resistor Selection for Amplifier Layout

RSS Electro-Tech-Online.com Discussions

  • Simple LED Analog Clock Idea
  • Fun with AI and swordfish basic
  • Is AI making embedded software developers more productive?
  • Can I make two inputs from one??
  • Behlke swich

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe