Homemade digital compass

Some time ago OddBot posted this circuit for a homemade digital compass based on hall effect sensors:

Compass_Schematic.jpg

Unfortunately CircuitBurn couldn't make it work. However I'm inclined to try again. A cheap DIY compass would be great.

So if anyone has ANY idea as to how this could be achieved let's hear it. It could be an improvement on OddBot's circuits or something completely different and wacky :D

HES/op amp circuits

As soon as I get the time I’ll buy 2 x UGN3503UA HES plus an op amp and start experimenting with OddBot’s 4 HES circuit. He said that allthough the circuit was based on the A1323UA-T HES it would also apply to the UGN3503UA (with some experimentation and calibration). I’ll try getting half the circuit (2 x HES instead of 4) to work before I spend more money on it.

OddBot also mentioned a simpler setup using only 2 x HES mounted in 90 degree angles to eachother, which I’ll also try out. Anyone has an idea of what this circuit would look like? I suppose I’d need 2 op amps for that? The thing is I never used a HES or an op amp before. I understand that you use resistors to set the desired gain of the op amp, but besides that I dunno.

Also I’m not sure which resistors to start out with in either case? It looks like there is also a pot/variable resistor involded but I don’t know what “zero adjust” means either?

I’d also like to know what kind of op amp to get (or avoid) in case I can’t find the CA3140 that OddBot uses?

All input will be highly appreciated :slight_smile:

Bad news :frowning:

I figured I could need ALL the input I can possibly get on this one so I posted a topic on the Arduino forum too.

Here is a reply I got from Grumpy_Mike (who in my experience is quite an electronics wiz):

The earth’s field is about 0.3 Gauss the sensor you posted measures up to 900 Gauss with a sensitivity of 1.3mV / Gauss. So the maximum you are going to get from this sensor is 0.23mV.
This is way way too small to work in that circuit.

I’m not sure though whether he means it’s impossible alltogether or just with the current setup…

Haven’t given up just yet :wink:

UPDATE:

It would seem that several people (see above link) think it’s simply impossible because even with a powerful low noise op amp the noise of the HES and the circuit itself would give you an unacceptable signal/noise ratio.

Still haven’t given up on this completely though…but I must admit it seems a bit hopeless :confused:

Does anyone know about noise reduction methods that may work in this case?

Op amp questions

Well got meself a HES (UGN3503UA) and an op amp (OP07) so I can get a better idea of how the components work.

The HES is straight forward so no questions here.

An op amp on the other hand is a strange little buggar. I did some reading up on it so I’m starting to get it. Wikipedia (as usual) have some good explanations, and for a short reference this is a pretty good link. I actually understand how OddBot’s circuit works now :smiley:

A few questions though:

* I presume that the max output can never exceed the voltage being fed the op amp? I here refer to V+ NOT the inputs (In+ and In-). Since I have to work with amplifications in the 1000s to detect the earths field it would otherwise fry my Arduino if it suddenly got close to a magnet.

* In a differential amplifier setup (eg. OddBot’s circuit) the formula for calculating the output is: Vout = (Vin+ - Vin-) * R1/R2. Does this mean that if Vin- > Vin+ I will get a NEGATIVE output? (which again would fry my Arduino I believe)

* I wish to hook up a single HES to the op amp for starters. I was thinking to use a resistive voltage divider to use 5V to generate the ~2.5V needed as a reference. I noticed that OddBot uses a pot to zero adjust the output. I presume I should do the same in this case rather than try to feed it a reference voltage of 2.5V - half the ouput variation expected? It would be easier to simply feed it 2.5V exactly.

* The pinouts for the CA3140 (that OddBot uses) and the OP07 are a bit different:

ca3140.jpg

56070OP07_S.gif

I presume "Offset NULL" and "Vos TRIM" means the same thing, so when OddBot uses pin 1 and 5 to zero adjust, I should actually use pin 1 and 8. Correct?

 

That should do it for now :)

The output of an OpAmp can’t

The output of an OpAmp can’t go above the V+ voltage or below the V- voltage, and typically it won’t even be able to reach V+ or V- because of the hardware limitations. The OpAmp datasheet should be able to tell you what the maximum and minimum output voltages are relative to V+ and V-.

