Author Options:

Any ideas on how to make a kind of rotatory sensor? Answered

I am making a robot, and I have to make a system in it such that when it rotates 180 degrees than it should stop, for that I need a sensor that can detect this, I think a compass would be of some help here but inside the robot there are a lot of relays and I think their magnetic fields will interfere with the compass, so is there any other way to make it, I can't buy anything so the things used to make it should be available at home.

And my options are physical (using switches or any other electromechanical system) or magnetic, NOT optic.


You will need a very powerful magnet such as a small neodymium magnet.

Mount on this a card and research "grey scale" to see how to read position.

Other wise you could trail a caster wheel behind - this will rotate when the robot turns you can measure that rotation either by counting pulses from a card (see above) or the mechanical switching of a suitable contact/cam -

Yes, I think the second option will work, but can you tell in a bit more detail of the caster wheel, wouldn't it be rotating even if the robot is going straight without rotation?

No the caster will automatically trail behind when the robot goes straight and turn when the robot is turning - Try pulling your bike backwards - The front wheel is a caster.

robot rotate.jpg

You can make yourself a compass with a optical readout, or you can get a dead smartphone and take the compass chip from that.

I am trying to make a sensor that can detect rotation on the horizontal axis, is there any other way, I don't have optical components or a dead smartphone, is there any way I can somehow connect wires to a compass so it can complete or break a circuit, but the wires shouldn't interfere with rotation of the compass?

What did you meant when you said "a compass with a optical readout", what is it?

I'm thinking of a compass card with a holes around the edge and mouse electronics to read them.

If I wrap some wire around a nail and twist the both end wires of the coil together and then suspend the nail with it, will it act as a compass that can be turned off and on? or will the wires interfere with rotation of the nail?

you just need a little PM, not an electromagnet.

Yes, I think that can work, I'll try it, thanks.

You want a circuit like this.


Between the IR LED and the phototransistor you have a rotary disk with holes in it connected to the piece you want to monitor but instead of a Johnson counter you would want an up down counter like this.

JK Photo Up Down Counter.bmpJK Synchronous Up Down Counter.bmp

I am basically trying to make a kind of a direction sensor. It would be good if it didn't use any optical components such as IR sensors or phototransistors. I think I should use a compass but how would I connect wires to it so that it can complete or break a circuit?

you can use a quadrature encoder to know exactly how far something has rotated,
you can use a reflectance sensor with dots on the radius to know when the home and reverse position is.

Does the whole robot need to rotate or just a sensor array move?

It can use a camera and pattern detection from the environment to lock onto where it wants to be. (ez-robot dev board can do this)

It's just like a car, except in place of the front wheels it has legs, but it turns like a car, it doesn't just rotates about its axis, the whole robot steers just like a car in an arc.

Then you're going to want to use a gyroscope and/or magnetometer, in conjunction with encoders on the wheels to see how far they've turned.

You can do like the roomba, and it turns the wheels a known amount that does action 'turn 180 degrees on the spot'; but it is different for each terrain type as the wheels may or may not have as much grip in different areas.

And I can't use pattern detection or any method in which the environment has to be manipulated because it will be going around random places, there won't be necessarily any patterns their, so I need to make something that doesn't need any special optical inputs from the environment such as pattern recognition.

Maybe my options are physical (using switches or any other physical system) or maybe magnetic, not optic.