kriswiner / EM7180_SENtral_sensor_hub

(Affordable) Ultimate Sensor Fusion Solution
https://www.tindie.com/products/onehorse/ultimate-sensor-fusion-solution/
96 stars 37 forks source link

Magnetometer Resolution #7

Open lomassubedi opened 8 years ago

lomassubedi commented 8 years ago

Hello kris, Actually your code was very helpful to me to understand about the SENtral Co-processor and the wiki gave me other very important idea about configuration files, algorithm comparison etc. Though I have not yet completed studying the wiki. Thank you very much for sharing the code and these awesome information. On studying SENtral and Sensor along with your code I came to confront a confusion regarding the magnetometer resolution. As in your code resolution for 14 and 16-bit are calculated as : void getMres() { switch (Mscale) { // Possible magnetometer scales (and their register bit settings) are: // 14 bit resolution (0) and 16 bit resolution (1) case MFS_14BITS: mRes = 10.*4219./8190.; // Proper scale to return milliGauss break; case MFS_16BITS: mRes = 10.*4219./32760.0; // Proper scale to return milliGauss /* which equals 1.28788 mG = 0.128788 uT */ break; } } on calculating with FS +/- 1000uT and 16 bit ADC I get resolution of 0.03051uT which is not matching with the above calculation but matches to snippets of the code below :. `

if(eventStatus & 0x08) { // new mag data available
readSENtralMagData(magCount);

// Now we'll calculate the mag value into actual G's
mx = (float)magCount[0]*0.305176;  // get actual G value
my = (float)magCount[1]*0.305176;    
mz = (float)magCount[2]*0.305176;  

} ` Here I humbly request you to give a method to get the exact magnetic field strength in uT/G from the raw magnetic data. Thank you :) .

kriswiner commented 8 years ago

The confusion is that the native MPU9250 magnetometer full scale is 49.12 G (there is a typo in this sketch). The EM7180 outputs mag data for any magnetometer with a full scale of 1000 uT, which corresponds to 10 G for all magnetometers including the MPU9250.

-----Original Message----- From: lomas [mailto:notifications@github.com] Sent: June 6, 2016 2:43 AM To: kriswiner/EM7180_SENtral_sensor_hub Subject: [kriswiner/EM7180_SENtral_sensor_hub] Magnetometer Resolution (#7)

Hello kris, Actually your code was very helpful to me to understand about the SENtral Co-processor and the wiki gave me other very important idea about configuration files, algorithm comparison etc. Though I have not yet completed studying the wiki. Thank you very much for sharing the code and these awesome information. On studying SENtral and Sensor along with your code I came to confront a confusion regarding the magnetometer resolution. As in your code resolution for 14 and 16-bit are calculated as : void getMres() { switch (Mscale) { // Possible magnetometer scales (and their register bit settings) are: // 14 bit resolution (0) and 16 bit resolution (1) case MFS_14BITS: mRes = 10._4219./8190.; // Proper scale to return milliGauss break; case MFS_16BITS: mRes = 10._4219./32760.0; // Proper scale to return milliGauss /* which equals 1.28788 mG = 0.128788 uT */ break; } } on calculating with FS +/- 1000uT and 16 bit ADC I get resolution of 0.03051uT which is not matching with the above calculation but matches to snippets of the code below :. `

if(eventStatus & 0x08) { // new mag data available readSENtralMagData(magCount);

// Now we'll calculate the mag value into actual G's mx = (float)magCount[0]_0.305176; // get actual G value my = (float)magCount[1]_0.305176;
mz = (float)magCount[2]*0.305176;

} ` Here I humbly request you to give a method to get the exact magnetic field strength in uT/G from the raw magnetic data. Thank you :) .

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kriswiner/EM7180_SENtral_sensor_hub/issues/7 , or mute the thread https://github.com/notifications/unsubscribe/AGY1qpnsFe0Q9oc70ePHzAAOZHv4mu 7-ks5qI-uogaJpZM4IuucX . https://github.com/notifications/beacon/AGY1qgevzu7EYnoX7lBwNT6MearOHFlzks5 qI-uogaJpZM4IuucX.gif