The ‘neutral’ output for the UGN3503UA is nominally 2.5V, but it may be slightly higher or slightly lower. Using a pot instead of a fixed voltage divider allows you to tune out any small deviation that might be present in the HES output.

Offset NULL and Vos TRIM are indeed the same thing, in fact some datasheets for the OP07 actually say Offset NULL instead of Vos TRIM.

Thanks

Though your comment confused me somewhat (just when I think I understood something)…

You say the output can never go below the V- voltage. In that case I don’t understand what an inverting amplifier does. The output in this case shoud be: Vout = - Vin * Gain. So I definately misunderstood something here? :confused:

Also I’m not sure what you meant in the 2nd paragraph…You say I should replace one of the resistors in the voltage divider with a pot and use this to finetune the reference voltage (V-), while I thought I should do then trimming with the Offset NULL/Vos TRIM pot. Are you saying I should lose the other pot entirely? Or use both?

And still I’m not entirely sure what happens when Vin- > Vin+ in a differential amplifier. But I THINK that OddBot’s circuit works like this: two HESs are mounted back to back. If one of them is pointing to north I will get the max difference between the 2 sensors, and therefore the max possible output from the op amp. If I turn it 90 degrees I should be getting a minimum difference (~0), which is why I need 4 HESs in total (the other 2 mounted in 90 degrees to the 1st 2). If I turn it 90 degrees further (thus it has turned 180 degrees from the original position) I will get the max difference again, and therefore the same readings as the 1st position.

However according to the formula: Vout = (Vin+ - Vin-) * Gain, I should now be getting a NEGATIVE value (assuming that I started out with a positive value). So again I seem to have misunderstood something? :confused:

I think the part you’re

I think the part you’re missing is where the offset voltage comes in. This is the voltage produced at the output when the difference between the inputs is zero. If you have a 5V supply, then you would typically adjust the offset voltage (i.e. using the Offset NULL/Vos TRIM pot) to 2.5V for maximum ‘swing’, as this gives you up to ±2.5V change in output.

You can modify the equation you have above to take this into account: Vout = (Vin+ - Vin-)*Gain + Voffset.
As you can see, when Vin+ = Vin-, Vout = Voffset.

As far as the Offset NULL/Vos TRIM resistors go, the easiest thing to do is just follow the suggested arrangement from the OP07 datasheet. In case the datasheet you’ve got doesn’t have it, the STMicroelectronics OP07 datasheet suggests you use a single 20kΩ pot by attaching each end to one of the Offset NULL pins, and connect the wiper pin to Vcc+.

Hmmm

Yes I definately misunderstood something there. I was operating with the idea that the output would be 0V when the difference between then inputs was zero. So I thought ideally I should feed V- with 2.5V MINUS half the expected output variation, which in this case is very little: 0.39mV. And from there simply amplify it so that when the difference was max (0.39mV) it would give me something near 5V. Hope you understand now why I was asking the questions I did about negative voltage etc.

But OK…If the offset voltage is 2.5V the formula makes more sense. So I get (again ideally) 2.5V whenever the HESs are facing respectively west/east, and ~0V or ~5V whenever the HESs are facing north/south, depending on which HES is where. Correct?

Now I am aware that the the 0.39mV is based on the minimal strength of the earths field (0.3G) and the typical sensitivity of the HES (1.3mV/G). So I would wanna amplify the signal somewhat less than mentioned above, to leave “room” for some extra. But you get the idea…

And thanks for the datasheet. It seems somewhat different from the one I have. But strange about the wiper being connected to Vcc+? Never saw any examples of THAT before. I though the wiper was ALWAYS an output (like in OddBot’s circuit f.ex.).

Man these op amp thingies are weird…thank for helping me out again :wink:

Hmmm…

Your wording here did confuse me a bit:

When you are using a single voltage supply as in this case of 0V and 5V you really need to think of Gnd as -V, +5V as +V and 2.5V as 0V.

Though I think you just confirmed what I wrote earlier:

So I get (again ideally) 2.5V whenever the HESs are facing respectively west/east, and ~0V or ~5V whenever the HESs are facing north/south, depending on which HES is where.

This is off course assuming that V+ is fed 5V and V- is grounded and that I amplify the signal to it’s max.