How To Get Azimuth Elevation

Alright, I'm working on a project where I need to get the azimuth and elevation (3D polar rotation) of the device, and I'm kind of stuck on how to do this.

I was looking at an accelerometer, but they cannot read azimuth. I've looked into a tilt compass, but it seems to be complete overkill, as well as very difficult to program and use.

So, my question is simple, what is the best way to read in azimuth / elevation (simple compass + accelerometer, gyroscope, etc.)?


Senior Member
Having identified and rejected one 'best' way, you may need to qualify what best means.

A clue on the target device - a free rolling football, a pan+tilt mech secured to a level base, something in between?
I think that your best bet is to use a compass module for Azimuth and an accelerometer for Elevation.

I've used a compass to measure the azimuth of an observatory dome and it works well. The simplest way is to mount the compass flat, then just use the XY vector to get the magnetic heading.

Similarly for the elevation, it will be easier if the acellerometer can be mounted so one axis is always horizontal, the tilt then becomes a 2D problem which is easier to solve.

I wouldn't fancy trying to do a full 3D solution in a PicAxe.

Planning on doing something similar. Using a £1.50 breakout board 3 axis G sensor (only 1 axis) and a I2C compass module, also cheap at under £2. Both from Ebay, and for controlling/tracking a beam aerial. I have the 3 axis G sensor working to drive 3 servos in X Y & Z, very responsive. Amazing for the money.