LED interfacing with switch debouncing solution



CART
We if ordered by 4PM (excluding holidays), then courier usually takes 2-5 days. Available
Quantity :    Price : Rs. 0
Download Files
Our Return policy
    We will accept returns within 3 days from the date of delivery of the item.

LED interfacing with switch avoiding bouncing of switch

 

Press button once  = LED turns ON 

Press button again = LED turns OFF

 

-interfacing ckt.JPG

 

Switch Bounce

Switch bounce or contact bounce or even called as chatter is a common problem associated with mechanical switches and relays. Switch, relay contacts are made up of spring metals which are forced to contact each other by an actuator. While they collide each other there is  a possibility of rebounding for some time before they make a stable contact. It’s similar to case of dropping a bouncing ball or basketball. The ball keeps on bouncing till it comes to rest. This case can be taken analogous to on/off of a switch. When the ball touches the ground analogous to on and when it rises to certain level analogous to off of a switch. As a result of this effect there will be on/off transitions generated as the contacts rapidly open and close.

  • In short Switch bounce is a non ideal behavior which generates multiple transitions for a single user input.

-debouncing.JPG

This effect is not taken as important while doing power circuits or electrical circuits but creates a major problem while we deal with logic circuits. For example if you made a counter and it increments not by one but by any other value when you press the input switch and what if the units of increment is not uniform?

So here we have to remove bounces. And the method to get rid of such bounces is called Switch Debouncing.

 

Switch Debouncing

It can be implemented in 4 ways,

  1. Hardware Debouncing
  2. R-C Debouncing
  3. Software Debouncing
  4. Using Debouncing IC’s
code
#include<reg51.h>

sbit LED=P2^0;
sbit button=P1^1;

void delay(unsigned int time)
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}

void main()
{
int b=0;
LED=0;
button=1;
while(1)
{
if(button==0)
{
delay(50);
LED=1;
b++;
if(b==2)
{
LED=0;
b=0;
}
}
}
}


2017 All Rights Reserved | by: eucprojects.com