Scanning encoder debounce on new scope


+ Reply to Thread
Results 1 to 22 of 22
  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668

    Default Scanning encoder debounce on new scope

    SOLVED: Had probes set on AC coupling instead of DC coupling. D'OH!


    I am scanning an EC11 rotary encoder wired according to Bourns debounce design using a Owon SDS1104 scope:

    R1 = 10K
    R2 = 10K
    C = 0.1uF (Bourns uses 0.01uF)

    https://www.bourns.com/docs/technica...rsn=348415eb_4


    This is what the scan looks like:




    The peak voltage slowly drifts up as I turn the encoder, and then settles back down. That is not the problem.

    I'm concerned with the low voltage, it's also drifting up, well above the 0.8V threshold that is often referred to in Microchip documentation as the LOW level. The 10 or so encoder signals on the right would not get picked up.

    Is this normal with RC circuits?

    Or is the graph on this $250 DSO drifting north because it's low quality?
    Last edited by Demon; - 7th June 2024 at 22:05.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,531


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    I'd be more worried by the fact that signal swings negative and not positive :-)
    Don't worry though, it looks like you have the input coupling set to AC on the scope. Set it to DC and try again.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Quote Originally Posted by HenrikOlsson View Post
    ... Set it to DC and try again.
    Thanks! I thought of rechecking my stuff a Nth time yesterday and noticed the coupling too.

    All is well in the world.


    Name:  Scope DC coupling.jpg
Views: 87
Size:  224.1 KB
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Got this from AllAboutCircuits. First time I hear about a MC14490, Hex Contact Bounce Eliminator:




    Too bad it's in multiples of 6 pins. It would be perfect if it was 8; that way I could have 2 ICs running alongside MCP23017 I/O Expanders with no waste.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Feb 2023
    Posts
    7


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Wow, I designed those into counting circuits about 45 years ago.....

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,850


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Nice chip! I did not knew that one although I am of the CMOS era!

    Anyway, since you master the art of software, I think is waste of money to add hardware when you can debounce in software.

    Plenty of ways to do that and as you said, going into production, will save you a lot of money and complexity.

    One example. Read all buttons in an array. After a period of say 10ms, read again and compare all the buttons. One pass, reading and debouncing all buttons.

    Ioannis

  7. #7
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Quote Originally Posted by Ioannis View Post
    Nice chip! I did not knew that one although I am of the CMOS era! ...
    I also found the MAX6818 debouncer, but it's $4.37 for 8-bit at JLCPCB.


    Quote Originally Posted by Ioannis View Post
    ... since you master the art of software, I think is waste of money to add hardware when you can debounce in software. ...
    More like master of none.


    Quote Originally Posted by Ioannis View Post
    ... One example. Read all buttons in an array. After a period of say 10ms, read again and compare all the buttons. One pass, reading and debouncing all buttons.

    Ioannis
    I might still go for that. But I'd really like to avoid any debounce on the PICs so they are free to USART with the main USB PIC.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,850


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Quote Originally Posted by Demon View Post
    I might still go for that. But I'd really like to avoid any debounce on the PICs so they are free to USART with the main USB PIC.
    This can work just fine:

    1. Set up a timer interrupt at 10ms. Or even at 1ms and after ten int's do step 2.

    2. Every interrupt read the buttons into the arrays. You can use a low priority interrupt if the PIC supports it.

    3. Either with or without interrupt use the hardware USART to communicate. If you choose interrupt driven USART, use it as high priority, or Disable as long as you do serial, the timer interrupt.

    Problem solved.

    Ioannis

  9. #9
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    I wanted to see just how sharp a Schmitt trigger could clean up a signal.

    This is using a MR0102 with rocker actuator, followed by the Bourns RC debounce circuit, and then inverted with a TCC74HC14 Schmitt trigger, followed by LED/330R resistor:

    Name:  Debounce with Schmitt Trigger.jpg
