imu/gnss logger ver1.1

Dependencies:   mbed MPU9250_SPI MG354PDH0 SDFileSystem

Files at this revision

API Documentation at this revision

Comitter:
Joeatsumi
Date:
Tue Nov 16 04:03:44 2021 +0000
Parent:
4:d49256697f27
Commit message:
Magnetometer measurement was added.

Changed in this revision

MPU9250_SPI.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r d49256697f27 -r 38613e30475e MPU9250_SPI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU9250_SPI.lib	Tue Nov 16 04:03:44 2021 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/Joeatsumi/code/MPU9250_SPI/#a5033fbe71a1
diff -r d49256697f27 -r 38613e30475e main.cpp
--- a/main.cpp	Sun Aug 29 05:30:41 2021 +0000
+++ b/main.cpp	Tue Nov 16 04:03:44 2021 +0000
@@ -2,11 +2,12 @@
 //GNSS logger with ublox-NEO7M 
 //MPU board:  mbed LPC1768
 //GNSS module: ublox-NEO7M
-//2021/08/29  A.Toda
+//2021/11/16  A.Toda
 //========================================================
 #include "mbed.h"
 #include "SDFileSystem.h"
 #include "MG354PDH0.h"
+#include "MPU9250.h"        //Include library
 //=========================================================
 //Port Setting
 Serial pc(USBTX, USBRX); // tx, rx
@@ -30,6 +31,7 @@
 
 MG354PDH0        imu(&epson_imu);                     // IMU
 SDFileSystem sd(p5, p6, p7, p8, "sd"); // mosi, miso, sclk, cs
+mpu9250_spi mpu9250(spi,p25);   //define the mpu9250 object
 
 //ファイルポインタ
 FILE *fp;
@@ -87,7 +89,7 @@
 
 //=========================================================
 //Logging variables
-float imu_mesurement_freq = 200.0; //Hz
+float imu_mesurement_freq = 100.0; //Hz
 float gnss_mesurement_freq = 5.0;  //theta_update_freq;
 
 float imu_interval = 1.0f/imu_mesurement_freq;   //sec
@@ -347,11 +349,13 @@
     thermopile_voltage_1 = 3.3*(thermopile_input_1.read());//サーモパイルセンサ_1出力の計測
     thermopile_voltage_2 = 3.3*(thermopile_input_2.read());//サーモパイルセンサ_2出力の計測
       
+    mpu9250.AK8963_read_Magnetometer();
+    
     //計測時間の取得
     measurement_time_g = processing_timer.read();
     
     if(logging_status==1){
-        fprintf(im,"%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",measurement_time_g,gyro_val[0],gyro_val[1],gyro_val[2],acc_val[0],acc_val[1],acc_val[2],thermopile_voltage_1,thermopile_voltage_2);
+        fprintf(im,"%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f\r\n",measurement_time_g,gyro_val[0],gyro_val[1],gyro_val[2],acc_val[0],acc_val[1],acc_val[2],thermopile_voltage_1,thermopile_voltage_2,mpu9250.Magnetometer[0],mpu9250.Magnetometer[1],mpu9250.Magnetometer[2]);
         //pc.printf("IL\r\n");//imu logging
     }else if(logging_status==0){}
     
@@ -578,6 +582,9 @@
 /*--------------------------------------------*/
 int main() {
     
+    mpu9250.init(1,BITS_DLPF_CFG_188HZ);
+    mpu9250.AK8963_calib_Magnetometer();
+    
     CS=1;
     BME_280_CS=1;