Simple 4 LED Compass.

Status
Not open for further replies.

jkirch86

Newbie level 1
Joined
Nov 5, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
I'm working on a project for a simple 4 led compass.

I am using a 3 axis compass module with IIC output.

What I need is a way to turn the leds on or off when the compass is pointing north, south, east, and west.
For example I will use 1 red, 1 blue, 1 green, and 1 yellow. When the compass is heading north, only turn the red on, when east turn the green on, south = yellow, and west = blue.

Any recommendations for the simplest and smallest way to do this?

Thanks for all the help.
 


Use a simple microcontroller such as PICAXE which has a pair of pins defined as I2C interface and which just by using simple BASIC commands will do all the timing required to read data from an I2C device (see attached example on how to connect PICAXE to IIC device).
I don’t know in what format the data is coming from that 3-axis compass module, presumably it will be a number that corresponds to an angle, so take the number and again using BASIC perform comparison of numbers:

If ANGLE > 225 AND ANGLE < 315 then PinX=1
If ANGLE >45 AND ANGLE <135 then PinY=1
And so on …
So if LEDS are connected to PinX, PinY, PinZ … they will come on according to what is the value of ANGLE …..
:wink:
IanP
 

Attachments

  • PICAXE-18 and DS1307.jpg
    50.2 KB · Views: 95

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…