I’ve watched the video on how to use a rotary encoder with a raspberry pi but in the video it talks about connecting a 5v pin and mine doesn’t have one. How would I wire and use it?
You don’t need a 5V supply for a rotary encoder that is the rotary mechanism only. The 5V supply is only required if the encoder is provided as a module that includes additional features such as a LED or debounce circuitry. However it might not be possible to simply ignore the lack of a 5V connection. Depending on the device used in the tutorial you are following the need for a pullup on the signal lines might not be mentioned, as it could be incorporated in the module. As your encoder does not have a 5V connection then you must provide that pullup for yourself. So, if it’s not already mentioned in the instructions, make sure that the code specifies that the GPIO pins used for the A and B inputs from the encoder are marked as having the Pico internal pullup enabled. There is some discussion here. You might be using different code, but the principal is the same for other languages.
Hi all
If using the Core device, SKU: CE09436, a simple R/C debounce filter is on board. This is completely passive and can be 5V or 3.3V. The board used to be marked 5V but was supposed to be rectified. May or may not have happened.
Pull up resistors are on board for both encoder and push button.
There is NO de bounce filter on the push button.
There is another one by Adafruit sold by Core, SKU: ADA5880, which has I2C communication and everything on board. This one is marked “Vcc” and I have used with Arduino so is 5V tolerant. Reports number of pulses (+ or -, = CW or CCW) WRT switch on or reset. Works pretty well.
Cheers Bob.
PS: with SKU: CE09436 being passive the “5V” and “Gnd” connections can be swapped if required for some reason.
Add on: If you read all the comments on the Core page for SKU: CE09436 there is a lot of discussion re de-bounce in general and measurements taken with this device.
EDIT:
SKU: ADA5880 also reports “button pressed” and an interrupt signal to alert when something changes.
Welcome to the forum!
We have this guide for using a rotary encoder with a Pico that should get you pointed in the right direction.
Getting Started with Rotary Encoders | Examples with Raspberry Pi Pico - Tutorial Australia