Date: Fri, 29 Mar 2024 15:54:01 +0000 (UTC) Message-ID: <977481580.1.1711727641411@63153e0ecd5f> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_0_1024978447.1711727641392" ------=_Part_0_1024978447.1711727641392 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This Rotary Encoder driver can be used in conjunction with an incrementa= l hardware rotary encoder. A rotary encoder, also called a shaft = encoder, is an electro-mechanical device that converts the angular position= or motion of a shaft or axle to analog or digital output signals.
The Rotary Encoder has three parameters that need to be configured:
This pin provides the clock line from the rotary encoder. Any pin is sui= table.
This pin provides the data line from the rotary encoder. The signal occu= rs either before or after the clock signal determining the direction the ro= tary encoder is turned. Any pin is suitable.
This is the pin that transfers the signal when the rotary encoder is pus= hed on top. Any pin is suitable.
The GP0, GP1 and GP2 pins of the Builder Base are connected to the Clock= , Data and Switch pin of the rotary encoder. The GND and V+ pins of the rot= ary encoder are then connected to the GND and 3.3V ports on the Builder Bas= e respectively.
Breadboard
Schematic
Used Pins
Used Pins |
Description |
---|---|
GP0 (Can be any GP pin) |
The clock line |
GP1 (Can be any GP pin) |
The data line |
GP2 (Can be any GP pin) |
The switch line |
3.3V |
This pin provides the power |
GND |
This pin provides the GND |
Navigate to the App Builder and create a new application. You can find t= he =E2=80=9CLight=E2=80=9D code object under the =E2=80=9CHardware=E2=80=9D= Tab in the object drop down menu on the left, or you can also use the sear= ch bar.
Drag the =E2=80=9CRotary Encoder=E2=80=9D object onto the canvas.
The rotary encoder has three ports. First port is the =E2=80=9CIncrement= =E2=80=9D port. By rotating the encoder in the clockwise direction we can i= ncrease something. It depends on the parameters. Same with the =E2=80=9CDec= rement=E2=80=9D port. Rotating the encoder in the counter clockwise directi= on we are going to decrease. The =E2=80=9CButton=E2=80=9D port can be used = by pushing on the rotary encoder. We can use the button to start or shut do= wn something for instance.
For an example we will use the rotary encoder to control a dc motor. The= dc motor can be used to power a fan. When connecting the =E2=80=9CIncremen= t=E2=80=9D port with the =E2=80=9CClockwise=E2=80=9D port of the motor we c= an adjust the speed of the fan in the clockwise direction. Using the =E2=80= =9CDecrement=E2=80=9D port connected to the =E2=80=9CCounter Clockwise=E2= =80=9D port we can decrease the speed of the fan or even let the fan spin i= n the counter clockwise direction.
Navigate to the Firmware Builder and create a new firmware file.
Click the =E2=80=9C+ Add Hardware=E2=80=9D button which will open a moda= l window. Scroll down in the list to find the =E2=80=9CElectrical=E2=80=9D = section and select the =E2=80=9CLight=E2=80=9D hardware option.
Give your device a name, and click =E2=80=9CAdd Hardware=E2=80=9D
Next, select the =E2=80=9CRotary Encoder=E2=80=9D driver under the drive= r dropdown menu.
For this example we select:
CLK Pin: GP0
DT Pin: GP1
BTN Pin: GP2
You may now save your firmware file and upload it to one of your clients= .
Rotary Encoder
Apps
Firmware
Assets