This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Log data in thingy 52

Hi, I'm new to thingy, I want to log the data received and viewed in mobile app / web app from thingy 52 development kit which contains nRF52832. Is it possible to log data? If yes, how to log data, else is there any alternative way to log the data received through BLE from kit.

Parents
  • Hi Hemabas,

    Remember that the Thingy:52 is not a Development Kit, but a reference design. So to access the nrf52832 to flash/read you need a 10-pin connector and the debug-out from a nrf52 DK.

    Add this in sdk_config.h.

    #define NRF_LOG_ENABLED 1
    
    #define NRF_LOG_DEFAULT_LEVEL 4

    Increase the NRF_LOG_DEFAULT_LEVEL to 4 to get out debug messages as you can see in "drv_motion.c":

    #if NRF_LOG_ENABLED
        void print_sensor_status(void)
        {
            long acc_bias[NUM_AXES];
            long gyr_bias[NUM_AXES];
            long mag_bias[NUM_AXES];
            int acc_accuracy;
            int gyr_accuracy;
            int mag_accuracy;
            
            inv_get_accel_bias(acc_bias, NULL);
            inv_get_gyro_bias(gyr_bias, NULL);
            inv_get_compass_bias(mag_bias);
            
            acc_accuracy = inv_get_accel_accuracy();
            gyr_accuracy = inv_get_gyro_accuracy();
            mag_accuracy = inv_get_mag_accuracy();
            
            NRF_LOG_DEBUG("Acc bias: ");
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(acc_bias[0]));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(acc_bias[1]));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(acc_bias[2]));
            
            NRF_LOG_DEBUG("Gyr bias: "); 
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(gyr_bias[0]));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(gyr_bias[1]));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(gyr_bias[2]));
    
            NRF_LOG_DEBUG("Mag bias: ");
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(mag_bias[0]/(2^16)));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(mag_bias[1]/(2^16)));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(mag_bias[2]/(2^16)));
    
            NRF_LOG_DEBUG("Accur: Acc: %d, gyr: %d, mag: %d \r\n", acc_accuracy, gyr_accuracy, mag_accuracy);
        }
    #endif


    Ex.

    Download a fresh copy of the thingy SDK.

    1. Enable nrf_log and set the Log level to 4.

    2. Compile and flashe the application, and connect (BLE) to the Thingy with nrf connect mobile.

    3. Turn on the "Thingy Raw Data Characteristic" in the motion service and get out this from the RTT log:

    (added .hex file:)app_thingy_s132.hex

Reply
  • Hi Hemabas,

    Remember that the Thingy:52 is not a Development Kit, but a reference design. So to access the nrf52832 to flash/read you need a 10-pin connector and the debug-out from a nrf52 DK.

    Add this in sdk_config.h.

    #define NRF_LOG_ENABLED 1
    
    #define NRF_LOG_DEFAULT_LEVEL 4

    Increase the NRF_LOG_DEFAULT_LEVEL to 4 to get out debug messages as you can see in "drv_motion.c":

    #if NRF_LOG_ENABLED
        void print_sensor_status(void)
        {
            long acc_bias[NUM_AXES];
            long gyr_bias[NUM_AXES];
            long mag_bias[NUM_AXES];
            int acc_accuracy;
            int gyr_accuracy;
            int mag_accuracy;
            
            inv_get_accel_bias(acc_bias, NULL);
            inv_get_gyro_bias(gyr_bias, NULL);
            inv_get_compass_bias(mag_bias);
            
            acc_accuracy = inv_get_accel_accuracy();
            gyr_accuracy = inv_get_gyro_accuracy();
            mag_accuracy = inv_get_mag_accuracy();
            
            NRF_LOG_DEBUG("Acc bias: ");
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(acc_bias[0]));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(acc_bias[1]));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(acc_bias[2]));
            
            NRF_LOG_DEBUG("Gyr bias: "); 
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(gyr_bias[0]));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(gyr_bias[1]));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(gyr_bias[2]));
    
            NRF_LOG_DEBUG("Mag bias: ");
            NRF_LOG_DEBUG("X: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(mag_bias[0]/(2^16)));
            NRF_LOG_DEBUG("Y: "NRF_LOG_FLOAT_MARKER" ",     NRF_LOG_FLOAT(mag_bias[1]/(2^16)));
            NRF_LOG_DEBUG("Z: "NRF_LOG_FLOAT_MARKER" \r\n", NRF_LOG_FLOAT(mag_bias[2]/(2^16)));
    
            NRF_LOG_DEBUG("Accur: Acc: %d, gyr: %d, mag: %d \r\n", acc_accuracy, gyr_accuracy, mag_accuracy);
        }
    #endif


    Ex.

    Download a fresh copy of the thingy SDK.

    1. Enable nrf_log and set the Log level to 4.

    2. Compile and flashe the application, and connect (BLE) to the Thingy with nrf connect mobile.

    3. Turn on the "Thingy Raw Data Characteristic" in the motion service and get out this from the RTT log:

    (added .hex file:)app_thingy_s132.hex

Children
No Data
Related