Rotary Encoder Not Incrementing

I’ve got a rotary encoder hooked up to an ESP32-WROOM-32D setup in ESPHome. However, when turning the knob of the encoder, no change is recorded in the logs. Oddly enough, if I disconnect the positive jumper, rapid changes are recorded, is my ESP busted?

ESP32 Log Config Output

[13:44:54][C][logger:189]: Logger:
[13:44:54][C][logger:190]:   Level: DEBUG
[13:44:54][C][logger:191]:   Log Baud Rate: 115200
[13:44:54][C][logger:192]:   Hardware UART: UART0
[13:44:54][C][rotary_encoder:141]: Rotary Encoder 'Rotary Encoder'
[13:44:54][C][rotary_encoder:141]:   State Class: ''
[13:44:54][C][rotary_encoder:141]:   Unit of Measurement: 'steps'
[13:44:54][C][rotary_encoder:141]:   Accuracy Decimals: 0
[13:44:54][C][rotary_encoder:141]:   Icon: 'mdi:rotate-right'
[13:44:54][C][rotary_encoder:142]:   Pin A: GPIO18 (Mode: INPUT)
[13:44:54][C][rotary_encoder:143]:   Pin B: GPIO19 (Mode: INPUT)
[13:44:54][C][rotary_encoder:147]:   Resolution: 1 Pulse Per Cycle

ESPHome YAML Config

sensor:
  - platform: rotary_encoder
    name: "Rotary Encoder"
    pin_a:
      number: GPIO18
    pin_b:
      number: GPIO19
    accuracy_decimals: 0

PICTURES!!

I guess I don’t know how breadboards work?? I unplugged everything and ran straight off the pins of the ESP32 to the encoder and it worked perfectly fine. Are you not supposed to use depont jumpers with these kinds of breadboards? This is the second type I tried with the same behavior…

Is it a breadboard you have? To me it looks like a proto/pcb board and not a solderless breadbord

Yes, it’s a prototype PCB…I made the assumption that electricity would flow as long as there were metal contacts. I guess I would have to solder everything in for it to work??

I am looking at a similar project but would like to know if i can run 4 rotary encoders on 1 ESP32, is this possible?

cheers

So ya…I assumed these prototyping PCB through-holes were wire throughout, appears that’s not how they are. Once I soldered everything together, it all worked just fine…sooo much to learn.

@frank451 I guess it depends on the encoder. The lowest voltage I’ve seen is 5v, including what I am using, but it seems to work on 3.3v just fine. I’m incredibly new to this stuff, but I would imagine you would use a 20v dc adapter, wire it into one side of the breadboard power rails, and then use a resistor between the positive rail and the encoder that would drop the voltage down to 5v. This calculator using 20v input, 5v output, and current draw of .050amps (Using the amperage output of the 3.3v on ESP32 as a reference), shows you’d need 300 ohm 3/4 watt resistor for each circuit. This would be a separate power supply from what is powering the ESP32 and use a set of power rails that does not connect back to the ESP32. The 20v would only power the encoders and then the CLK and DT pins would go back into the ESP32.

I think it would probably be better to ask this over in the hardware section though.

Why do you think it would need 20v?

I think the answer is that decoding a rotary is well within the esp32’s capabilities. I would think you can run (as many as the esp32 has pins) /2 as they need two pins each.

If you want to use the handy switch that they usually have, I would say /3.

I would assume because you have to supply them with power.

But they don’t work on 20v.

Right, but if you supply 5v, and you are trying to power 4 of them, wouldn’t that only give each of them 1.25v?

No you power them in parallel, not in series.