New Grove Product – Grove Rotary Dial and Button Combo for Raspberry Pi
In designing the new SmartPlantPi Kickstarter, we had a need for a Grove rotary dial and button. All the ones on the market did not handle 3.3V/5V well and they did
not support the built-in button (push the dial down) on the encoder. Since we wanted to use it as a button too in our new interface, we designed a new product and now we are offering it separately per customer request.
You can buy this Grove Rotary dial here.
This is a Grove 20-step rotary encoder breakout board with a nice ‘clicking’ feel. and has a pretty handy select switch (by pushing in on the knob). The encoder is different from a potentiometer in that an encoder has full rotation without limits. The unit outputs gray code so that you can tell how much and in which direction the encoder has been turned.
3.3V and 5V compatible.
This unit does not come with a knob and the shaft is 6mm.
Grove Connectors
There are two Grove Connectors on this board. One for the Rotary Encoder and one for the Push in Button. Both are supported in the software.
Downloads
- – Raspberry Pi Pure Python Software – SDL_Pi_RotaryButton – includes example of use code
- – Arduino Rotary Dial and Button Software Readily Available
Software Example
Python Code
#!/usr/bin/env python # # Test SDL_Pi_RotaryButton # # January 2017 # #imports import sys import time import datetime import SDL_Pi_RotaryButton # Main Program print "" print "Test SDL_Pi_RotaryButton Version 1.0 - SwitchDoc Labs" print "" print "Sample uses:" print " SDL_Pi_RotaryButton_Enc_A = 4" print " SDL_Pi_RotaryButton_Enc_B = 5" print " SDL_Pi_RotaryButton_RotaryButtonClick = 21" print "" print "Program Started at:"+ time.strftime("%Y-%m-%d %H:%M:%S") print "" rotary = SDL_Pi_RotaryButton.SDL_Pi_RotaryButton() print "Reading Rotary" print "Button stops read Reading Rotary" # example readRotary currentValue = 0 # readRotary(currentValue, bottomRange, topRange, increment, timeout, buttonTimesOut) rotary.readRotary(currentValue, -30, 30, 0.5,10.0, True) while (not rotary.checkIfRotaryDone()): print "rotary current value = ",rotary.readCurrentValue() time.sleep(0.2) print "final rotary value =", rotary.readCurrentValue() # now show how to use button seperately print "hit rotary button to quit" while (not rotary.hasButtonBeenPushed()): print "no button" time.sleep(0.5) print "button pushed"
Output from Raspberry Pi
pi@RPi3-62:~/SDL_Pi_SmartPlantPi/SDL_Pi_RotaryButton $ sudo python testReadRotary.py Test SDL_Pi_RotaryButton Version 1.0 - SwitchDoc Labs Sample uses: SDL_Pi_RotaryButton_Enc_A = 4 SDL_Pi_RotaryButton_Enc_B = 5 SDL_Pi_RotaryButton_RotaryButtonClick = 21 Program Started at:2017-01-14 14:08:30 Reading Rotary Button stops read Reading Rotary rotary current value = 0 rotary current value = 0 rotary current value = 0 rotary current value = 0 rotary current value = 0 rotary current value = 0 rotary current value = 0 rotary current value = 0 rotary current value = 1.0 rotary current value = 1.0 rotary current value = 1.0 rotary current value = 1.0 rotary current value = 1.0 rotary current value = 1.5 rotary current value = 0.5 rotary current value = 0.0 rotary current value = -0.5 rotary current value = -0.5 rotary current value = -0.5 rotary current value = -0.5 rotary current value = -0.5 rotary current value = -0.5 final rotary value = -0.5 hit rotary button to quit no button no button no button no button no button no button button pushed pi@RPi3-62:~/SDL_Pi_SmartPlantPi/SDL_Pi_RotaryButton $
OK… So how do I purchase it?
https://store.switchdoc.com/grove-rotary-dial-with-button/
🙂