So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By btidey
#91365 My rotary encoder button project https://github.com/roberttidey/RotaryEncoderButton allows a rotary encoder to be used to control various functions.

Of relevance here is the RotaryEncoderArray library it uses for accessing one or more encoders. The library uses interrupts and gives reliable output by using a state machine that deals with any bounce uncertainty in the switches as they rotate. It allows a maximum, minimum and step value to be set for each encoder. The GPIO pins used are set when an encoder is initialised.
User avatar
By Dynamo
#91366 First of all thanks for the information. In my prototype I use the nomeMCU. My project is about sending data collected by various sensors and send it by wifi (and possibly also by serial).
In my current prototype I have mounted:
- KY-023(joystick module) which I use with a 4051 multiplexer because the nodeMCU only has 1 analog input.
- GY-521 connected by I2C
And when I get the rotary encoder I will try to integrate it.

Apart from all this I would like to integrate 5 buttons, but I am short of GPIOs. If anyone knows of an option, let me know.
I had looked at the esp32 which has several analogue inputs, so I could maybe use the multiplexer to connect the buttons, although I'm not sure about that yet.
User avatar
By QuickFix
#91377 You could change using the ADC of the ESP to using a multi-channel I2C ADC for the joystick (X, Y and its switch), which would free up a couple of I/O's.

Another possible option is trying to get your hands on an I2C (Tindie project) rotary encoder like this one, but if you're outside Europe, this option might not be feasible (but on the up-side: you shouldn't have any problems getting the encoder working in your own project).
I believe you should be able to use the ADC on this board as well, so have the potential ability to connect your joystick to it as well, but I'm not entirely sure.

Just an idea, no personal experiences with that here.
User avatar
By btidey
#91378 Another idea if you want to deal with that much IO is to use the Scargill nano expander. https://tech.scargill.net/nano-peripheral/

This uses a very cheap small nano board as a general purpose expander. As it attaches to I2C you can attach it using the same I2C pins as for the GY-521.

The analog inputs on the nano are much better than on the ESP8266.

With this I think you could do away with the analog mux and have plenty of IO available.