Skip to main content

Switch debouncer using SR Latch

We use switch in our day to day life to switch ON/OFF a bulb or a fan or  any electrical devices. But when we use switches in digital circuits, we observe a phenomenon called bouncing. This occurs because, when we turn the switch, the mechanical parts vibrate. i.e It toggles between ON and OFF state for some time until the mechanical contact attain equilibrium. this vibrations are minute and are not at all noticeable in electrical circuit. where as in digital circuits, these vibrations create pulses. which are detected by circuits which results in an error.
              In the above circuit, there is a switch connected to VCC. You can toggle it between terminal 'a' and terminal 'b'. which as a voltage drop of 'Va' and 'Vb' respectively. In digital circuits if you can observe, it takes a finite amount of time to toggle between terminal 'a' and 'b'. which might approximately take 15ns. Now let us consider the terminal is at 'a'. we will switch it to 'b'. what we can observe are...
  • It takes finite time (approximately 15ns) to make contact with terminal 'b'.
  • Once the metal contact touches the terminal 'b'. It bounces several times before it reaches equilibrium.

So for the above circuit, the timing diagram is as follows...


From the timing diagram it is evident that there are several unwanted pulses which are present due to bouncing. This can be eliminated by using SR latch using NOR gates.
Switch debouncer


TRUTH TABLE for SR Latch using NOR gates

S           R          Q             Q'
1            0           1              0
0            1           0              1
0            0           No change
1            1          monostable state

The timing for the switch debouncer is shown below.

Here we can see that during switching time, 'Va' is high. this is because, during switching time Va and Vb are zero. According to the truth table, at S=0 and R=0, the output is the previous state. Hence 'Va' continues to be high.when the metal contact touches the B terminal. S=0 and R=1. Hence 'Vb' becomes high, because of the bounce effect, Vb and Va becomes 0. but from truth table we know there is no change in output when S=0 and R=0. hence Vb continues to be in high state irrespective of number of bounces in the metalic contact.


Comments

Popular posts from this blog

PIC 18F452 Programming: LED blinking using assembly

Here is the basic program you need to start off with when you learn to use a microcontroller. We are using the microchip family PIC microcontroller. Which stands for Peripheral Interface Controller, PIC 18F452 is a 40 pin 8-bit microcontroller with 32 KBytes flash, 1536 Bytes of RAM and 256 Bytes EEPROM. It also boasts 4 timers, and three external interrupt pins. Coming to our first program, We will be using MPLAB for Building this project. Create a new project and select MPASM Suite for compiling. After writing the program, Dont forget to add the linker file and the source file in the source window. The linker file for the PIC 18F452 can be found in the  C:\Program Files\Microchip\MPASM Suite\LKR. search for 18f452. In this program, the Bit RB0, toggles continuously with some delay. Connect an LED to The RB0 Pin, i.e Pin 33.connect a 330E resistor in series with the LED. PROGRAM #INCLUDE p18f452.INC; CONFIG WDT=OFF; disabling the watchdog timer ORG 0; Specifing th...

ADXL 355 Accelerometer

A few days ago I went to get components for a project I was building. and came across a 3-axis accelerometer. So I decided to test it and make a post to give you an idea of things work and how you can use it. ADXL 355                   The accelerometer I have is ADXL 355 v2.0 board. there is are 5 headder pins, ground, 5V supply, X-axis output,Y-axis output and Z-axis output. It is quite compact. The one I have measured around 15mm x 15mm. These sensors are low cost. And can be incorporated in Projects or robots we build. The ADXL 355 board I have has an onboard Red led (smd) for the indication of power. The accelerometer has a wide range of applications. ADXL 355 is a basic accelerometer which gives analog values for all the three axis depending upon the position of the IC. ADXL 345 is an advanced accelerometr which can detect free-fall,activity,tap,double tap and communicates via I2C. The ADXL is a a ultra-lowpower as it consumes only 25 u...