Thursday, January 26, 2012
INTERFACING MICROCONTROLLER WITH | INTERFACING PERIPHERALS
Posted by Thiru at 9:57 PM
0 Comments
Interfacing a microcontroller with a PC using serial port
Posted by Thiru at 9:54 PM
0 Comments
This circuit provides an interface between a standard inverted logic +/-12V RS-232 device (e.x. a PC) and a non-inverted 0-5 volt device (e.x. a microcontroller). The circuit does not require a separate external power supply since it "steels" power from the RS-232 DTR and RTS pins. This circuit supports full bidirectional receive and transmit signals.
Many dedicated IC's already exist which are specifically designed to perform this task and which require the addition of just a few external components (the most popular of which are made by Maxim Integrated Products). The intention of designing this circuit was not to outperform these IC's, but rather to design a simple bi-directional RS-232 compatible interface which does not require an external power supply and can be produced quickly with off-the-shelf parts (which are available from Radio-Shack).
The completed and fully functional circuit is depicted in Figure 1. The design is fairly elegant in its simplicity while still including a number of features to virtually eliminate the possibility of harming any of the connected electronic devices**.
The PCB layout for this design is depicted in Figure 2. This layout is in no way optimized and can probably be significantly reduced
in size if you move things around a bit. Nevertheless. the resulting
PCB is about 1 inch square and was sufficiently small for my application
at the time.Figure 2: PCB layout and connection descriptions for the serial port interface.
The schematic for the circuit described in this page is depicted below.
Figure 3: Schematic diagram for the serial port interface (Rx & Tx).
**Disclaimer: While the circuit was engineered to minimize the possibility of harming any of the connected electronic devices, the author makes to claims or warranties to the safety of this electronic circuit and in no way assumes any responsibility for any damages incurred while building or using the device described in these pages including but not limited to property and personal injury/damage/loss of any kind. Golden rule: always be sure to test your circuits before connecting them to anything of value!
LCD based voting machine using 8051 microcontroller (AT89C51)
Electronic
voting machine has now replaced the traditional mechanism of voting due
to several advantages like security, automatic counting etc. This
project presents a way to develop an electronic voting machine which
displays the count of votes on a 16x2 LCD
interface. A user can get his/her vote register through a set of
switches (one for each candidate). After every cast of vote, the
subsequent count can be seen on LCD. The circuit uses AT89C51 microcontroller and the code for the project has been written in C.
DESCRIBTION(click here)
-
This LCD based electronic voting machine is designed for four candidates. The input part consists of a set of six tactile switches. The switches and 16x2 LCD are interfaced to microcontroller AT89C51 for various operations and displays.The provision of casting votes for the candidates has been provided through four of these switches. These switches are made active high and connected to pins 2-5 (P1^1 – P1^4) of the controller. The remaining two switches (both active low) are to start and stop the voting procedure. They are connected to pins 1 and 6 (P1^0 and P1^5) respectively. The Init (start) switch initializes the voting system when pressed, while the Stop switch ends the voting and displays the poll results on LCD screen.For more details on working with LCD, refer LCD interfacing with 8051. The data pins of the LCD (pins 7-14) are connected to the output port P2 of the microcontroller. The control pins (RS, R/W and EN) are connected to port P3 pins P3^0, P3^1 & P3^6 respectively.Working:The voting is started by pressing the Init switch after which the user is prompted to vote. The count of votes is stored in four different variables. As soon as the user votes for a candidate by pressing one of the switches, the value of the corresponding variable is increased by one. After this a Thank you message is displayed on LCD to acknowledge the registration of user’s vote.The message stays on the screen until the next user either presses the Init button to cast another vote or Stop switch is pressed get the poll results. When the stop button is pressed, the names of the candidates are displayed along with their vote counts. After some delay, the result is displayed which could be either declaration of the winner candidate or the candidates with a clash of their number of votes.
CODE(click here)
// Program to make a voting machine using LCD #include<reg51.h> #define msec 50 #define lcd_data_str_pin P2 sbit rs = P3^0; //Register select (RS) pin sbit rw = P3^1; //Read write(RW) pin sbit en = P3^6; //Enable(EN) pin sbit ini_pin = P1^0; // Start voting pin sbit stop_pin = P1^5; // Stop voting pin sbit candidate_1=P1^1; //Candidate1 sbit candidate_2=P1^2; //Candidate2 sbit candidate_3=P1^3; //Candidate3 sbit candidate_4=P1^4; //Candidate4 int max = 0; int carry = 0; int arr[4]; int vote_amt[3],j; unsigned int vote_1,vote_2,vote_3,vote_4; void delay(int delay_time) // Time delay function { int j,k; for(j=0;j<=delay_time;j++) for(k=0;k<=1000;k++); } void lcd_cmd(unsigned char cmd_addr) //Function to send command to LCD { lcd_data_str_pin = cmd_addr; en = 1; rs = 0; rw = 0; delay(1); en = 0; return; } void lcd_data_str(char str[50]) //Function to send string { int p; for (p=0;str[p]!='\0';p++) { lcd_data_str_pin = str[p]; rw = 0; rs = 1; en = 1; delay(1); en = 0; } return; } void lcd_data_int(unsigned int vote) //Function to send 0-9 character values { char dig_ctrl_var; int p; for (j=2;j>=0;j--) { vote_amt[j]=vote%10; vote=vote/10; } for (p=0;p<=2;p++) { dig_ctrl_var = vote_amt[p]+48; lcd_data_str_pin = dig_ctrl_var; rw = 0; rs = 1; en = 1; delay(1); en = 0; } return; } void vote_count() // Function to count votes { while (candidate_1==0 && candidate_2==0 && candidate_3==0 && candidate_4==0); if (candidate_1==1) { while (candidate_1 == 1); { vote_1 = vote_1 + 1; } } if (candidate_2==1) { while (candidate_2 == 1); { vote_2 = vote_2 + 1; } } if (candidate_3==1) { while (candidate_3 == 1); { vote_3 = vote_3 + 1; } } if (candidate_4==1) { while (candidate_4 == 1); { vote_4 = vote_4 + 1; } } } void lcd_ini() { lcd_cmd(0x38); delay(msec); lcd_cmd(0x0E); delay(msec); lcd_cmd(0x01); delay(msec); lcd_cmd(0x81); delay(msec); lcd_data_str("Welcome!!!"); delay(100); lcd_cmd(0x01); delay(msec); lcd_cmd(0x80); delay(msec); lcd_data_str( "Press" ); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("button"); delay(msec); delay(msec); lcd_cmd(0xC0); delay(msec); lcd_data_str("to"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("vote"); delay(100); lcd_cmd(0x01); delay(msec); lcd_cmd(0x80); delay(msec); lcd_data_str("P1"); delay(msec); lcd_cmd(0x84); delay(msec); lcd_data_str("P2"); delay(msec); lcd_cmd(0x88); delay(msec); lcd_data_str("P3"); delay(msec); lcd_cmd(0x8C); delay(msec); lcd_data_str("P4"); delay(msec); vote_count(); lcd_cmd(0x01); delay(msec); lcd_cmd(0x85); delay(msec); lcd_data_str("Thank"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("You!!"); delay(100); } void results() // Function to show results { int i; carry = 0; lcd_cmd(0x01); delay(msec); lcd_cmd(0x80); delay(msec); lcd_data_str("Results"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("Are"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("Out"); delay(msec); lcd_cmd(0x01); delay(msec); lcd_cmd(0x80); delay(msec); lcd_data_str("P1"); delay(msec); lcd_cmd(0x84); delay(msec); lcd_data_str("P2"); delay(msec); lcd_cmd(0x88); delay(msec); lcd_data_str("P3"); delay(msec); lcd_cmd(0x8C); delay(msec); lcd_data_str("P4"); delay(msec); lcd_cmd(0xC0); delay(100); lcd_data_int(vote_1); delay(msec); lcd_cmd(0xC4); delay(msec); lcd_data_int(vote_2); delay(msec); lcd_cmd(0xC8); delay(msec); lcd_data_int(vote_3); delay(msec); lcd_cmd(0xCC); delay(msec); lcd_data_int(vote_4); delay(300); arr[0] = vote_1; arr[1] = vote_2; arr[2] = vote_3; arr[3] = vote_4; for( i=0; i<4; i++) { if(arr[i]>=max) max = arr[i]; } if ( (vote_1 == max) && ( vote_2 != max) && (vote_3 != max)&& (vote_4 != max) ) { carry = 1; lcd_cmd(0x01); delay(msec); lcd_cmd(0x82); delay(msec); lcd_data_str("Hurray!!!"); delay(50); lcd_cmd(0xC4); delay(msec); lcd_data_str("P1"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("wins"); delay(msec); } if ( (vote_2 == max) && ( vote_1 != max) && (vote_3 != max)&& (vote_4 != max) ) { carry = 1; lcd_cmd(0x01); delay(msec); lcd_cmd(0x82); delay(msec); lcd_data_str("Hurray!!!"); delay(50); lcd_cmd(0xC4); delay(msec); lcd_data_str("P2"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("wins"); delay(msec); } if ( (vote_3 == max) && ( vote_2 != max) && (vote_1 != max)&& (vote_4 != max) ) { carry = 1; lcd_cmd(0x01); delay(msec); lcd_cmd(0x82); delay(msec); lcd_data_str("Hurray!!!"); delay(50); lcd_cmd(0xC4); delay(msec); lcd_data_str("P3"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("wins"); delay(msec); } if ( (vote_4 == max) && ( vote_2 != max) && (vote_3 != max)&& (vote_1 != max) ) { carry = 1; lcd_cmd(0x01); delay(msec); lcd_cmd(0x82); delay(msec); lcd_data_str("Hurray!!!"); delay(50); lcd_cmd(0xC4); delay(msec); lcd_data_str("P4"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("wins"); delay(msec); } if (carry==0) { lcd_cmd(0x01); delay(msec); lcd_cmd(0x82); delay(msec); lcd_data_str("clash"); delay(50); lcd_cmd(0x14); delay(msec); lcd_data_str("between!!!"); delay(50); if(vote_2 == max) { lcd_cmd(0xC5); lcd_data_str("P2"); delay(50); } if(vote_3 == max) { lcd_cmd(0xC9); lcd_data_str("P3"); delay(50); } if(vote_4 == max) { lcd_cmd(0xCD); lcd_data_str("P4"); delay(50); } } } void main() { ini_pin = stop_pin = 1; vote_1 = vote_2 = vote_3 = vote_4 = 0; candidate_1 = candidate_2 = candidate_3 = candidate_4 = 0; lcd_cmd(0x38); delay(msec); lcd_cmd(0x0E); delay(msec); lcd_cmd(0x01); delay(msec); lcd_cmd(0x80); delay(msec); lcd_data_str( "Press" ); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("init"); delay(msec); delay(msec); lcd_cmd(0xC0); delay(msec); lcd_data_str("to"); delay(msec); lcd_cmd(0x14); delay(msec); lcd_data_str("begin"); delay(100); while(1) { while(ini_pin != 0) { if (stop_pin == 0) break; } if (stop_pin == 0) { break; } lcd_ini(); } while(1) { results(); } }
Distance measurement using InfraRed sensor with ADC0804 & 8051 microcontroller (AT89C51)
Posted by Thiru at 9:25 PM
3 Comments
Infrared sensors
find numerous applications in electronic systems. Commonly used as
obstacle detector, their output is used in digital form (high & low
logic) by employing a comparator. This topic explains a way to use the
sensor’s output in its original analog form. Thus, along with detecting
an obstacle, its exact distance can also be obtained. This is achieved
by processing the output of IR sensor through an ADC0804 (analog to digital converter). The ADC is calibrated to get almost accurate distance measurement.
The measured distance is also displayed on an LCD screen. The ADC0804 and LCD are interfaced with 8051 microcontroller (AT89C51) to perform these operations. The major drawback of IR based sensors is their capability of detecting short distances.
DESCRIBTION:
- This project mainly consists of three units: a sensor unit, an ADC component and the LCD module.
The IR receiver detects the IR radiations transmitted by an IR LED. The output voltage level of this IR sensor depends upon the intensity of IR rays received by the receiver. The intensity, in turn, depends on the distance between the sensor module and the obstacle. When the distance between IR pair and obstacle is lesser, more IR radiations fall on the receiver, and vice versa. The receiver along with a resistor forms a voltage divider whose output is supplied as the input for ADC0804.
CODE:
//Program to interface IR sensor using ADC 0804. Set Vref =1.5v for ADC 0804 #include<reg51.h> #define port P3 #define adc_input P1 #define dataport P0 #define sec 100 sbit rs = port^0; sbit rw = port^1; sbit e = port^2; sbit wr= port^3; sbit rd= port^4; sbit intr= port^5; int test_final=0 ,shift=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) // Function to send command to LCD { dataport = item; rs= 0; rw=0; e=1; delay(1); e=0; return; } void lcd_data(unsigned char item) // Function 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) // Function to send string to LCD { int i=0; while(str[i]!='\0') { lcd_data(str[i]); i++; delay(1); } return; } void convert() { int s; lcd_cmd(0x81); delay(2); lcd_data_string("output:"); s=test_final/100; test_final=test_final%100; lcd_cmd(0x8a); if(s!=0) lcd_data(s+48); else lcd_cmd(0x06); s=test_final/10; test_final=test_final%10; lcd_data(s+48); lcd_data(test_final+48); lcd_data(' '); if(shift>16) { lcd_cmd(0xc0+(shift-1)); lcd_data_string(" "); shift=0; } lcd_cmd(0xc0+(shift-1)); lcd_data(' '); lcd_cmd(0xc0+shift); lcd_data_string("CALIBRATE IT"); delay(30); } void main() { adc_input=0xff; lcd_cmd(0x38); //2 Line, 5X7 Matrix lcd_cmd(0x0c); //Display On, Cursor Blink delay(2); lcd_cmd(0x01); // Clear Screen delay(2); lcd_cmd(0x81); // Setting cursor to first position of first line delay(2); while(1) { shift++; delay(1); rd=1; wr=0; delay(1); wr=1; while(intr==1); rd=0; test_final=adc_input; delay(1); intr=1; convert(); } }
Categories
- AERONAUTICAL (3)
- AEROSPACE (3)
- AGRICULTURE (1)
- ANDROID (5)
- Android project titles (1)
- Animation projects (1)
- Artificial Intelligence (1)
- AUTOMOBILE (1)
- BANK JOBS (1)
- BANK RECRUITMENTS (1)
- BIG DATA PROJECT TITLES (1)
- Bio instrumentation Project titles (2)
- BIO signal Project titles (2)
- BIO-TECHNOLOGY (10)
- BIOINFORMATICS (3)
- BIOMEDICAL (11)
- Biometrics projects (2)
- CAREER (1)
- CAT 2014 Questions (2)
- CHEMICAL (1)
- CIVIL (4)
- Civil projects (1)
- cloud computing (4)
- COMP- PROJ-DOWN (2)
- COMPUTER SCIENCE PROJECT DOWNLOADS (8)
- COMPUTER(CSE) (13)
- CONFERENCE (2)
- Data mining Projects (1)
- Data protection. (1)
- Design projects (1)
- DIGITAL SIGNAL PROCESSING IEEE Project titles (1)
- Dot net projects (2)
- EBOOKS (4)
- ELECTRICAL MINI PROJECTS (8)
- ELECTRICAL PROJECTS DOWNLOADS (6)
- ELECTRONICS MINI PROJECTS (8)
- ELECTRONICS PROJECT DOWNLOADS (8)
- EMG PROJECTS (1)
- employment (1)
- Engineering projects (1)
- Exams (2)
- Facts (2)
- final year projects (1)
- FOOD TECHNOLOGY (1)
- FREE IEEE 2014 project (1)
- Free IEEE Paper (1)
- FREE IEEE PROJECTS (1)
- GATE (3)
- GAte scorecard (1)
- GOVT JOBS (1)
- Green projects (1)
- GSM BASED (3)
- Guest authors (7)
- HIGHWAY (1)
- IEEE 2014 projects (1)
- ieee 2015 projects (4)
- IEEE computer science projects (1)
- IEEE Paper (4)
- IEEE PAPER 2015 (1)
- ieee project titles (1)
- IEEE projects (6)
- IEEE Transactions (2)
- INDUSTRIAL (2)
- INNOVATIVE PROJECTS (16)
- INTERFACING (1)
- IT (2)
- IT LIST (1)
- Java projects (3)
- labview projects (2)
- LATEST TECHNOLOGY (8)
- list of project centers (9)
- Low cost projects (1)
- m.com (1)
- MARINE (1)
- Matlab codes (3)
- MATLAB PROJECT TITLES (7)
- MATLAB PROJECTS (17)
- MBA (4)
- MBA 2015 projects (2)
- MCA (1)
- MECHANICAL (4)
- MECHANICAL PROJECTS DOWNLOAD (2)
- MINI PROJECTS (1)
- modelling projects (1)
- MP3 (1)
- MP3 cutter (1)
- Mp4 (1)
- Networking topics (1)
- ns2 projects (1)
- online jobs (2)
- PETROCHEMICAL (1)
- PHYSIOLOGICAL MODELLING projects (1)
- physiotheraphy Projects (1)
- Power electronics (10)
- power system projects (3)
- PRODUCTION (2)
- project centers (2)
- project downloads (1)
- Prosthesis projects (1)
- RAILWAY RECRUITMENT 2012 (2)
- Recent (17)
- RECENT TECHNOLOGY (5)
- RECENT TECHNOLOGY LIST (1)
- RECRUITMENT (3)
- Rehabilitation projects (1)
- renewable power (1)
- respiration projects (1)
- RESUME FORMAT. (1)
- Ring Tone Cutter (1)
- Robotics projects. Robots in medical (1)
- social network jobs (2)
- Solar projects (1)
- Songs Cutter (1)
- Speech-music separation-Abstract (1)
- structural engineering (1)
- TECHNOLOGY (1)
- technology management (1)
- TELE COMMUNICATION (2)
- Telegram project (1)
- TEXTILE (1)
- TOP ENGINEERING COLLEGES (3)
- Training (1)
- VLSI (1)
Labels
AERONAUTICAL
AEROSPACE
AGRICULTURE
ANDROID
Android project titles
Animation projects
Artificial Intelligence
AUTOMOBILE
BANK JOBS
BANK RECRUITMENTS
BIG DATA PROJECT TITLES
Bio instrumentation Project titles
BIO signal Project titles
BIO-TECHNOLOGY
BIOINFORMATICS
BIOMEDICAL
Biometrics projects
CAREER
CAT 2014 Questions
CHEMICAL
CIVIL
Civil projects
cloud computing
COMP- PROJ-DOWN
COMPUTER SCIENCE PROJECT DOWNLOADS
COMPUTER(CSE)
CONFERENCE
Data mining Projects
Data protection.
Design projects
DIGITAL SIGNAL PROCESSING IEEE Project titles
Dot net projects
EBOOKS
ELECTRICAL MINI PROJECTS
ELECTRICAL PROJECTS DOWNLOADS
ELECTRONICS MINI PROJECTS
ELECTRONICS PROJECT DOWNLOADS
EMG PROJECTS
employment
Engineering projects
Exams
Facts
final year projects
FOOD TECHNOLOGY
FREE IEEE 2014 project
Free IEEE Paper
FREE IEEE PROJECTS
GATE
GAte scorecard
GOVT JOBS
Green projects
GSM BASED
Guest authors
HIGHWAY
IEEE 2014 projects
ieee 2015 projects
IEEE computer science projects
IEEE Paper
IEEE PAPER 2015
ieee project titles
IEEE projects
IEEE Transactions
INDUSTRIAL
INNOVATIVE PROJECTS
INTERFACING
IT
IT LIST
Java projects
labview projects
LATEST TECHNOLOGY
list of project centers
Low cost projects
m.com
MARINE
Matlab codes
MATLAB PROJECT TITLES
MATLAB PROJECTS
MBA
MBA 2015 projects
MCA
MECHANICAL
MECHANICAL PROJECTS DOWNLOAD
MINI PROJECTS
modelling projects
MP3
MP3 cutter
Mp4
Networking topics
ns2 projects
online jobs
PETROCHEMICAL
PHYSIOLOGICAL MODELLING projects
physiotheraphy Projects
Power electronics
power system projects
PRODUCTION
project centers
project downloads
Prosthesis projects
RAILWAY RECRUITMENT 2012
Recent
RECENT TECHNOLOGY
RECENT TECHNOLOGY LIST
RECRUITMENT
Rehabilitation projects
renewable power
respiration projects
RESUME FORMAT.
Ring Tone Cutter
Robotics projects. Robots in medical
social network jobs
Solar projects
Songs Cutter
Speech-music separation-Abstract
structural engineering
TECHNOLOGY
technology management
TELE COMMUNICATION
Telegram project
TEXTILE
TOP ENGINEERING COLLEGES
Training
VLSI
Subscribe Our Newsletter
-
COMPUTER SCIENCE ENGINEERING PROJECT TITLES(1500+ TOPICS TO CHOOSE)
-
ELECTRICAL MINI PROJECTS DOWNLOAD
-
LIST OF MECHANICAL PROJECTS
-
INDUSTRIAL ENGINEERING PROJECT TITLES
-
LIST OF PROJECT TOPICS FOR MBA || MBA PROJECT TOPICS || MBA PROJECTS || MANAGEMENT PROJECTS||
-
CHEMICAL ENGINEERING PROJECT TOPICS
-
Electronics Mini Project Topics and Ideas
-
MCA PROJECTS/TITLES/TOPICSTO BE CHOOSED
-
EEE/ECE PROJECT LIST
-
TEXTILE ENGINEERING PROJECT IDEAS/TOPICS /TITLES
Popular Posts
Powered by Blogger.



Facebook
Twitter
Google+
Rss Feed

0 comments:
THANKS FOR UR COMMENT ....