3 ms·
Didn't know anything about this, really interesting! One question: when you need to know exact angle of something, say a steering wheel, if you used a grey cod
by entee 10y ago
Didn't know anything about this, really interesting!
One question: when you need to know exact angle of something, say a steering wheel, if you used a grey code you'd need a really fine grained code with a huge set of numbers if you used this approach. Is that how it's done? Or is there a different way?
- wrigby 10y agoSometimes yes! Wikipedia has a cool picture[1] of a 13-track (and hence 13-bit) Gray code encoder in the Gray Code article[2], which would have a resolution of ~.05 degrees. 1: https://upload.wikimedia.org/wikipedia/commons/a/a8/Gray_code_rotary_encoder_13-track_opened.jpg https://upload.wikimedia.org/wikipedia/commons/a/a8/Gray_cod... 2: https://en.wikipedia.org/wiki/Gray_code#Position_encoders https://en.wikipedia.org/wiki/Gray_code#Position_encoders
- Ericson2314 10y agoSo the grey code itself has a graph analog (cycle in hypercube) and as the 1st picture would leave one to believe there's also some tree structure going on. Graphs on multiple levels!
- azdle 10y agoYou would end up with a very large grey code if you tried to do that. You could solve that by gearing it down (or repeating the code) and count revolutions, but more likely these days you'd use something like a hall-effect angle-position sensor [1]. The ones linked will give you an angle with 2^12 bits, or ~0.09° just by rotating a magnet next to the IC. [1] http://www.allegromicro.com/en/Products/Magnetic-Linear-And-Angular-Position-Sensor-ICs/Angular-Position-Sensor-ICs.aspx http://www.allegromicro.com/en/Products/Magnetic-Linear-And-...
- HeyLaughingBoy 10y agoYes and no. It depends. Maybe. A Gray code, as the article states, is only referenced by the Hamming distance between codes, not the bit size of the encoding. If you repeat the two-bit code: 00,01,11,10 90 times, you'll get a one-degree resolution around a circle, which is plenty for a steering wheel and usually works just as well as a 9-bit encoding (512 states). The problem becomes "how do I know where the wheel is at any arbitrary time?" The answer is: you continuously monitor the wheel by counting up or down on each code transition, and have a Home sensor to set the initial position. But now you have to remember the position when you power it off, and perhaps make sure no one can move the wheel while you're not monitoring it. Is that sufficient for your application? (hint: it is for 90% of such applications) If so, problem solved. If not, then we need to get more complex. More complex can mean: Non-Volatile Memory so we can power off and remember the last position[1], continuous battery-backup so even if main power is off, we track the wheel position, or ta-da: a 9-bit encoding so even with power off, we can encode 512 discrete states. Historically, that last solution was by far the most expensive. 1: I've worked with such a system where the position of a critical gantry was updated while it was running, then when power was off, the last (X,Y) position of the gantry encoders was remembered. Battery-powered electronics then monitored the state of an access door. If the door was opened, then the X,Y position was invalidated (someone could have moved the gantry while the encoders weren't being read) and the software would not allow the system to restart until a manual alignment procedure was done to reset the gantry to a known position and clear the "lockdown" bit. The alternative would have required two 10-bit absolute encoders that cost more than the electronics to do what I described.
- Ericson2314 10y agoCool to note that either the additional gray codes bit or the circuit (be it regs, NVRO, etc) is tracking the exact same extra information.
- Gracana 10y agoRE: non volatile position storage Some of the industrial equipment I've designed at work uses Omron servos with encoders that use their own motion to provide power to the position tracking electronics, so you can disconnect the cable or otherwise lose power and not lose your zero, even if the machine is moved in the interim. No batteries required. Very cool product!
- HeyLaughingBoy 10y agoThat is seriously cool! How long does it retain data for? In our case we had to assume the operators might power off the machine for a long weekend, so we spec'd a 7-day data retention.
- stonemetal 10y agoI worked in industrial automation controls for a while. There they used a concept called quadrature to determine servo movement precisely. Quadrature is basically a grey code of [00, 01, 11, 10] that is repeated. You know what direction you are going by where you are and what comes next. If you are on 01 and see 00 you know you are going left. If you are on 01 and see 11 then you are going right. With a tad bit of math involving the gear box attached to the servo you know that one tick is real world distance X. From there it is a matter of establishing a "home" position, and counting your ticks as you move.