How To Use A Rotary Encoder Without Software

  Рет қаралды 15,843

Gadget Reboot

Gadget Reboot

6 жыл бұрын

If you need to quickly get a rotary encoder project up and running and there's no time for setting up an Arduino or micro controller, if you have some basic digital logic chips there's several ways to get a prototype going.
Patreon: / gadgetreboot
Pinterest: www.pinterest.ca/GadgetReboot
Twitter: @GadgetReboot / gadgetreboot

Пікірлер: 37
@arenotdiy7280
@arenotdiy7280 3 жыл бұрын
I built it just as you designed with AND gates, and it worked fantastically on 5 volts, battery operated. I built my own rotary encoder breakout board with 2k ohm current limiting resistors, so maby that was what made the difference, but all I needed was a decoupling cap of one micro farad across a and b. Thanks for the info!
@petrakis1
@petrakis1 3 жыл бұрын
Exactly what I was looking for. Thank you
@akaludi
@akaludi 3 жыл бұрын
Nice Explanation and brief
@ArjanvanVught
@ArjanvanVught 5 жыл бұрын
Really great - thanks !
@WistrelChianti
@WistrelChianti 4 жыл бұрын
Thanks so much! Having just been finding out about rotary encoders, my immediate question was "can we control two buttons with them (left/right)" without a microcontroller. And lo and behold your most excellent well paced and explained video! I'd already knocked up a simulation but was pondering what to put in the middle, I wasn't sure if normal logic gates were going to cut it as had a feeling some sort of "memory" was needed to stop them firing one after the other, and it looks like it was. Shame the answer turned out to be "at least 2 more chips and a custom circuit board". But at least it is possible.
@jpdesroc
@jpdesroc 2 жыл бұрын
I tried your circuit and it works pretty well ! The only thing I found is when a pulse get on one of the flip-flop output (ex: CW) the CCW output sometimes shows a very small glitch at the same time. That's not a problem by rechecking the interrupt pulse that just triggered the uC (CW or CCW) to see if it's a glitch (after a small usec delay check) or if the pulse is a steady one.
@electronic7979
@electronic7979 6 жыл бұрын
Excellent
@efesstuff4936
@efesstuff4936 5 жыл бұрын
İ think you can use data and clock thingy and use peak detectors in both outputs with low capacitance and buffer them with a op amp. And you can put leds or another stuff on opamp outputs and have some fun!
@nigelworwood8530
@nigelworwood8530 2 жыл бұрын
Excellent.
@tablatronix
@tablatronix 4 жыл бұрын
I wish you could buy nice logic probe wires like those, or good logic micro hooks
@joemc4860
@joemc4860 3 жыл бұрын
Connect A and B to an exclusive-or gate and look at the output as you turn the shaft. Does it double the pulses per rev?
@mardav1545
@mardav1545 4 жыл бұрын
I just thought that I was confused until I watched this video. Now I'm thoroughly confused.
@GnuReligion
@GnuReligion 6 жыл бұрын
Cool. You have all sorts of equipment there. The way I think about it in software, is when both leads are low, then you are midway between resting points (chip enable) ... and time to look for which side goes high first, that is the direction INC/DEC + CLK-UP. Both go high, chip disable, CLK-DOWN. Was hoping this could all be done with a quad NAND . A couple of gates would flip flop to store the enabled-ness.
@GadgetReboot
@GadgetReboot 6 жыл бұрын
I started out trying to use simple gates and then I kept realizing I hit a dead end trying to cover all the scenarios so the flip flop with supporting gates ended up being the easiest I could think of. I am already thinking about expanding my original single flip-flop version to actually control the digital pot so if I think of something there will be a video on that coming up but I don’t know if it can just be done with a few gates. Even when I try to think about the process in a software mentality about waiting for something to happen and then doing something else and having to control those three lines, I always end up in a spot where I need to latch and store one of those states and then make use of it later.
@GnuReligion
@GnuReligion 6 жыл бұрын
Hehe, one could always give up and use an ATtiny13, that costs $0.30. All sorts of states there... A couple of inverters and resistors makes a flip-flop.
@GadgetReboot
@GadgetReboot 6 жыл бұрын
Yeah sometimes a task becomes more of an intellectual exercise than a practical ambition but it keeps the mind working and that can be maybe transferrable to a different problem that can be solved this way so I don’t mind thinking about it. I put some more thought into it and got road blocked again so I think to actually control the pot I will need to use some RC delays to generate in-between states so I’m going to think about if that’s practical and if so I will do a video.
@timshoo1627
@timshoo1627 4 жыл бұрын
@@GadgetReboot I found a way to get a step and direction output to a binary counter ic(theoretically turning it into an absolute encoder output) in a logic simulator(Logisim Evolution, definitely recommend)using a d-latch on each encoder output. Then XOR before and after each d-latch(A_New and A_Old get XORed, B_New and B_Old get XORed). Then XOR both of those XORs to get your STEP signal(connect to ENABLE pin of the counter). Then XOR either A_NEW and B_Old or A_Old and B_New to get DIRECTION output(connect to DIRECTION pin fo the counter). Finally attach an oscillator to all of the clock pins(d-latches and counter). If you manually pulse the clock, you will notice the DIRECTION output is active when you would think it should not be. In simulation at least, it only matters what is active when the clock switches.
@norbithehun
@norbithehun 2 жыл бұрын
Great video, thanks. One question: if my mechanic rotary encoder works only at every second step (both directions), is it the encoder fault itself, or it can be an other component on the board? Thanks for your help in advance.
@Flight2020
@Flight2020 Жыл бұрын
Thanks so much. I was looking for this hardware solution for long time. But why on earth nobody yet developed a dedicated micro-chip for this task??? Or it exist and I just cannot find it?
@deepeshkushwah607
@deepeshkushwah607 3 жыл бұрын
Can you please help me to make a code for DMX stapper motor with optical encoder
@PrincePloppy
@PrincePloppy 3 жыл бұрын
I have a question. Can you trigger a Rotary encoder with the use of a momentary footswitch by grounding either clock or data? IE: to go forward or back? I have a finger operated rotary encoder, which I want to keep, but wanted to add a footswitch.
@GadgetReboot
@GadgetReboot 3 жыл бұрын
If there are 2 foot switches they could be in parallel with an encoder and pressed in the same way an encoder would trigger the 2 signals, but doing it with just one switch sounds like it would need some sort of circuit to trigger both inputs, since both are needed to detect direction. It also depends on how software is reading the inputs to decode them, and depends if you need to be able to go both directions or just one. If the code is really only monitoring clock for changes, then checking to see if data is high or low to indicate direction of travel, if you just have a footswitch to ground on the data input, the system will never see any activity because nothing triggers clock. If you have clock on a footswitch and trigger it, data will be pulled high so you'll always see movement in whatever direction that represents unless you have another switch or circuit to change data. That's just based on one method of reading the encoders but eithe way 2 switches or a circuit are needed.
@PrincePloppy
@PrincePloppy 3 жыл бұрын
@@GadgetReboot ty so much for your reply. I think a small capacitor should provide a brief delay as it now seems im gonna have to ground both to get movement. Im gonna poke around inside and see what gives. I need 2 switches anyway. 1 for up and 1 for down. (Clockwise n anti clockwise.
@GadgetReboot
@GadgetReboot 3 жыл бұрын
@@PrincePloppy It's a good idea to draw a schematic when thinking about how to make it work because things may become clear suddenly, like if needing to go both directions, one direction from each switch, then adding a capacitor to one of the lines may only work if you only ever needed to go one direction so you always delay one pin and have the other instant, and simulate one change following another a little later. But when you need to do the same in reverse, you may need a capacitor on both lines, which results in just delaying the whole system and it's back where it started. And by having it all wired up to 2 switches and trying to make the signals trigger in opposite directions with just switches and capacitors, it all may end up being a big short circuit type scenario! So it starts turning into a project circuit with maybe transistors doing the actual signal switching, and the foot switches controlling the transistors, capacitors controlling how fast the transistors come on for delaying one of the pulses. Then the transistors provide the isolation between the two connection schemes for each direction and nothing conflicts. I wonder if there's already a circuit like that somewhere online. I saw this: blog.gypsyengineer.com/en/diy-electronics/transistor-delay-circuit.html#:~:text=After%20some%20time%2C%20the%20voltage,of%20the%20variable%20resistor%20R3. I haven't tested but if I were to use it on an encoder, I'd remove LED1 and R1 because we're not turning on a light, and instead connect the transistor collector to one of the encoder clock or data lines. The 3V power source would be whatever is powering the encoder so probably 3.3v or 5v from the main circuit. The value of R2 is probably not critical so can be experimented with, and the main delay would be controlled by R3 and/or C1. It looks like when the switch is pressed, after a delay the transistor would bring the encoder line to ground when the capacitor charges enough to turn on the transistor. When the switch is released the capacitor will drain as it tries to keep the transistor on and it will eventually release the encoder signal. So that would provide a delay on one line as a concept of how I think a capacitor would have to be implemented rather than directly connecting it and then everything is messed up possibly. This way, it's just an Open Collector circuit on the encoder input and it's as if nothing is really there, or else it's being pressed to ground, and it's all isolated. Then you'd figure out how to connect up the one switch to control both the lines and a second switch with more of the circuits to control in the other direction (might turn into a big project)
@PrincePloppy
@PrincePloppy 3 жыл бұрын
@@GadgetReboot thank you so much for the time you've taken explaining this to me. I truly do appreciate it. I think however this is wat beyond my skill level. So i have decided to shelve this idea. lol I did subscribe though, so maybe I'll learn a lot more about electronics watching your videos. You are a good teacher
@browaruspierogus2182
@browaruspierogus2182 6 жыл бұрын
Many devices have hardware pulse counters - what we need is hardware button push up down.
@GadgetReboot
@GadgetReboot 6 жыл бұрын
Yeah there is a few standalone chip options like the LS7XXX lsicsi.com/datasheets/LS7083N_LS7084N.pdf But this was supposed to be a more fast solution when other options aren’t available so in my case I don’t have a dedicated encoder chip but I have lots of separate logic gates. Can you elaborate on that hardware button situation? How would that be used and what does it need to do?
@browaruspierogus2182
@browaruspierogus2182 6 жыл бұрын
So is there a standalone tiny IC for rotary encoder? I know they sell encoders with spi circuits but if you have many encoders that's costly
@GadgetReboot
@GadgetReboot 6 жыл бұрын
The LS7083/LS7084 are smaller eight pin devices that look at the two encoder signals and then depending on the chip they generate different outputs but I’ve never used it so I’m not sure. Just looking at the timing waveform it looks like it generates A clock for every time there’s an encoder change so there will be multiple clocks within a single rotation. Maybe there’s a way to only get a single clock out for a single position change or maybe there’s a better chip to do that but for a custom application we still may sometimes need a custom circuit.
@test_channel_eg
@test_channel_eg 3 ай бұрын
Hello bro Can you help me with a encoder Just your projects
@101Gabriel_M.
@101Gabriel_M. 4 жыл бұрын
Can i have this schematic diagram? :"D I really not wanna start learn programing as well, so the hardware made version is looks easier and more stable for me... I wanna replace the shitty DIP buttons on a device to rotary encoder, because faster, fancier, more comfortable. OC if i get dedicated A/B pulse lines to directions of turns, the next is just a FET or BJT to replace te buttons.
@WistrelChianti
@WistrelChianti 4 жыл бұрын
yeh here for the same reason, but it looks like a custom board with at least 3 chips on sadly.... still might be a fun challenge to figure/layout.
@backlash00
@backlash00 3 жыл бұрын
Nice manipulation of logic to achieve what you wanted. I don't know what you will be using the pulses for but if all you need is to know encoder direction then feed A and B into D and Clk of FLIP-FLOP. Q will be low for one direction, high for the other. Arduino can read that. One DIP with leftovers.
@GadgetReboot
@GadgetReboot 3 жыл бұрын
I can’t remember what I was trying to accomplish at the time but I think I needed two separate outputs and maybe even some sort of logic debounce, I just remember spending a bunch of time on a whiteboard at the kitchen table a couple of years ago.
@andrewferg8737
@andrewferg8737 4 жыл бұрын
Great video!!! I'm wondering how to use a rotary encoder or perhaps a hall sensor (without a microcontroller) for my current project: kzbin.info/www/bejne/bJPapXSVmchpgKM Any ideas would be appreciated as I've no experience yet with using these components.
Digital Potentiometer and Rotary Encoder Direct Control X9C103
14:05
How to measure a capacitor with an oscilloscope.
46:10
mjlorton
Рет қаралды 351 М.
Василиса наняла личного массажиста 😂 #shorts
00:22
Денис Кукояка
Рет қаралды 10 МЛН
孩子多的烦恼?#火影忍者 #家庭 #佐助
00:31
火影忍者一家
Рет қаралды 36 МЛН
World’s Deadliest Obstacle Course!
28:25
MrBeast
Рет қаралды 151 МЛН
How to use rotary encoders
14:12
FriendlyWire
Рет қаралды 28 М.
Rotary Encoder (KY-040) Debounce Circuit Tutorial
15:03
ForceTronics
Рет қаралды 17 М.
How to use encoders (Optical, Hall Effect, Quadrature)
20:44
Will Donaldson
Рет қаралды 102 М.
HACKED!: Using an HDD Motor as a Rotary Encoder?!
8:21
GreatScott!
Рет қаралды 1,5 МЛН
CNC encoder wheel with stepper motors
35:15
Curious Scientist
Рет қаралды 22 М.
Adventures in Science: How to Use Rotary Encoders
12:05
SparkFun Electronics
Рет қаралды 222 М.
No Coding Rotary Encoder Pt. 2 Decoding (w/ hardware)
39:14
ARENOT DIY
Рет қаралды 10 М.
Constant Voltage or Current Supply with ARDUINO
18:02
Electronoobs
Рет қаралды 69 М.
How INDUCTOR's work & How to make your own
15:55
Schematix
Рет қаралды 855 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 4,8 МЛН
Secret Wireless charger 😱 #shorts
0:28
Mr DegrEE
Рет қаралды 2,4 МЛН
YOTAPHONE 2 - СПУСТЯ 10 ЛЕТ
15:13
ЗЕ МАККЕРС
Рет қаралды 153 М.
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 345 М.