I'm using raspberry pi 4B 4GB. When I attach my encoder(model ENC-1-2-1-24) it works successfully. But, when I am in an industrial environment, the encoder gets noise. (No turning)

I use pull-down like the image below :

enter image description here

But, after one of 1k resistor, my voltage is 2.7 and raspberry doesn't receive input.

  • If the problem is electrical noise this is not the correct site,
    – joan
    Jan 20 '20 at 9:23
  • Ah, let me see. If your GPIO input protection resistor is only 1k then the 3V3 after the voltage division should be 3V3 * (10 / (10 + 1)= 3V3 * 10/11 == 3V0, should NOT be so low as 2.7V. Of course you can replace 1k by 470R or 560R, and try again.
    – tlfong01
    Jan 20 '20 at 10:22
  • Let us first agree on the schematic: imgur.com/gallery/QyI3ObT. (1) Assuming no inductive circuit connected the to rotary ouputs terminals, there should be no fancy things like back BMF or EMI, so no point adding flyback Schottky diode (actually no need at all to use the word "Schottky", it is there so the Arduino guys would respect me more than I deserve! :)).
    – tlfong01
    Jan 20 '20 at 10:31
  • Usually the Arduino guys know nothing more than the EE guys, who either know that much about noise. The only trick they do is to add 0.1uF at the output terminals to "by pass" / "decouple" stuff. (Don't ask me what is the difference between "bypassing" and "decoupling", I am just a friendly hobbyist! :)
    – tlfong01
    Jan 20 '20 at 10:37
  • 1
    @Dmitry Grigoryev, Ha, I used to add to my calculation the warning: "My calculations are always dodgy". But this time my calculation is indeed "correct", but my eyes are dodgy! :)
    – tlfong01
    Jan 27 '20 at 9:51

2.7V is only partly relevant. Raspberry will detect anything above 1.6V as "High", so having 2.7V (with a closed switch) is no explanation for the malfunction.

Still, you need to understand where that voltage difference of 0.6V come from: either you're measuring the wrong signal, or the actual schematic is different from what you've drawn. In both cases, finding the root cause will likely also explain why the encoder doesn't work.

I see no values for C1/C2: if those are high enough, then an intermittent 0-3.3V signal can easily become fluctuating around an arbitrary value, depending on the rotation speed and the width of the pulses.

Probing the signals with a scope would be the best: multi-meters are only useful for measuring voltages which you know for a fact are constant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.