Let's Make Robots!

Location, location, location!

Hello everyone!

Now, I'm sure I can't be the first with this problem. A quick scan of the forums didn't turn up much, so I'll ask outright. I have a semi-autonomous robot project (won't bore with details) and I absolutely NEED to have a coordinate system (X, Y, and the direction the robot is facing). This can't involve any GPS or expensive digital compass sensors, and it needs to be pretty accurate. And because this might be asked, I'm running a twin gearbox Tamiya motor and two rubber wheels. It's a pretty small setup. Someone here has to have run into this before...what are your suggestions or solutions?

Thanks in advance! 

- P 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Aniss1001's picture
Please keep us updated on how this (DIY compass) moves along. I for one am VERY interested in how you manage to make it work :)
circuitBurn's picture

I'm going to be placing orders for parts this week, thanks to a new schematic posted here by a very clever person : )

I'll get a video up (I hope..) and all that jazz when I get time, but the project is on a really tight schedule so I have to have it built the day I receive components. You'll hear soon.

Thanks for all the questions/interest/assistance with this everyone!

- P 

OddBot's picture

The earths magnetic field varies in strength depending how close to the poles you are. It may be as little as 0.3G. The UGN3503 has a typical output of 1.3mV / G so your output is going to be half of the supply voltage +/- 0.39mV. You would want an amplifier with a gain of 6410 to get this to +/- 2.5V. Depending on your ADC's resolution and the accuracy you need you can probably reduce the gain to about 900.

If you can get the A1323LUA-T or better still the A1321LUA-T then you will be better off as they have better sensitivity and according to the datasheet are probably more accurate.

The schematic you posted probably won't work as you need a reference voltage equal to half of the supply voltage. Amplifying DC voltages by large amounts can be difficult as any offset is amplified as well. Here is a schematic that should work. I have used 4 sensors. 2 pairs with each pair back to back to double the sensitivity. As the output of one increases, the other decreases. The amplifier is configured to amplify the difference between the two outputs. Click on the schematic for a bigger picture.

Compass_Schematic__small_.jpg

The sensor pair marked North/South are mounted at 90 degrees to the sensor pair marked East/West. You need these sensors mounted at 90 degrees to each other because when the flux lines pass through the sensor at 90 degrees to the sensors face the output is the same as if there was no magnetic field at all at which point the other pair will tell which way the robot is facing.

In my schematic the amplifiers have a gain of only 100. More Gain can be achieved by replacing the 100K resistors with 1M resistors should increase the gain to 1000 although you may have trouble calibrating it. I have used the CA3140 op-amp because it will work on voltages as low as 4V and the outputs will go from 0 to 5V.

Connect the outputs directly to your analog inputs. With a 10bit ADC your resolution is about 4.8mV, The circuit above should give an output of 2.5V +/- 150mV with a magnetic field strength of 0.3G. Your ADC should read 512 +/- 31. Using the more sensitive A1321 sensors will double the resolution to +/- 64.

fritsl's picture
OddBot you are very clever!
Aniss1001's picture
I'll second that :)
circuitBurn's picture

Ok...so I quickly came up with a circuit this morning that translates the output from the hall effect sensors into a 0-5V range for ADC use. the link has the circuit + calculations, so if anyone sees anything wrong with this, please let me know and I'll correct it. :)

For those thinking of using this as a compass, this is only half of the circuit. Another one is required for the second HES, and I'm working on an algorithm to translate the resulting voltages into a single 0 - 360 degree value. I'll post that once it's done. (hopefully this afternoon)

Once again, thanks for all of the links people!

Circuit and calculations: http://imgur.com/7IP1k.jpg

- P 

EDIT: Yikes...I didn't read through the datasheet properly...That schematic is all wrong...I'll have a new post in a minute!  

EDIT: Ok..I think all I needed to do was remove the bias resistors. It's also now a non-inverting amp. The image linked above is the new schematic with calculations. 

Aniss1001's picture

Just wondering what kind of sensor you're planning to use? It would seem that the UGN3503UA that OddBot suggested is no longer in production...

And thanks for posting the circuit. I might use it too :)

circuitBurn's picture

OddBots link to his walkthrough had a link to an online supplier who seemed to carry it. I'll double check now. I know sparkfun has a hall effect sensor, but I think it's digital and doesn't give the same kind of response. 

I'm also worried about how sensitive this sensor is going to be...I guess since OddBot is the only one who seems to have used it...would you know if it gives the entire +/-900G as described in the datasheet from the earth's magnetic field?

- P 

Aniss1001's picture

In the meantime I found a place that sells the UGN3503U, so I'll be going for that one. 

And I can't help you with your question since I never uses one of these things before and don't know much about them...

robologist's picture