I am writing up some instructions for improved interfacing of a rotary encoder to a microcontroller (Arduino); and want to demonstrate a simple way to deglitch the noisy switching using an RC and a comparator. The standard choice for a cheap comparator is the quad comparator LM339 (or dual LM393) or its CMOS equivalent, which have open collector or open drain outputs. Unlike some odd requests I see for obscure devices (vacuum tubes etc.) , I think this falls squarely into typical use for a tool like this. A comparator with a few parameters would be nice. Something with parameters even simpler than your opamps:
I think gain would be a confusion factor, though allowing for a hysteresis might be nice from a generic system level comparator block. I implemented my comparator with your logic output comparator block and a MOSFET, but this adds an extra inversion such that the nominal implementation using an OC comparator would need to switch the input polarity. (Obvious, but a confusion factor for many of the sorts who will be using this tool). By the way, my congratulations on the high quality of this initial release; the bugs are minimal, I use an unsupported browser (Safari on OSX) with no problem. Not suitable for professional use, but quite functional and VERY NICE LOOKING schematics. (Better than most expensive CAD systems!) |
by CarlSawtell
March 07, 2012 |
The recently revised voltage controlled switch element (the threshold and hysteresis are now parameters) allows an even simpler way to emulate an OC comparator: |
by CarlSawtell
March 14, 2012 |
You can fake an open-collector comparator by using a fast op-amp with a diode, cathode to the output. Only about 300mV away from reality. |
by arduinohacker
March 20, 2012 |
Please sign in or create an account to comment.
CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.