Let's Make Robots!

DIY compass module

Hi A few days ago an idea in my mind to make a simple and cheap compass (module). I made a gradient ring in photoshop (see atachments). The idea is that i will stick this ring on a normal compass so that it rotates with the compass. After that an ir phototransistor will be fixed over this ring and will be mounted on the main compass frame which doesn' rotate with the compass. This phototransistor will be connected to a transistor or some other circuit (which i haven't thought of yet) which will amplify the phototransistor's voltage and send it to a picaxe's analog input pin. So as the compass will rotate, the analog voltage will change and the picaxe or maybe some other microcontroller will know the change. Also i am confused about using a ldr instead of an ir led. Is

AttachmentSize
Untitled-1.jpg20.21 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I would go with holes in that ring paper. every 2-4 degrees or so to get a decent value out. This requires a light barrier to shoot through the holes. The problem with that "real" compass is that it has to be exactly leveled horizontally.

 

Digital compasses still have to be horizontal or else thay will give bad readings. 

There have been numerous construction articles over the years using the very inexpensive hall effect device as a compass. That way it would be much smaller, immune to ambient light, and with no mechanical parts.

Yeah, but then he wouldn't really be making the sensor himself or bringing the idea to fruition.

The Led is the light generating device and the LDR is the light sensing device.

You cannot choose one instead of the other.

The problem is the dynamic range of the couple light generation/light sensors.

Imagine you use a very, very strong LED. Your sensor will be blind and you will detect variation only on the darkest places of your ring. The light gray parts will all seem the same to the sensor. Your lignt generation must be adapted to your sensor to get the most out of its dynamic range and avoid sensor saturation or underactivation.

So power is an important factor and there is no rule. You will have to experiment by adding a variable resistor in serie with your LED and check the values returned back by your sensor.

Another factor is wavelength, for the emitter (LED) , the reflector (paper) and the sensor. LDR (AFAIK) react more to visible light and UV. Phototransistor is more sensitive in IR. So, if you use IR, use a phototransistor with it, not a LDR. If you use green, blue of UV LED, maybe an LDR will be more efficient (note the maybe and the AFAIK...). I think that paper will reflect UV better than IR as there are some highlighting agents to make it whiter.

 

By the IR LED i meant IR phototransistor. I am planning to enclose the whole appratus in a small box so that i don't have to worry about the changing light conditions all the time. And i think a single white led (low power) with a variable resistor and a LDR will do.

I think the IR LED would give a digital value (either on or off, useless on your gradient ring) whereas the LDR gives an analogue value which is what you need.

An IR LED won't necessarily give a digital value, take the case of the sharp sensors used to determine distances. you just hace to amplify the voltage coming from the LED like Oddbot has done here -  http://letsmakerobots.com/node/2907

Sanc04 is correct here. To get an IR phototransistor to read a high/ low digital value to your μC you'd need to "darlingtonize" it using another transistor and bias that (set the senstivity trigger level) with a resistor. (The exception would be a 38khz receiver, which has a chip that does this for you but only with a modulated IR signal.) The rest of the idea is sound- I think most of your challenge is going to be physical (ie, getting the compass needle balanced and free-floating once you've made it into a wheel.) For size and sensitivity reasons you'll probably want to use a phototransistor instead of an LDR. You may want to experiment with different surfaces of paper too. This is kind of like an optical encoder but totally different in intent.