-
Notifications
You must be signed in to change notification settings - Fork 5
Add a compass example #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've got an order that includes these sensors on the way to me now. Once they arrive I will work on bringing these examples into the new libraries |
I've started an example script for this here: https://github.com/FoamyGuy/CircuitPython_Compass_Example/blob/master/code.py I've tried it with LIS3MDL and LSMDLH and I do get varying 0-360 heading values depending on how I hold and point the sensor. However I'm not certain exactly how to use it to match up the heading values with cardinal directions. |
find north - try pointing the X arrow on the board to north, then Y and then Z, you should see a spike in the numbers |
Thank you! I was able to get both sensors coordinating pretty closely to a compass app on a phone. Starting with the X arrow pointing north I adjusted slightly the tilt until it matched 0 heading, then I could hold the sensor steady and rotate and see headings in the same range as the ones reported by the phone. |
Looking over this again today I notice a slight difference that I am curious about. In the old PR code we have this inside of the
It seems like this would be using x and z values from the magnetometer. Whereas in the arduino code from here we have it like this:
Using x and y values from the magnetometer. Do I understand it correctly that either of these would work, the difference would be that you need to hold the sensor in a different position (on a different axis?) when you get your compass heading readings? If so is there any preference for which is used for the new example code? |
x and y are the most common |
This was completed. |
This PR in an older lib had the good idea to add a compass example:
https://github.com/adafruit/Adafruit_Python_LSM303/pull/4/files
We should add similar code to this lib
The text was updated successfully, but these errors were encountered: