Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Question about rotary encoder switch

Status
Not open for further replies.

Andy1845c

Active Member
Is there a simple way to read the output from a rotary encoder like this one, without a micro-controller? :
https://www.electro-tech-online.com/custompdfs/2009/02/776386.pdf

Am I correct in assuming that switch would operate like the "Incremental rotary encoder" about 2/3 the way down this page? Rotary encoder - Wikipedia, the free encyclopedia

What I would like to do is use one to move a stepper motor. I was looking at a stepper motor driver like the L297
**broken link removed**

I wanted to make the motor take a step with each increment of the the switch and be able to distingush the direction the switch is being turned and have the motor follow.

This is for my air variable capacitor/loop antenna project. :)

I don't have my heart set on this, and know I can control the motor several other ways, but this would be the best way to do it I think.

I could also use a PIC, but kinda wanted to stay away from them on this. If the antenna works I want to be able to post the whole project online so others can try it if they like, and not everyone has an interest in PICs and learning to program and buying hardware.
 
You can use a Quadrature Decoder circuit as shown at fpga4fun.com - Quadrature Decoder to decode the quadrature signal from the encoder to get the up/down direction (count direction) and the clock signals (count enable) for the stepper controller circuit.

And no micro-controller in sight.
 
I don't think it has to be that complicated. I think all he needs to do is hook that shaft encoder to a bipolar drive, and connect that to a bipolar stepper motor. It ought to drive it directly.

This is one of the rare occasions you want to run the stepper at the rated voltage and no higher.
 
I don't think it has to be that complicated. I think all he needs to do is hook that shaft encoder to a bipolar drive, and connect that to a bipolar stepper motor. It ought to drive it directly.
Good idea. A two-phase stepper motor should have the same drive signal sequence as the output of the decoder. KISS is the motto.
 
I build a remote gain control for my amp. I used a unipolar stepper from an old 5.25" floppy drive and hot glued a screwdriver bit on the end. I mounted that to the gain screw on the amp. I was able to control it real easily using a switch from radio shack. It was similar to this one: 2-Pole, 6-Position Rotary Switch - RadioShack.com only it was a single pole, 12 position with continuous rotation. Then I just had to wire up the correct phases to the terminals. No need for any logic chips.
 
I am confused on this. I just studied the datasheets of the switch and L297 more, and can't see how I can do this without some kind of logic...

I admit i have never worked with a encoder switch or stepper driver before, so I may be missing something big.:confused:

From what I understand at this point, the L297 packs everything I need to turn a 4 wire, bipolar stepper motor forwards and backwards and in full or half steps. As well as some other features I do not need for this project.

A pulse on the CLOCK pin (18) will advance the motor 1 step, the direction depending on the state the CW/CCW (17) pin.

Is this correct? I can see how the encoder would produce pulses, but not a pulse for every increment it moves. From what I figure if I used one of the outputs on the CLOCK pin, I would get a pulse for every 2 switch increments, but would be unable to control the direction without a seperate switch.

If someone could clarify a bit I would be very thankful. I am placing a parts order and would like to get everything I need on it.
 
The encoder output sequence, I believe, is the same as the bipolar two winding (4 wire) stepper required sequence. Each encoder output phase drives it's respective motor winding amp. The key is that, when the rotation direction of the encoder is reversed, so is the output phase sequence. (Perhaps you weren't aware of that?) This reversal of phase sequence will cause the motor to rotate in the opposite direction.
 
(Perhaps you weren't aware of that?)

Aware of it, but fuzzy on how to use it to my advantage:D lol

So, are you thinking I may not want to use the L297 driver?

I am still trying to get a grasp on this. I am reading about it now.
 
If you use the 297, you're going to have to add flip-flops to decode the direction and clock from the encoder's quadrature signal.

But you can do it without logic. You wouldn't use the L297 - it would be simpler, just a pair of H drives (or even simpler, a pair of totem-pole drives if you have a bipolar supply).

Encoder line "A" drives coil "A", encoder line "B" drives coil "B". That's it. Two lines, two drivers, two coils. When a line from the encoder is high, the respective coil is driven + and -, when it's low, it's driven - and +.
 
Last edited:
Thanks for the replys. I think I need to just play with this in order to understand. I left the L297 Driver on my order and added a few H bridge ICs.

Whats a totem pole driver? A yahoo search didn't bring up much of use.
 
Philistines refer to it as a "push-pull" driver.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top