You can get in the ball park with
f = 1000 = 1/(2*pi*RC)
where R is the pullup resistor value
It's more apropos to calculate the time constant, but I can't recall that formula right now.
You can get in the ball park with
f = 1000 = 1/(2*pi*RC)
where R is the pullup resistor value
It's more apropos to calculate the time constant, but I can't recall that formula right now.
Sure, yeah, the time constant is asymmetrical but it is the slowest constant that matters... charging through the pull up resistance. It's far from a detailed estimate but it will get you close to the 1kHz you mentioned.
In which case there is no need to de-bounce anything. There is nothing to cause a bounce in the first place.
Contact bounce is only a problem on mechanical switches where the mechanical action of moving two contacts together causes rapid sequence of making an breaking. This will not happen on an optical encoded rotary sensor, or from signals derived from none mechanical contacts.
Never said it was.
That was the confusion i thought the 1284P was a chip not the ATmega1284P.
However, the state machine that reads the encoder pulses should eliminate any bounce if it is done correctly. Sadly a lot of libraries do not do it properly.
This is one that does:-
http://www.pjrc.com/teensy/td_libs_Encoder.html
Edit - and you need 1K pull up resistors, the internal ones are not strong enough.
If you dont know the characteristics of a signal you really have no basis for processing it. So your first step should be identifying the motor and its encoder.
Its very unlikely to have moving contacts, much more likely an optical or magnetic encoder. Neither of these would benefit from degrading the signal edges with a capacitor.
I highly doubt a motor encoder will be mechanical.
It would wear out in a matter of hours.
The ones I have seen had hall sensors, which you don't need to debounce.
Leo..
Hello @Delta_G ,
This might be of interest as background information about how to read a rotary encoder: Reading rotary encoders as a state machine
You want to keep the fundamental frequency and and around the first 5 harmonics, otherwise you will just get a very small amplitude sinewave.
For a squarewave the harmonics are at odd frequencies.
Fundamental = 1kHz (first harmonic)
Second harmonic = 3khz
Third harmonic = 5kHz
Fourth harmonic = 7kHz
Fifth harmonic = 9kHz
So your Low Pass Filter (LPF) should have a cutoff frequency of about 9kHz
fc = 1/(2πRC)
Using common value components we have:
R= 20K, C= 1nF then fc= 7.95kHz, good enough
Cross-talk is more likely if the value of the pull up resistors is too high.
Try 1k.
Leo..
It is likely that the fact that all the grounds being connected together caused a ground bounce causing the cross talk. This is also sometimes called ground lift.
This can happen if the chain of grounds is some way from the main ground.
All conductive surfaces have capacitance between them. But if you run the numbers, you would find that the capacitance in this case would be in the nanoFarad range, not even close to the component value.
That is probably at least 1000 times the inter-component capacitance. I meant femtoFarads... a ballpark extremely generous estimate would be about 1pF. My bad.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.