digital compass output being fed into an analogue input

Apr 18, 2006 7 Replies

Hi everyone,



Hoping I could get someone's opinion out there. I need to get the output from a compass into an analogue input port. The output from the compass can either be digital or analogue, the input is rated between



0V and 5V.

My initial thoughts on the problem is to get a digital compass, put the output through a DAC which gives me an analogue signal from 0 to 5V, and then feed that into the analgoue input.



I've done an engineering degree which means that I have just about no practical electronics knowledge (regulators, optical isolators, what are they used for? :) ) I was wondering if there are any caveats I should be aware of in this kind of setup, or is there a better way of doing it?



Can anybody recommend any parts (digital compass/DAC)? The digital compass doesn't have to be anything too flash, one degree resolution is fine, all the parts have to run off 6V.



Thanks!



Taras



Hi, Taras. You didn't identify the compass you were using, which would have helped a lot. Especially if documentation was available -- the first thing you would do in something like this is to look at what the manufacturer's provided for you to use.

I've seen digital compasses with analog outputs. The ones I've seen have an RS-232 serial data output, and I'd guess your device has one of those rather than, say, a 10-bit BCD output.

The way to go with this is with a PIC or other small microcontroller that has serial input capability and a DAC output pin. You'll probably want to use a rail-to-rail output op amp as a buffer of the PIC signal.

On the power side, you'll need to use an LDO (low dropout regulator) to change your 6V battery voltage into the 5V power supply the uC can use.

It's kind of tough to be very specific without more information. Please let us know what compass you're using.

Good luck Chris

Hey Chris,

Thanks for the reply. I didn't identify the compass I'm using because I haven't decided on one yet! The only requirements are that it has to be low cost and simple to use (its for a toy robot, so the requirements are not strict).

I've been looking at the honeywell website:

formatting link
and I think the things on there are a bit too complicated (what is a z-axis sensor?)

I was hoping to keep it simple. Basically any compass will do as long as it can run on 6 volts and has about a 1 degree resolution (only the heading is required, not pitch or roll). I was hoping that there would be a compass out there that either has an analgoue output (the voltage is proportional to the heading) or a simple digital output - One that, for example, outputs 340 in binary on its output lines when the heading is 340 - a bit like the 1490

formatting link
but an output that isn't encoded and has better resolution.

So in short I was hoping for any suggestions reg the compass to use. One that communicates via a bus (RS-232, I2C, SPI, etc..) would be fine (although not as desirable as the simpler options), but as you said it would require a micro able to read from the bus and convert to an analogue signal.

Any suggestions would be appreciated!!

Taras

The analogue output on this:

formatting link
compass looks like what I would ideally want, but the entire thing looks way too expensive - don't even want to try to look for a price

Hi, Taras. First off, if you're looking for one of these electronic compasses with a standard parallel BCD output that you could feed to a standard 8- or 10-bit DAC, you're out of luck. Those don't exist.

I'm not familiar with a low-end, good precision electronic compass that has the analog output you're looking for.

Most of these come with a serial digital output. I've used the Arrick (now Precision Navigation) Vector 2X, which is available at Jameco for $49.99 USD. It has a serial SPI output, though. You might want to look into this if the price range is right, and you can find a way to hve your uC do SPI (many PICs have this capability).

If I had to do what you're talking about, I'd add a $2 PIC to take care of the SPI, and output an analog PWM output. You could then use some filtering (and possibly an op amp) to give your analog voltage.

But if you want to come down from there on price (I'd guess that's your goal if you're talking toys), you might want to look at a short description of the technology used in the Vector 2X from Don Lancaster:

formatting link

Feel free to post back.

Chris

By the way, Taras, please read this easy link on the "proper" way to post to newsgroups from Google Groups:

formatting link

Thanks Chris

HI

I've had a look at this - its pretty much exactly what I need except probably at the top end of my price range. I also found this digital compass, which seems to meet my requirements and is a little cheaper:

formatting link

This is still pretty expensive, so I had a look at the magnetic sensor it uses. It is the Phillips KMZ51

formatting link
I had a quick look at the datasheet and it seems that using this would require some real engineering work - its not simply plugging prebuilt components together. Any idea how difficult it would be?

As you said you would have to filter the PWM output, which implies you would lose some accuracy (with a simple filter at least). Had a look around on the microchip website and found a DAC (TC1320) that converts from I2C/SPI to analgoue for around $1. I think this is a good solution.

formatting link

What do you think?

Thanks for your time

Taras

PS: Cheers for the link regarding posting on google groups - I was wondering how to do that

formatting link

Hi, Taras. It looks like you're on your way to a solution.

You know, I don't know if the serial DAC is compatible. I haven't used it myself, and I don't know if the data formats are compatible. If I were in your shoes, I'd just give Precision Navigation a call on Monday and ask. Back when they were Arrick, I used some of their other stuff for a few of industrial and lab automation applications, and found them to be really helpful. Possibly they've done work on this, and can recommend something.

Good luck Chris

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required