Projects   /   Communication & Interfacing   /   PIC18F458

Rotary Encoder Interfacing with PIC Mirocontroller

i am currently working with some power supply design and i can say using conventional pots(potentiometer) and rotary switch to adjust the voltage and other...

Published

At a glance

CategoryCommunication & Interfacing
PIC modelPIC18F458
IncludesDownload files
Reading time~2 min

Summary of Rotary Encoder Interfacing with PIC Mirocontroller

Incremental rotary encoders are digital substitutes for potentiometers, providing pulse outputs that require decoding (often via a microcontroller state machine) to determine rotation direction and steps. The article describes waveform behavior, state-machine decoding, interfacing with a PIC18F458 (schematic), and provides source code/firmware download for implementation.

Parts used in the Incremental Rotary Encoder project:

  • Incremental rotary encoder
  • PIC18F458 microcontroller
  • Wiring/connectors
  • Power supply for PIC18F458
  • Supporting passive components shown in schematic (resistors, capacitors)
  • Optional rotary switch or potentiometer for comparison
  • Programming/debugging tool for PIC
i am currently working with some power supply design and i can say using conventional pots(potentiometer)  and rotary  switch  to adjust the voltage and other stuff is quite old school.
so i have decided to go for a bit high tech , actually bit digital.
so here is the solution
Incremental Rotary Encoder
first of all i would like to tell you , these type of rotary encoder is totally digital component so you can't directly replace these  with you conventional pots. so lets start what are Incremental Rotary Encoder ,
Rotary Encoder Interfacing with PIC Mirocontroller
and hear the output wave form
ROTARY encoder with microcontroller avr arduino

Decoding with Microcontroller 


in this examples we will be decoding the rotary encoder with the help of sate machine.

ROTARY state
view of state machine in the wave form
ROTARY WAVE
Schematic with PIC18F458
Rotary encoder pic micro pic18 arduino avr atmega incremental encoder digital pot
Rotary encoder microcontroller arduino pinout
Rotary encoder pic micro pic18 arduino avr atmega incremental encoder digital pot breadboard
Source code and firmware

CLIK Here To download Source Code and Firmware. if you have any problem please leave in the comment section.
Source : Rotary Encoder Interfacing with PIC Mirocontroller 
  • What is an incremental rotary encoder?
    An incremental rotary encoder is a totally digital component that outputs pulses representing rotational movement, used instead of conventional potentiometers.
  • Can an incremental rotary encoder directly replace a potentiometer?
    No, it cannot be directly replaced because it is a digital component and requires decoding via electronics or a microcontroller.
  • How are encoder outputs decoded?
    Encoder outputs are decoded with a microcontroller using a state machine to determine direction and steps from the waveform.
  • Does the article provide a schematic for interfacing?
    Yes, the article includes a schematic showing interfacing with a PIC18F458 microcontroller.
  • Is source code or firmware available?
    Yes, source code and firmware are available for download as mentioned in the article.
  • What microcontroller is used in the example?
    The example uses a PIC18F458 microcontroller.
  • How is the state machine illustrated?
    The state machine is shown in the waveform view to explain decoding steps.
  • What should I do if I have problems with the code?
    The article asks readers to leave problems in the comment section.
Ibrar Ayyub

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough...