A program that implements a digital compass using a LSM303D with a LPC1769 ARM Cortex-M3 from NXP. Displays heading, pitch, and roll data to the LPCXpresso console.
- LPCXpresso IDE
- digital_compass source
- LPC1769
- LSM303D
LPC1769 LSM303D
---------------------------
No connection VDD
H[28] --> VIN
P0[0] H[ 1] --> GND
P0[1] H[ 9] --> SDA
H[10] --> SCL
No connection SDO
No connection INT1
No Connection INT2
- Download digital_compass source.
- Run LPCXpresso and choose workspace location.
- In the LPCXpresso Quickstart panel (lower left corner), click on Import Projects.
- In the Import Projects Window
- If the digital_compass source downloaded in step 1 is zipped, click Browse under Project Archive (zip) and browse for the zipped digital_compass source you downloaded in step 1.
- If the digital_compass source downloaded in step 1 is not zipped, click Browse under Project Directory (unpacked) and browse for the digital_compass source you downloaded in step 1.
- Click next after locating source.
- Select all (digital_compass, lpc_board_nxp_lpcxpresso_1769, lpc_chip_175x_6x). Under Options check box for Copy projects into workspace. Click Finish.
- Sometimes the LPCXpresso console will not handle a printf correctly with its default settings. To fix this go to the Quickstart panel and click on Quick Settings. Make sure all debug sessions are stopped and the digital_compass folder in the Projects panel workspace (Upper left corner) is highlighted.
- Select Set Library/Header Type
- Select Newlib (semihost)
- Using the Quickstart panel, click on Build all projects.
- Click the digital_compass folder in the Projects panel workspace (Upper left corner) to highlight it, if not already highlighted.
- In the Quickstart panel click Debug 'digital_compass'.
- Click on the resume button located on the top tool bar or press the F8 key.
For this specific setup, the LSM303D chip is facing up. The x axis on the LSM303D is the direction of travel. To find North, point and move the direction of travel (the x axis) till the heading in the LPCXpresso console displays a reading of 0 or 359 degrees.
- Heading : rotate the compass about the z axis.
- Pitch : rotate the compass about the y axis.
- Roll : rotate the compass about the x axis.