Introduction
This looks like a potentiometer, but it’s an encoder switch.
It is a cascadable 360 ° rotary encoder switch with 20 pulses per revolution, and each pulse corresponds to a detent. There are LED lights set for each detent to allow users visually check the real-time status of the encoder.
For ease of use, the module is designed with I2C data output and configurable accuracy within 1~51 for every detent (set in the program). For instance, when it is set to 1, turn on one LED light by rotating 2.5 revolutions; when set to 51, then one LED light can be switched on by rotating one detent.
In order to apply to more scenarios, the encoder is equipped with cascade function that enables to control multiple output devices by occupying only one I2C interface, such as, simultaneously controlling light brightness, color, volume, speed, etc.
Feature
- I2C Data output, foward rotation to increase, reverse rotation to decrease, easy to use
- Allow setting four different I2C addresses by I2C select switch
- Circular LED lights for visually displaying current value.
- 2 I2C outputs, can be cascaded
Applications
- Volume adjustment
- Fire regulation
- Speed regulation
- Light adjustment
Specification
- Operating Voltage: 3.3V~5V
- Total Rotating Angle: 360°
- Pulses Per Revolution: 20
- Interface: two Gravity connectors; I2C
- Cascadable Device Number: 4
- Rotation Lifespan: 30000±200 Cycles
- Contact Resistance: ≤100mΩ
- Insulation Impedance: 100MΩ above
- Oscillation: <10ms press
- Operating Temperature: -30℃~+80℃
- Accuracy: 1~51
- Minimum Settable Value: 1(Light up one LED when rotating 2.5 turns)
- Maximum Settable Value: 51(Light up one LED when rotating 1 detent)
- Storage: 0~1023
- Dimension: 37×37mm/1.46×1.46”
Board Overview
Num | Label | Description |
---|---|---|
1 | VCC/+ | Power+ |
2 | GND/- | Power- |
3 | SCL/C | I2C Clock line |
4 | SDA/D | I2C Data line |
I2C Address:
Special reminder: When multiple encoders are cascaded, it is necessary to set the I2C address in order to use them properly.
The address setting method is as follows: There are two address switches 1 and 2 on the back of the rotary encoder. Set the address switches according to the following table to obtain four different I2C addresses.
1 | 2 | ADDR |
---|---|---|
0 | 0 | 0x54 |
0 | 1 | 0x55 |
1 | 0 | 0x56 |
1 | 1 | 0x57 |
Tutorial
Requirements
- Hardware
- DFRduino UNO R3 (or similar) x 1
- Rotary Encoder Module (I2C) x 1
- Jumper wires
- Software
- Arduino IDE
- Download and install the Rotary Encoder Module Library (About how to install the library?)
Connection Diagram
Main API Functions
Example 1 - Get encoder basic information
- Function: get encoder basic information, current count value and rotation gain.
Expected Results
Example 2-Adjust encoder gain coefficient
Function: the encoder supports 51 accuracy values(1~51). Each time the encoder is rotated forward a detent, the corresponding analog value increases about 50. So, when the accuracy is set to 10, one LED will be switched on by rotating 5 detents.
Expected Results
Example 3 - Reset encoder
Function: press the button to reset the encoder counts. All LEDs turn off this time.
Expected Results
Data on serial monitor:
Example 4 - RGB LED color adjustment
Function: Adjust RGB LED ring color by three rotary encoders.
RBG LED Ring: to be updated.
Connection:
Special reminder: When multiple encoders are cascaded, it is necessary to set the I2C address in order to use them properly.
The address setting method is as follows: There are two address switches 1 and 2 on the back of the rotary encoder. Set the address switches according to the following table to obtain four different I2C addresses.
Expected Results
Data on serial monitor
Example 5 Control servo angle
Function: control servo angle by rotating the rotary encoder.
Expected Results
Example 6 Control LED light brightness
Function: control the LED light brightness by rotating the rotary encoder.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.