Views: 58
Size:  428.6 KB

    (text on image has been corrected)


    Datasheet says negative threshold is 1.6V at 4.5V. This is USB 5V, so 1.8-1.9V seems ok to me.
    Last edited by Demon; - 11th June 2024 at 04:02.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  10. #10
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,850


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    What a magic tool Oscilloscope is, right?

    Ioannis

  11. #11
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Darn tootin' right.

    It's nice to finally use it as a diagnostic/testing tool. The scope has always been a mystery to me. I've always wanted to use one, but never had any electronics training. So it's slow; getting old and a worsening memory doesn't help, but help from you folk make it fun.

    One thing is for sure, I wouldn't hire me to do this stuff.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  12. #12
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,531


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Your waveforms seem to indicate that you might benefit from adjusting the trimmer capacitor on your probe(s).

  13. #13
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Quote Originally Posted by HenrikOlsson View Post
    Your waveforms seem to indicate that you might benefit from adjusting the trimmer capacitor on your probe(s).
    I noticed that "rhythmic pulse" too. I figured it might be the breadboard.

    I wanted to enjoy my scope for a few days before tweaking it and messing it up.
    😄
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  14. #14
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,531


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    OK, if you just want to see squiggly lines on the screen :-)
    But you're not going to mess it up. It's part of verifying that it actually works as it should.
    Compensating the probe, or at least veryfying its compensation, should ideally be done whenever you move a probe from one channel to another - which is another great reason to use the color coded rings on the probes so that the same probe gets used on the same channel each time.

    Without a properly compensated probe your scope will not display a "true" representation of the waveform and things like automatic risetime and peak-to-peak voltage measurements might be incorect.

    I'm sure there's a section, close to the beginning, in the manual on how to perform the probe compensation.

  15. #15
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Vevor SDS1104 4 channel scope

    So I finally got around to compensate each probe (in their colour-coded connector, just in case that matters). Also auto-calibrated the scope; very straight-forward.

    Before/after compensating:



    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  16. #16
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Vevor SDS1104 4 channel scope

    Before compensating, the probes had a slight up-tick/down-tick when changing edge:




    That is now gone, so I must have done something right:



    Yellow, encoder A
    Blue, encoder B
    Beige encoder A after Schmitt trigger
    Green encoder B after Schmitt trigger


    But there is still some static that cycles through at a regular rhythm. Here it is at a slower rate so it's more apparent:




    This could just be an artifact on the USB port (have that static on PC USB port and external hub). I'll have to test on another 5 VDC power source.
    Last edited by Demon; Today at 05:19.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  17. #17
    Join Date
    May 2013
    Location
    australia
    Posts
    2,398


    Did you find this post helpful? Yes | No

    Default Re: Vevor SDS1104 4 channel scope

    But there is still some static that cycles through at a regular rhythm. Here it is at a slower rate so it's more apparent:
    would your mains power be at 60Hz ?
    hint 16.667mS

    the A B debounce looks very uneven between rising and falling edges. the unequal phase shifts so introduced will make R.E data interpretation interesting, especially at varying rotational speeds
    Warning I'm not a teacher

  18. #18
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,850


    Did you find this post helpful? Yes | No

    Default Re: Vevor SDS1104 4 channel scope

    Do you have any Switch Mode Power Supplies, either 5Volts or other?

    The noise might be because of that. If it is on a specific pattern and rate then something else cause this. Either clock, interrupt or as you said USB action.

    Critical decoupling may come to rescue. Also earthing correctly also may help.

    Ioannis

  19. #19
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Vevor SDS1104 4 channel scope

    ARGH.... I finally found out what is that regular noise, the probes reset to AC coupling. I haven't looked in the manual yet if there's a way to save the current setting as Default.




    About the uneven edge spacing, it's mostly the A wiper (yellow) that varies a LOT. B wiper seems to remain stable on average (sometimes it gives a longer intermission, but nothing as radical as A wiper).

    I don't know if it's me that damaged the rotary encoder, or if it's "cheap" that way. I turned it countless times both directions, and I don't find a pattern.

    If I turn CW and get a long intermission, I turned 2 clicks CCW, then turned again CW, but didn't get the long intermissions again.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  20. #20
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    I moved the posts here from the SDS-1104 review thread.


    Quote Originally Posted by HenrikOlsson View Post
    Your waveforms seem to indicate that you might benefit from adjusting the trimmer capacitor on your probe(s).
    Yup, waveforms are cleaner now.
    Last edited by Demon; Today at 05:20.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  21. #21
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,668


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Quote Originally Posted by Ioannis View Post
    ... Anyway, since you master the art of software, I think is waste of money to add hardware when you can debounce in software.

    Plenty of ways to do that and as you said, going into production, will save you a lot of money and complexity....
    I know. But I haven't started coding yet and don't know exactly how burdened my processors will be. I prefer to start with hardware debounce, and then see as I advance. It's a lot easier to take stuff off a PCB, than to add it all later.


    ...insert drum roll and trumpets here...

    I present to you, the Encoder Driver v1: 24 encoders, 1 switch, debounced according to Bourns, inverted via 74HC14 Schmitt triggers, in a 30mm x 160mm vertical package. I have 180° pins on the design, but it'll be 90° pins on the final product.

    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  22. #22
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,850


    Did you find this post helpful? Yes | No

    Default Re: Scanning encoder debounce on new scope

    Hmm, too many wires to connect switches and encoders. Have you thought about that? For a production this is very time consuming.

    Ioannis

Similar Threads

  1. Keypad with hardware debounce
    By Demon in forum General
    Replies: 3
    Last Post: - 27th December 2014, 02:47
  2. Continueous ADC scanning using DT interupts
    By comwarrior in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th March 2010, 22:18
  3. scanning BCD switches
    By dsicon in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th June 2008, 17:57
  4. Debounce PULSIN?
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 6th March 2005, 14:45
  5. 3x4 keypad scanning problem and others
    By pt3rg in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd December 2003, 02:21

Members who have read this thread : 11

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts