Connecting multiple tact switches on a single input pin of a microcontroller | Anna university questions papers projects for EEE,ECE,IT,MECHANICAL,MBA,MCA Anna university questions papers projects for EEE,ECE,IT,MECHANICAL,MBA,MCA: Connecting multiple tact switches on a single input pin of a microcontroller Bank Exam question paper, GATE Papers,Combined Defence Service Examination papers ,TANCET,BSNL JTO,ISRO,EBOOKS,DRDO ,BARC, , NTPC ,BHEL ,BEL ,HAL,Anna University Papers,ECE , EEE , CSE , IT , Mech , BIOMEDICAL , Textile , MBA , MCA , Anna University Question Bank , Anna University Syllabus , Anna University 'Q' Papers , Gate Papers , 8051, AVR, 8051 projects, free 8051 microcontroller projects, AVR projects, AVR tutorial, AVR microcontroller projects, circuits, hobby electronics, microcontroller based projects, microcontroller projects, final year projects, electronic projects, electronics projects, circuit diagrams, pin diagram, pin description, interfacing with AT89C51, 8051 tutorials, embedded projects, serial port, sensor, Electronic Components, Electronic Circuits, circuits for hobbyist, electronic schematics, DIY projects, breadboard circuits, at89c51, 8051 code, advanced circuits, hobby projects, circuit ideas, embedded system, embedded C, microcontroller programming in C, LCD interfacing, ADC interfacing, circuit components, hobby circuits, seven segment display, 89c51 projects, circuit description, major projects, minor projects, projects for circuit branches, interrupt, 8051 programming, RS232, 8 bit microcontroller,Microcontroller Tutorials, PIC Tutorial, 8051 Microcontroller Tutorial Resource, Connect to the PIC, PIC Tutorials, Micro Controller Tutorials, PIC Micro controller Tutorial Resource, DALLAS 80C320, DS80C320, Connect to the PIC, PIC Tutorials, Dallas DS80C320, 8051 Introduction, Types of Memory, Special Function Registers, Basic Registers, Addressing Modes, Program Flow, Low Level Information, 8051 Timers, 8051 Serial Port Operations, 8051 Interrupts, Additional Features of 8052, 8052 Instruction Set, Computer Science Seminar Topics, Mechanical Engineering Seminar Topics,Electrical Seminar Topics,Electronics Seminar Topics,Seminar Abstract And Report Downloads,High-Speed Architecture, New Instruction Speed, Variable Length MOVX Instruction, Timer Considerations, Dual Data Pointer, Watchdog Kicking, The Watchdog Watchdog Interrupt, Watchdog System Resets, Power Failure Functions, Power Failure Reset, Power Failure Interrupt, Secondary Serial Port, Timed Access Protection, PIC16F877A Tutorial, Introduction to the PIC16F877A, How to hook up the PIC so it will run?, What do the pins mean?, How to program the PIC?, Miscellaneous Advice, LED Blinker, Photoresistor Input, Analog Input (Photoresistor, Sonar sensor, IR sensor, Digital Input (Switches), Output messages to computer screen, Servo Motor Output, DC Motor Output,Gate sample paper with solution , Engineering E-Books , Free ebook websites , Final Year Projects , Placement papers,anna university previous year question bank, previous year question paper,model question paper, two mark question paper,sex,adult,results,atmel humidity Assembly Language code, Digital Clock Employing Memory Mapping, Humidity Sensing, Microcontroller51,control solid state relays, decoded 74ls138, latech 73ls373, port expander, Solid State Relays,urn ON, turn OFF, Relay Driver, back EMF, holding, current, pullup, resistor, coil, BC547, ULN2003, ULN2803, npn, transistor, microcontroller, Technology, circuit,bharathidasan university,university,thanjavur,madurai,coimbatore,chennai,adult,porn,sastra,sastra university, placement and training cell,java,j2ee,ajax,c,c++,oracle,COMPUTER SCIENCE,embedded, embedded systems, j2ee, dotnet, j2me, dot net, jsp, vb, c#, c, c sharp, computer science, cse, information technology, it, Electrical, Electronics, communication,SURVEY,ONLINE JOB,PAY TO CLICK,SEBOSA, ece, eee, academic, college, instrumentation, control, control systems, best ,project centers, project centres, company, companies, software, telecommunication, telecom, networking, matlab, robotics, Artificial intelligence, automation, cloud computing, cryptography, data mining, dsp, database, digital, image processing, fuzzy logic, gsm, gps, gprs, mobile computing, networks, network security, php, power, systems, vlsi, hardware, web services, wireless, rf, rfid, microcontroller, ns2, 2010, titles, list, download, latest, free, advanced, low cost, placement, zigbee, Chennai, india, uk, SOFTWARE ENGINEERING, APPLIED ELECTRONICS, VLSI Design, M.E,EMBEDDED SYSTEMS, COMMUNICATION SYSTEMS,Memory Organization, Microcontroller to LCD, moving message display using 8051 microcontroller, MOVING MESSAGE DISPLAY USING ATMEL 89C51, PIN Configuration, Programming Aspects, POWER ELECTRONICS, 89c51, 89s51 moving message display board, microcontroller 8051,8051, AVR, 8051 projects, 8051 microcontroller projects, AVR projects, AVR tutorial, AVR microcontroller projects, electronics projects, free electronic circuits, circuit diagrams, circuits, schematics, hobby electronic projects, electronic projects, hobby electronic circuit diagram, final year projects, embedded projects, technical articles. Interfacing microcontroller 8051 with peripherals like ADC, LCD, EEPROM,solenoid valve atmel dc control triac,dimmer bt138,uln2003 microcontroleur interfacing a microprocessor to a power thyristor microcontrol based level mesurement 89c51 as pwm controller,at89c2051 sine wave pwm,8051 lift, circuit design for a elevator, Elevator Lift control for three stories with microcontroller 8051, microcontroller based lift controller for three stories, three stories lift,ericsson at command microcontroller, GSM/ EDGE Modem in PCI Interface, Interface of mobile phone with micro-controller, Supporting AT commands,embedded projects,8051,pic,arm,pic16f877a,qualifity,best project in thanjavur,relay design,product manufuring,dvd,vcd,service,free training,electrical and electronic circuits,pcb board design,help of embedded,earn money with embedded,part time job,home based job,vacancy,ieee transaction,optimization,website design,university, Chapter 2 Liquid Crystal Display, Character Generator RAM, DDRAM or CGRAM, Display on or off control, LCD, microcontroller interface with LCD, PIN Configuration, Pressure monitoring with microcontroller 8051, Pressure sensing and controlling, Pressure Sensing System, Programmable Peripheral Interface, RS-232 serial communication,diploma in embedded,matlab in thanjavur, seo,site design @2900 onwards, 8255 and RS232, 89s51 LCD display LM 35 ADC0804 measurment, construction of a pressure sensing system using 8051, designed pressure sensor and transducer,microcontroller based heart rate meter,8051 pin diagram,invention heart rate meter,heart meter watch,heart beat monitor project,8051,AVR,8051 projects,free 8051 microcontroller projects,AVR projects,AVR tutorial,AVR microcontroller projects,circuits,hobby electronics,microcontroller based projects,microcontroller projects,final year projects,electronic projects,electronics projects,circuit diagrams,pin diagram,pin description,interfacing with AT89C51,8051 tutorials,embedded projects,serial port,sensor,Electronic Components,Electronic Circuits,circuits for hobbyist,electronic schematics,DIY projects,breadboard circuits,at89c51,8051 code,advanced circuits,hobby projects,circuit ideas,embedded system,embedded C,microcontroller programming in C,LCD interfacing,ADC interfacing,circuit components,hobby circuits,seven segment display,89c51 projects,circuit description,major projects,minor projects,projects for circuit branches,interrupt,8051 programming,RS232,8 bit microcontroller,microcontroller based heart beat monitor,8051 isp programmer,heartbeat monitor and display on LCD,heart beat rate monitor with sensor,training heart rate monitor with comaprators ans sensor,8051 microcontroller application,optocoupler based sensor of runner heart rate monitor,how to measure heart beat, calculate heartbeat just in one second,8051 rtos,limitations of heart rate monitors, quick display of heart monitor,advantages of electronic medical records,electronic medical billing,used electronic test equipment,electronic document management solution,fetal heart rate monitor,wrist heart rate monitor,avr 8051,baby heart monitor,heart beat counter using microcontroller 8051, block diagram for ir led and ldr based heartbeat monitor with display on computer, MICROCONTROLLER AT89C2051 BASED HEART BEAT MONITOR (PULSE RATE wth assembly code),ir led and ldr based heartbeat monitor with display on computer,wireless biomedical monitoring system using 89S52 microcontroller,wireless biomedical monitoring system using 89S52 microcontroller,8051microcontroller based heart beat monitor,heart pulse system project,very cheap cost in india,lm35,temperature sensor,heart beat sensor,technology,solutions,sastra university,data base design,speed ,innovative centre,home security system model design, water level indicator for home,COMPUTER SCIENCE, SOFTWARE ENGINEERING, APPLIED ELECTRONICS, VLSI Design,IEEE Project center, IEEE 2010 Projects in Tanjore, trichy, Kumbakonam, Pudukkottai, Ariyalur, Pattukkottai, Best IEEE Projects, final year projects, Project Center in Trichy, Project Company in thanjavur, Project training @ tanjore, Free 8051 Microcontroller projects,8052 projects,microcontroller,projects, Datasheers,circuit diagram,Microcontroller,8051,AVR,8085 Microprocessor,BASCOM,projects,tutorials,codes,Libraries,interfacing examples,embedded projects,serial port,infrared remote controls,rf remote controls,home automation,Intel 8051 microcontroller,electronic projects,embedded systems,control systems,computers,technical books,software,assembly language,programming intels 8051,serial communications,rs232,Electronics Projects,Books,Home Automation,Computer Software,Assemblers,Compilers,applications Programming,Embedded Systems Design,8052,AT89C2051,robotics applications,visualbasic, Microsoft Visual Basic,system, based, solar, control, intelligent, motor, controller, vehicle, monitoring, pwm, detection, home, temperature, tracking, alert, blind, alcohol, automated, automatic, close,Robotics,Kits,Circuit Examples,8051,Robots,micro Code,AT89c51, Programmer,IEEE 2010 embedded systems, embedded programming, PIC Micro projects, Microchip Programming, AVR tutorials, PIC Micro tutorials, ATMEL, Microcontrollers based systems, Microcontroller Projects, Embedded projects, Embedded designing in C, Microchip Lab, Embedded systems tips, DIY Electronics,Project Detail,onlinejob, Data Entry, no fee, no investment, part time, home based,recuirements,job,consultancy,helpline,maths,power,ultimate knowledge,prodigy,trichy,mobile
100% FAT LOSS TIPS Click Here!

Connecting multiple tact switches on a single input pin of a microcontroller

, Posted by ADMIN at 9:50 AM


Normally one tact switch requires one digital input pin of a microcontroller. Some designs implement keypad style multiplexing to get multiple switches on fewer inputs. However, there exist other techniques that allow you to connect many switches on a single input pin of a microcontroller. This tutorial demonstrates one such technique as applied to PIC12F683 microcontroller. In this example, there are four LEDs and four tact switches connected to the PIC12F683 microcontroller. While each LED is controlled through an individual I/O pin, the four switches are connected to one ADC input pin of the PIC12F683 microcontroller.

Connecting multiple tact switches to one input pin of PIC micro

Theory

The theory of connecting multiple switches on a single ADC input channel is very simple. One end of each switch is connected to the power supply voltage through an individual pull-up resistor, whereas the other end is grounded through a common resistor. When a switch is pressed, it creates a voltage divider network between the power supply and ground terminals. The value of the divided voltage can be made unique for all four switches by selecting different values of pull-up resistors. The voltage is then measured with the ADC to determine which switch has been pressed.

The circuit diagram shown below will probably give you a more clear picture of this technique. There are four switches (SW1-Sw4) connected to the AN0 input pin of the PIC12F683 microcontroller. Their one end is grounded through a common resistor R (=470 Ω), whereas the other end is pulled high through different value resistors (R1‘-R4‘), giving rise to different values of the voltage divider output. The voltage drop across the resistor R is thus unique for each switch press and is measured through the AN0 ADC channel. When no switch is pressed, the AN0 pin is pulled low through R, and the ADC should ideally measure 0 V.

Circuit diagram for connecting four tact switches to one ADC input channel of PIC12F683

There are four LEDs (LED1-LED4) connected to pins GP1, GP2, GP4, and GP5 of the PIC12F683 microcontroller. They will be toggled ON and OFF through the four switches.

Calculation of resistor R’

The resistors R1‘ – R4‘ determine the value of the voltage divider output for each switch press. We know that each resistor value must be different to create an unique analog voltage output across R for each switch. But how should we select their values? You should keep in mind that the resistors do have certain tolerance values and their values also change with temperature. Therefore, you should provide enough gap between any two consecutive values of the voltage divider output to avoid any conflict. The best practice would be to implement an evenly spaced values of the voltage divider for all 4 switches. Remember that when you press a switch, you should not expect a precise value of the analog voltage across the resistor R. It would fluctuate little bit within a certain range which is defined by the resistors’ tolerance values, temperature, contact resistance of the switches, and the stability of the power supply voltage. So, in order to identify the switch, what you are actually looking at is a range of voltage that the voltage divider output falls in.

The table below shows the ranges of DN defined for all four switches, and the corresponding values for resistor R’. DN stands for digital number and represents the 10-bit A/D conversion output, which is proportional to the input analog voltage. Suppose, we define the DN range of switch SW1 as 100-300. Our goal is to find the appropriate value of R’ to ensure that when SW1 is pressed, the 10-bit A/D output will be always in between 100 and 300 count. The minimum value of R’ would correspond to the maximum value of the count, which is 300 for SW1. The equation to find R’ for DN = 100 is,

1024*R/(R+R’) = 100, where R = 470 Ω.

This gives, R’ = 4342.8 Ω. Similarly, for DN = 300, the value of R’ should be 1134.3 Ω. Therefore, R’= 2.2 K would be an appropriate value for SW1. The rest of the R’ values for other switches are shown in the table below.

Table showing the appropriate values of R' for voltage divider network

Circuit setup on a breadboard

Software

The software involves few if checks to compare the A/D output with the predefined ranges to determine the switch that has been pressed.

   ADC_Value = ADC_Read(0);
   if(ADC_Value > 700) { // SW4 is pressed
     LED4 = ~LED4;
     Delay_250ms();
   }
   if(ADC_Value > 500 && ADC_Value < 700) { // SW3 is pressed
     LED3 = ~LED3;
     Delay_250ms();
   }
   if(ADC_Value > 300 && ADC_Value < 500) { // SW2 is pressed
     LED2 = ~LED2;
     Delay_250ms();
   }
   if(ADC_Value > 100 && ADC_Value < 300) { // SW1 is pressed
     LED1 = ~LED1;
     Delay_250ms();
   }

Download complete mikroC source code and HEX file

Note: The microcontroller runs at 4.0 MHz using its internal clock source and the MCLR is disabled.

Each tact switch toggles an LED ON and OFF

 

 

Summary

A technique of interfacing multiple tact switches using a single ADC input pin was demonstrated using the PIC12F683 microcontroller. A digital input from four tact switches were individually read through the AN0 ADC channel and displayed it back on an LED. While this technique saves input pins and reduces the size, one downside of the design is detecting combination of switches. The calculations of R’ resistors become more complex in such a case. The resistor values must be chosen very carefully so that the voltage resulting from a switch combination is unique.


--
With Regards,

s.m.sethupathy,
sms communication,
Tanjore -1.


mobile :9944 186 173           
      www.questionpaperlink.co.cc
      www.sethu-panguvarthagam.blogspot.com






Currently have 0 comments: