[Tutorial] How to Use Incremental Encoders with Arduino

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video I want to show you how incremental encoders work and how you can use them in Arduino based systems the encoder I will be using in this video is from the company Burns and works great together with the round display I showed in my last video because of its unique form [Music] factor first I want to take some time to explain how incremental encoders work on a mechanical level if you just want to see how you can use them Jump Ahead to the next chapter and an incremental encoder is a type of electromechanical device that converts the angular position or motion of a shaft into digital output signals while they seemingly work similar to potentiometers which increase or decrease electrical resistance they operate in a very different way unlike the absolute encoder counterparts incremental encoders provide relative position information indicating how much the shaft has moved but not its actual position this has the advantage that they do not have a limited range of movement but can inre increase or decrease a value endlessly the heart of an incremental encoder is its dis which contains a series of markings or slots this dis attached to the moving part of the system rotates between a light source and a photo detector as the dis spins the markings erupt the light beam creating a series of pulses that are then converted into electrical signals these signals are known as a and b outputs they not only indicate movement but by comparing their phase shifts can determine the direction of rotation the wiring for the incremental encoder I'm using is quite simple as it only has three pins however in the provided data sheet there was no pinout included so I had to do some trial and error as well as some fiddling around with the multimeter to find out which pin is connected to ground the other two pins can just be connected to any GPI open on your microcontroller in this example I'm using an aduino Nano with the pins 2 and three first we read the current state of these pins treating one as the most significant bit and the other as the least significant bit by Shifting The most significant bit and combining it with the least significant bit using a bitwise or operation we create a two bit value representing the encoder's current state to detect rotation direction and steps We compare this current state with the previous one generating a unique for value this value is key it tells us not only that the encoder has moved but also in which direction it's turning because of Hardware constraints like the resting position of the encoder only every second step is detected to avoid a double incrementation on every second step I just added a simple if condition that only counts every second step depending on the type of incremental encoder you are using this might however not be necessary I might do a short demonstration of the encoder together with the round TFT display for my last video in the future the code will be available in a GitHub repository that you can find in the description below see you in the next one
Info
Channel: Philipp Thalhammer
Views: 2,881
Rating: undefined out of 5
Keywords: IncrementalEncoders, ArduinoProjects, BurnsEncoders, EncoderTutorial, ArduinoNano, MechanicalEngineering, ElectronicsTutorial, DIYElectronics, EncoderWiring, RotaryEncoders, ArduinoProgramming, EncoderAndArduino, DIYEncoderWiring, ElectroMechanicalDevices, AngularPositionSensing, DigitalOutputSignals, EncoderCodeExample, DirectionOfRotation, ElectronicsComponents, MicrocontrollerProjects, ArduinoForBeginners, STEMEducation, EngineeringTutorial, TechDIY
Id: EtLhADPj0QM
Channel Id: undefined
Length: 3min 20sec (200 seconds)
Published: Sun Mar 17 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.