element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sensors
  • Technologies
  • More
Sensors
Sensor Forum Urgent - Need 3.3V tolerant Compass
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Sensors to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 5 replies
  • Answers 2 answers
  • Subscribers 342 subscribers
  • Views 1412 views
  • Users 0 members are here
  • quadcop_project
Related

Urgent - Need 3.3V tolerant Compass

screamingtiger
screamingtiger over 10 years ago

Cliffs:  Anyone know of a magnetic compass that works with the raspberry Pi, I2C and is 3.3V tolerant on the SDA/SCL?  It may need to be tilt compensated.  Please have first hand experience using it, I need it to work I cannot afford any more trial and error.  Thanks!

 

Details:

I've had some serious issues with my quadcop_project in terms of getting heading.  I've tried a mems sensor from xtrinsic but its not compatible via I2C with the Raspberry Pi 2.  It works fine with RPi B+. I digress.

 

I have an HCM5883L breakout and realized its not 5V tolerant, I think I burned it up and the data doesn't make any sense to me.  It is suppose to return a value between 0 and 255 but the registers are 16 bit with MSB and LSB being read independently.

https://www.sparkfun.com/products/10530

 

The examples from the Arduino don't make any sense.  Its really simple to use:

https://www.sparkfun.com/tutorials/301

 

You can see the values they are getting there.  A couple of odd things, the datasheet says it returns the data in 2 compliment form, which to me says I need to flip the bits but the sample code does not such thing. 

 

Regardless, I am not sure how to use this because it has 3 axis!  There is very little information on this board and no idea why I would want a 3 axis reading and how I would use that to calculate north.

  • Sign in to reply
  • Cancel

Top Replies

  • screamingtiger
    screamingtiger over 10 years ago in reply to shabaz +2
    A couple things: I bought 2 of these off ebay, one is bad!!! That keeps happening to me! The other thing is that it does not work with the raspberry PI. The arduino I am using now is 5V and it works with…
  • screamingtiger
    screamingtiger over 10 years ago +1
    BTW, After tinkiering some more I got it working with the raspberry pi directly using the wiringPi library. I am so glad I ordered two of these because one of them is way off and sends random data. The…
Parents
  • screamingtiger
    0 screamingtiger over 10 years ago

    BTW, After tinkiering some more I got it working with the raspberry pi directly using the wiringPi library.    I am so glad I ordered two of these because one of them is way off and sends random data.

     

    The sensor allows you to "write" to one of the registers and what it does is sets a pointer to that register, so when you start reading data it updates the pointer and the next read will be fore the next register (to get X,Y and Z information).  For some reason, this works good with arduino.

     

    However with the raspberry pi I must manually update the pointer, first sending a write byte to each register I want to read in order.  Its just a normal read now, where I specify the register I want to read.  But that was throwing me off.

     

    I now incorporated this into my multithreaded GPS object so it will update every 2 seconds.  The code you sent me was a life saver as it allows me to calculate a heading.  the heading is not accurate at all, but it is consistent and for my project that's all I need.

     

    One thing ODD, the ardunio examples just show the arduino connecting directly to the sensor, though the sensor needs a 3.3v source..   Its not clear if level shifting is needed.  On my breakout board there is also a single regulator making me wonder if it can take in 5V on VCC.

     

    No time to research this.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • screamingtiger
    0 screamingtiger over 10 years ago

    BTW, After tinkiering some more I got it working with the raspberry pi directly using the wiringPi library.    I am so glad I ordered two of these because one of them is way off and sends random data.

     

    The sensor allows you to "write" to one of the registers and what it does is sets a pointer to that register, so when you start reading data it updates the pointer and the next read will be fore the next register (to get X,Y and Z information).  For some reason, this works good with arduino.

     

    However with the raspberry pi I must manually update the pointer, first sending a write byte to each register I want to read in order.  Its just a normal read now, where I specify the register I want to read.  But that was throwing me off.

     

    I now incorporated this into my multithreaded GPS object so it will update every 2 seconds.  The code you sent me was a life saver as it allows me to calculate a heading.  the heading is not accurate at all, but it is consistent and for my project that's all I need.

     

    One thing ODD, the ardunio examples just show the arduino connecting directly to the sensor, though the sensor needs a 3.3v source..   Its not clear if level shifting is needed.  On my breakout board there is also a single regulator making me wonder if it can take in 5V on VCC.

     

    No time to research this.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube