View previous topic :: View next topic |
Author |
Message |
EDC
Joined: 26 Mar 2014 Posts: 705

|
Posted: Thu Apr 26, 2018 5:08 pm Post subject: HMC5883L and QMC5883L (3 axis compass) |
|
|
Hello. This code is for modules named GY-271 or GY-273
GY-271 have simple level translators where GY-273 is "simples/cheap made" or dedicated for 3V3
First I wrote code for HMC5883L and...code dont work for me
After some investigation I read that those modules uses two chip manufacturers. So module can be equpped with QM.. or HM..
QM with I2C scanner respond at &H1A where HM should respond at &H3C (I dont have this chip)
So I wrote code for QM "from scratch" with datasheet and it finally work
I attach both codes and datasheets for them. WIth this basic readings you can calculate more complex data. |
|
Back to top |
|
 |
albertsm
Joined: 09 Apr 2004 Posts: 5119 Location: Holland

|
Posted: Fri Apr 27, 2018 8:40 pm Post subject: |
|
|
you are very productive
Thanks for sharing your work. Indeed a good idea to run the i2c scanner. That would be my advise too when i2c slave is not working as expected.
A big problem with lot of chips : there are many different versions which look similar. But we have EDC , so no problem  _________________ Mark |
|
Back to top |
|
 |
micro_anne
Joined: 28 Nov 2014 Posts: 6
|
Posted: Sat Jun 02, 2018 12:07 pm Post subject: |
|
|
Hi,
congratulations on your awesome project.
I do have some questions for you and others who may be reading.
I tried in the past to get the MPU9250 9DOF working under bascom. I managed to get the I2C communication working, also reading the registers, writing new settings to the registry, and read the raw data was not a big problem.
What I couldn't do in Bascom was calculate the quaternions based on these raw data.
Calculating valid euler angles should be possible though I didn't find any successful attempt under bascom.
Would you, or anybody else, know how would that be done ?
Second question related to your shared work: Is there a big difference between using accelerometers and gyros to get the Yaw, Pitch, Roll angles and just using a 3 axis compass to accomplish the same thing ? Can I use this module to navigate without the assistance of any other inertial nav. plaforms ?
thanks again for sharing knowledge |
|
Back to top |
|
 |
EDC
Joined: 26 Mar 2014 Posts: 705

|
Posted: Sat Jun 02, 2018 12:59 pm Post subject: |
|
|
MPU means that some of the calculations is made by MPU chip and they are ready to read for chip who want the data.
I dont remember exactly what MPU I use one day 6050 or so.
But more important is that any library/API can be translated to the Bascom.
To be honest and precise: You can drive any device that AVR can drive/use and write library for it by reading device datasheet.
But when one know second language because like learning then translate some of the done work/code is easy.
My point is that : "If you can find any working library for the chip then it can be easy translated"
For HMC i translate Arduino lib , for QMC I work on it from scratch with the datasheet (but with some basic knowledge and maybe nomenclature(naming of variables are same for code compatibility)).
Sensor give you data about X, Y and Z axis, but gyroMPU give you ready to use data about acceleration in the 3D directions and AVR dont need to calculate them. This is the difference between Sensor and the gyroMPU. |
|
Back to top |
|
 |
autoguider
Joined: 24 Sep 2007 Posts: 74 Location: Aachen

|
|
Back to top |
|
 |
hgrueneis
Joined: 04 Apr 2009 Posts: 880 Location: A-4786 Brunnenthal

|
Posted: Wed Jan 13, 2021 4:27 pm Post subject: |
|
|
Christian,
a tilt compensated Compass will not work right at 90 degrees tilt.
There are easier ways to determine the direction especially with a lot of iron around, if you have other means like 10-rot pots with calibration possibilities, evaluated by adc sense readings. Optical reading of an offset bar strip will also let you know the count forward and reverse. especially if you power your 'TOWER' rotation with servos. This would also enable you to control the positions of your telescopes to less than a second, which could be very useful in finding distant objects. A compass with Iron around can easily be off by 20 degrees!
I would not go with a compass, but just my thinking.
Regards
Hubert |
|
Back to top |
|
 |
|