NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » angular position sensors and multiplexing

November 28, 2010
by d3adl0ck3
d3adl0ck3's Avatar

Hello all, I am just getting started with electronics and have a project in mind that requires the measurement of a number of changing angles at the same time. In my naivete I assume I need a bag full of sensors that measure an angle (rotation about one that is) and some way to multiplex them together. That is about as far as I can get on my own. Does anyone have a suggestion as to what kind of parts might be used for this? Picture a crane or something where I need to know the angle of the arm and it's rotation relative to the ground but with a lot more points of measurement required. More details can easily be supplied once I know what sorts of questions there might be. Thanks in advance for any help!

November 28, 2010
by bretm
bretm's Avatar

How many degrees of angular precision do you need in the measurements? For angular position measurement you can use a rotary encoder. You can pay big bucks for encoders with 1-degree precision, but you can hack together a single-track encoder to get 6-degree precision. You just need a disc and five optical sensors.

Instead of a rotary encoder you might be able to translate the rotational movement into linear movement and then follow the digital calipers tutorial to get a precise measurement.

November 28, 2010
by d3adl0ck3
d3adl0ck3's Avatar

Thanks for the quick reply! The measurements I need probably fall into to 6 to 10 degree range. For the application I am looking at I don't think I require the exactness provided by the rotary encoder, I was thinking of just using a bunch of linear potentiometers with a multiplexer. I found this tutorial multiplex force sensors that does a similar thing. I would probably be fine with a single 16 way multiplexer to start but quickly searching for MC14067BCP (the multiplexer they used) didn't turn up anything obvious to the uninitiated. Can anyone recommend a tutorial that uses the nerdkit with a multiplexer in a similar fashion (to measure multiple resistances)? I found this link based on another post and it seems a bag full of one of these guys might work though I don't know which to pick regarding the resistance range of the potentiometer. I am pretty sure single linear is appropriate.

November 28, 2010
by Rick_S
Rick_S's Avatar

Another thing you can use are accelerometers or gyros. You could see the Wii Nunchuck thread where there is full sample code. You can see the different readouts when the nunchuck is tilted, these could be translated to angular positions. These are nice because they communicate via a single interface (in the case of the nuchuck I2C).

The type of encoder / sensor you need will primarily be dictated by your programming ability, your circuit building ability, and the method of mechanical connections available in your project.

Just offering another idea.

Rick

November 28, 2010
by d3adl0ck3
d3adl0ck3's Avatar

Thanks for the suggestion, I had looked a little into accelerometers and gyros and I think given the number of points of measurement I am looking at it may be impractical.

Regarding the encoder, my circuit building ability is minimal but I am good at small detailed work. My programming ability is very good but I am an application programmer, not an electrical engineer and this is a learning experience for me. I am more than proficient at C, C++, Java, Python and more. As per options for mechanical connections the sky is pretty much the limit. If any of that narrows down the options for the encoder I'd love a recommendation.

Thanks!

November 28, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi d3adl0ck3,

It looks like you have quite a bit of freedom when it comes to how you physically attach your sensors to your project, so this will give you some room to experiment to find out what works best. My suggestion is if you can make a digital rotary encoder work for you, go with it. The advantage with a digital rotary encoder is the digital nature makes them easier to work with in terms of noise and circuitry required. With digital rotary encoders you can hook them up directly to the digital I/O pins on your MCU and use pin change interrupts to capture the transitions and interpret the angles.

If you only need to sense relative position, as in you only need to know how much it has moved then a normal quadrature output rotary encoder will do just fine. If you need know the absolute position then you would need an absolute encoder, look for Gray code encoders. A quadrature rotary encoder will use up 2 of your digital pins to read it, the absolute encoders will require more.

If you choose to go with a more analogue approach with potentiometers and changing resistances you will definitely get better angular resolution but you will have to deal with wiring up the circuit, cleaning up the noise, and multiplexing your sensors. Note that you can use the ADMUX on the chip to multiplex 6 different analog inputs into the ADC, so if you only need 6 sensors you won't need an separate multiplexer.

Hope that gets you going, feel free to ask more questions as they come up.

Humbeto

November 28, 2010
by d3adl0ck3
d3adl0ck3's Avatar

Thanks Humberto,
I have actually had the potentiometer approach stuck in my head and intend to give it a try. This is really a learning experience so if it goes bad I'll only be out a few potentiometers that I should be able to find an alternative use for. For now I should be able to make due with the 6 inputs available through the ADMUX on the chip just to get the handling of the signals working. Is there a particular resistance range that would be 'most' suitable, meaning is there a range of resistances I would most easily be able to measure to minimize the amount of additional circuitry I'd need to mess with? Additionally if I were to scale up to more than six sensors do you have a recommendation for a suitable multiplexer? In a similar project referenced above they used a number of multiplexers called MC14067BCP. There they used the same control signals for all multiplexers and hooked each up to a different analog input. In this scenario I could do similar except switch between the multiplexers using the ADMUX. Does that sound reasonable? Any idea where I could get a similar part? The hardest time I am having getting started is figuring out what I am looking at on digikey...

November 28, 2010
by esoderberg
esoderberg's Avatar

d3adl0ck3 ,

Sparkfun has 74HC4052 mux/demux for under a dollar that may work for you. Data sheet on link:

https://docs.google.com/leaf?id=1YrdzQOF3nTD5Q0atgHZGZaizo7ted5QjMa3we_fO9tOZGF_2n2qGGefUHMKy&hl=en&authkey=CICr9a8O

Eric

November 29, 2010
by d3adl0ck3
d3adl0ck3's Avatar

Thanks for the link! I now have a handful of muxs and potentiometers on the way. Christmas is coming early this year ;-)

Post a Reply

Please log in to post a reply.

Did you know that first-order systems have a exponentially decaying response to step inputs? Learn more...