Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/28/04 16:07
Read: times


 
#83984 - Debouncing: again, but different...
Hi all,

I've read a lot about switch debouncing, also seen the possible hardware solutions (some even 'solid as a rock').

However, they were (almost) all talking about small keyboard switches.

Here's what I have:

I'm building a system to 'automate' my house. One of the things I want to do, is detecting if someone has pressed an ordinary switch of a light circuit. That switch is normally used to switch (in Europe) a 230V circuit. It's a normal open switch or, better, a SPST version (single pole, single throw).
In my case, this switch will only switch a very low current to ground (is normally ment to switch some 10A on 230V):
+5V -> resistor (e.g. 10k) -> diode part of an opto coupler -> switch -> ground
The output of the opto coupler will be connected to an input pin of a PCF8574 (IO expander). With the necessary additional hardware, of course:
+5V -> resistor (e.g. 10k) -> collector of opto coupler transistor -> ground
This 5V will be completely isolated from the +5V of the 'diode' side, of course.

This setup will be the same for all my switches (some 50 in total). That means: quite a few PCF8574's to be used...

I will (mis??)use the interrupt that is being generated by the PCF8574. Since you can wired-AND those interrupts, they can all be connected to one and the same interrupt of an 8051-based microcontroller.

Once a button is pressed, I will get an interrupt. After decoupling from the ISR, I will poll (via I2C) the states of all the 8574's and compare there individual state with a cached state I have in my SW.
After comparing, I will be able to detect which switch has been pressed.

I should also have the possibility to see if a button is kept pressed for a while. Therefore, whenever the first interrupt is fired, I will start a timer. If I get a new interrupt indicating a button is released (following the same procedure as described above wrt the IO expander polling), then I will measure the elapsed time.
Depending on the time measured, I will be able to tell if it was a 'normal' switch press or an 'extended' one, and give the appropriate interpretation to it.

This is a rough explanation about the setup I'm thinking to use...

But...

Since I'm talking about a very ordinary switch (so, no special mechanisms applied to reduce bouncing or whatsoever), and seen the setup I have in mind:

    - can I also apply the recommendations given in the many other threads?

    - Will this setup be reliable enough for its purpose? Speed is not that important I assume, seen the application.

    - Are there other/better approaches for this?


Any input/advice/recommendation is welcome.

Rgds,

-- Geert

List of 9 messages in thread
TopicAuthorDate
Debouncing: again, but different...            01/01/70 00:00      
   switches            01/01/70 00:00      
      ?            01/01/70 00:00      
         mermaids            01/01/70 00:00      
   A complex array ....            01/01/70 00:00      
      Further,            01/01/70 00:00      
      Debouncing: again but different            01/01/70 00:00      
   Is debouncing really needed?            01/01/70 00:00      
   ?            01/01/70 00:00      

Back to Subject List