Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LT SPICE switch simulation

Status
Not open for further replies.

MrDEB

Well-Known Member
Been working on a tilt circuit and ran across the SIGNALQUEST sensors and the data sheet suggests a filter. Simulated in LT SPICE but interpreting the best solution for a clear output with min switch bounce if possible or just do the de-bounce in code but having never used thisd form of filter in LT SPICE not sure if the results are what I need?
Comparing to circuit with out the capacitor. The output is connected to a pic port pin.
 

Attachments

  • switch filter.png
    switch filter.png
    71.3 KB · Views: 530
GOOD POINT
I want a clean output that the PIC will interpret as one switch closure. Trying different cap values but not even sure the spice sim is set up correctly. Presently using a voltage divider and it appears to work well but can it be improved. The data sheet for the tilt switch suggested using the filter so using LT SPICE I though I would look at what each filter is actually doing in simulation.
 
For debounce you need a LP filter, not a HP filter you are showing. For that the capacitor should go to ground from the junction of the two resistors.
 
This sim indicates that you might want to put a Schmitt trigger with about 1V of hysteresis between the sensor and the PIC port pin. Note that I went to some effort to model a case where the simulated sensor output V(bounces) has several bounces before settling to the other state. The RC filter lets some residual ripple through to the PIC pin, which might see this as multiple transitions through the Vcc/2 nominal trip point.
 

Attachments

  • D24.jpg
    D24.jpg
    255.3 KB · Views: 407
hi

I was curious about this request and was wondering if deboucing is really whats needed here,
so I did a little research and found some app notes.

It seems that whatever RC filtering is used, some sacrifice of sensitivity might occur since
the uC relies on the reading of the leading and trailing edges of the input signal (edge triggering) for the detection of motion/tilt. Maybe the filter should be adjustable?

Anyway...

Here is some info that might be helpful...

Sensitivilty control:
https://www.electro-tech-online.com...0App20Circuit20for20SEN-20020and20MIN-200.pdf

This site actually has PICBasicPro code for a Motion Detection demo circuit:
**broken link removed**

eT
 
Interesting reading THANKS.
Will have to construct both circuits. Been using a rolling ball sensor which works rather well but $17 each I don't think so. The signalquest sensor is $4.50 each but a min order of 25 is required. Have a sen645 samples but kinda buggie. Need to do more testing.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top