analog to quadrature converter?

How difficult would it be to make an analog to quadrature converter, that reads a potentionometer, and detects a change in resistance and sends a pulse (turns on/off two switches) that mimics a mechanical rotary encoder? I am looking for 256 pulses per revolution. The potentionometer would need to be small (about the size of a large guitar pot, the circumference of a quarter) and the circuitry not too bulky (fit inside a small project box), and be powered by 5v, .5ma. It would possibly use a PIC controller.

If possible (without complicating it too much) I would like the potentionometer to be one of those ones that can spin a full 360 deg, so after a full spin, the resistance would go back to 0, and the converter would need to be smart enough to detect this and compensate so it sends the correct quadrature.

Any ideas?

Reply to
Mad Scientist Jr
Loading thread data ...

This is for a controller for a Pong game - the speed of the revolution would probably be comparable to that of a mouse, but the faster the better. A resolution of 255 pulses per revolution would be ideal...

Reply to
Mad Scientist Jr

Sounds pretty easy for a uC with an 8bit ADC. Every time the ADC changes a step, wiggle the appropriate wires. A 9bit (or more) ADC will give you a little hysterisis in the up/down motion without causing any loss in resolution.

--
  Keith
Reply to
Keith Williams

Mad Scientist Jr skrev:

wouldn't it be a whole lot easier to replace the pot with something like this?

formatting link

-Lasse

Reply to
langwadt

No, it's because of resolution and because of my interface (a hagstrom keyboard controller). I have an Atari 2600 driving controller plugged in currently and built a little paddle game, and the resolution of the driving controller is 16 pulses per revolution - you have to turn the dang thing 20 times to get the paddle to move across the screen, and I'm just drawing it in text! (5 chars on a 80 column textbox) ! In hires, it just won't do - to match the feel of regular atari pong/breakout the entire paddle needs to move across the screen in about 10/16 of one turn... with the screen resolution I am using, one pulse = a move of 4 pixels. with a screen of 640 pixels wide, that is

160 screen positions, if 160 is 10/16 of the total ppr, the encoder would have to be capable of 256 ppr. Ideally I would replace the encoder in the driving controller with one capable of 256 ppr, but mechanical encoders with that high res don't seem to exist (unless I'm looking in the wrong place). I think an optical encoder may be an answer, do they go up to 256? Also, I'm a programmer, I don't really know electronics beyond how to solder basic switches, so designing a circuit to drive an optical encoder may be beyond me. Also, cost is a factor, I want to spend as little as possible, ideally under $15 per controller. Anyway, a potentionometer to a DAC would take up 8 bits = 8 keys on my keyboard per spinner, which is too many inputs. With quadrature the paddle only uses 3 keys = 2 bits + fire button, which is good. A pot to a ADC to a PIC simulating quadrature at 256 ppr might do the trick and be cheaper than the hi res optical encoders (I have seen prices for those be $130 an encoder, no thanks)
Reply to
Mad Scientist Jr

Um, YES!

These optical encoders don't require any special circuits?

Do they go upto 256 ppr?

Reply to
Mad Scientist Jr

Alas, at $50+ a pop, they are kind of pricey and I see it only goes up to 160 ppr... However it is closer to a solution than anything I've seen

Reply to
Mad Scientist Jr

Keith's right, this could be done easily with a microcontroller, such as an 8-pin PIC with 10-bit ADC and internal oscillator.

Assuming you're talking to an ASIC with built-in debouncing for a mechanical encoder, you'd have to simulate minimum pulse lengths that were appropriate for such a device. That could limit the "slew rate" out of the simulated encoder, so it could take a bit of time to catch up with the shaft position if it is moved rapidly.

Best regards, Spehro Pefhany

--
"it\'s the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

These are for pong paddles so I am not in a hurry to spend a lot of $. However, they look the right size and don't seem to require any circuitry. If I can find a 256 ppr one for less money that would work

Reply to
Mad Scientist Jr

I do not think a potentiometer will last very long. If the speed of the revolution does not change really fast you could use a hall sensor and a pll. If you are using a dc motor consider a ripple counter.

formatting link

Josh

Mad Scientist Jr wrote:

Reply to
josh lawton

So, if you can contemplate using a PIC and a pot, why can't you use a PIC and a lower res (cheaper) shaft encoder, measure the velocity you're moving the shaft and multiply the rate based on velocity? MS-DOS had mouse .INI files to do just that where you would specify the rate and multiply factor. Variable rate MIGHT work even better.

GG

Reply to
Glenn Gundlach

you can get optical incoders in much higher res if you want. we have some at work that range up in the 1500 PPR. of course those are like a cube block. the link will show you something at 250 PPR

formatting link

--
Real Programmers Do things like this.
http://webpages.charter.net/jamie_5
Reply to
Jamie

Is the reason for considering an analog pot instead of the available

360 degree rotating quadrature knobs because of cost?

Jon

Reply to
Jonathan Kirwan

Those are what I was thinking about in my prior comment. I have a bag of them with 64/rev, optical, and they were $6 each I think. And yes, I've seen them sell for something around $30 or so, which is why I bought them for later use. I wouldn't be surprised to be $50+ per. Which is why I was asking.

Jon

Reply to
Jonathan Kirwan

I'd think backlash/anticipation/hysterisis would be a problem with such a scheme.

--
  Keith
Reply to
keith

damn, you cross posted AND multi posted!! please don't multipost, and be conservative with cross posts

--
|\\/|  /|  |2  |<
mehaase(at)sas(dot)upenn(dot)edu
Reply to
Mark Haase

Use a "digital pot" that outputs quadrature already- it's called an encoder, and it's not expensive. Bourns EAW0J-B24-AE0128.

Paul Burke

Reply to
Paul Burke

--
Since you\'re a programmer, doing it with a PIC ought to be dead
simple.  Get one with an internal ADC, run it ratiometrically with
Vcc as its reference, truncate the ADC\'s lower order bits until
you\'re left with 8, and there ya go!
Reply to
John Fields

It sounds like a good solution - but what is ratiometrically, and what is VCC? Do you need to know a lot of electronics to wire a PIC?

Furthermore, can one PIC do DA conversion and quadrature emulation for

Thanks

Reply to
Mad Scientist Jr

Hmm, thanks for the link, power drain could be a problem. The unit driving this is a hagstrom ke72 (see

formatting link
which has 5v, 0.5 mA per switch.

Reply to
Mad Scientist Jr

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.