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

Some of the questions about Asset Tracker

1、Can BME680 be enabled for air quality testing? There is no initialization function to get air quality, and the function to get air quality data returns -1.

int env_sensors_get_air_quality(env_sensor_data_t *sensor_data)
{
	return -1;
}

2、The gps_handler() has sending A-GPS request. But I don't receive the A-GPS data when the first connect to the cloud. According to the codes, It needs to send another request an hour later to receive the data. Why is this happening?

Here is my log.

[00:00:15.240,661] [0m<inf> asset_tracker: CLOUD_EVT_CONNECTED[0m
[00:00:15.246,673] [0m<inf> asset_tracker: Persistent Sessions = 1[0m
[00:00:15.253,051] [0m<dbg> nrf_cloud_fsm.connection_handler: Previous session valid; skipping nct_cc_connect()[0m
[00:00:15.263,275] [0m<dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 4[0m
[00:00:15.270,965] [0m<dbg> nrf_cloud_transport.nct_cc_send: mqtt_publish: id = 5678 opcode = 0 len = 0[0m
[00:00:15.281,341] [0m<dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 5[0m
[00:00:16.342,132] [0m<dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_PUBACK: id = 39797 result = 0[0m
[00:00:16.567,138] [0m<dbg> aws_fota.on_publish_evt: Received topic: $aws/things/nrf-352656100375008/jobs/$next/get/accepted[0m
[00:00:16.578,521] [0m<inf> aws_fota: Checking for an available job[0m
[00:00:16.585,052] [0m<dbg> aws_fota.get_job_execution: Job doc: {"clientToken":"","timestamp":1596079648}[0m
[00:00:16.595,123] [0m<dbg> aws_fota.get_job_execution: Got only one field[0m
[00:00:16.602,172] [0m<inf> aws_fota: No queued jobs for this device[0m
[00:00:17.141,082] [0m<dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_PUBACK: id = 5678 result = 0[0m
[00:00:17.151,000] [0m<dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 5[0m
[00:00:17.525,360] [0m<dbg> aws_fota.on_publish_evt: Received topic: nrf-352656100375008/shadow/get/accepted[0m
[00:00:17.535,369] [0m<dbg> aws_fota.on_publish_evt: received an unhandled MQTT publish event on topic: nrf-352656100375008/shadow/get/accepted[0m
[00:00:17.548,339] [0m<dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_PUBLISH: id = 0 len = 316[0m
[00:00:17.559,265] [0m<dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 5[0m
[00:00:17.566,925] [0m<dbg> nrf_cloud.api_event_handler: NRF_CLOUD_EVT_RX_DATA[0m
[00:00:17.574,310] [0m<inf> asset_tracker: CLOUD_EVT_DATA_RECEIVED[0m
[00:00:17.581,542] [0m<inf> cloud_codec: [cloud_search_config:898] Found cfg item GPS, enable[0m
[00:00:17.592,956] [0m<dbg> nrf_cloud_transport.nct_dc_endpoint_set: nct_dc_endpoint_set[0m
[00:00:17.601,409] [0m<dbg> nrf_cloud_transport.nct_dc_endpoint_get: nct_dc_endpoint_get[0m
[00:00:17.611,022] [0m<dbg> nrf_cloud_transport.nct_cc_send: mqtt_publish: id = 7890 opcode = 1 len = 329[0m
[00:00:17.622,528] [0m<dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 7[0m
[00:00:17.630,187] [0m<dbg> nrf_cloud.api_event_handler: NRF_CLOUD_EVT_USER_ASSOCIATED[0m
[00:00:17.638,275] [0m<inf> asset_tracker: CLOUD_EVT_PAIR_DONE[0m
[00:00:26.772,186] [0m<dbg> nrf_cloud_transport.nct_mqtt_evt_handler: MQTT_EVT_PUBACK: id = 7890 result = 0[0m
[00:00:26.782,104] [0m<dbg> nrf_cloud_fsm.cc_tx_ack_handler: Previous session valid; skipping nct_dc_connect()[0m
[00:00:26.792,266] [0m<dbg> nrf_cloud.nfsm_set_current_state_and_notify: state: 9[0m
[00:00:26.799,926] [0m<dbg> nrf_cloud.api_event_handler: NRF_CLOUD_EVT_READY[0m
[00:00:26.807,128] [0m<inf> asset_tracker: CLOUD_EVT_READY[0m
[00:00:26.813,537] [0m<dbg> nrf9160_gps.init: GPS socket created, fd: 1232491587[0m
[00:00:26.828,063] [0m<inf> gps_control: GPS initialized[0m
[00:00:26.833,618] [0m<inf> asset_tracker: Starting GPS[0m
[00:00:26.864,410] [0m<dbg> nrf_cloud_transport.nct_cc_send: mqtt_publish: id = 1 opcode = 1 len = 621[0m
[00:00:26.876,800] [0m<dbg> nrf_cloud_transport.nct_cc_send: mqtt_publish: id = 2 opcode = 1 len = 57[0m
[00:00:26.886,993] [0m<inf> gps_control: Enabling PSM[0m
[00:00:26.893,646] [0m<inf> gps_control: PSM enabled[0m
[00:00:26.899,597] [0m<dbg> nrf9160_gps.enable_gps: GPS mode is enabled[0m
[00:00:26.911,224] [0m<dbg> nrf9160_gps.start: GPS operational[0m
[00:00:26.917,236] [0m<inf> gps_control: GPS started successfully. Searching for satellites [0m
[00:00:26.925,842] [0m<inf> gps_control: to get position fix. This may take several minutes.[0m
[00:00:26.934,417] [0m<inf> gps_control: The device will attempt to get a fix for 360 seconds, [0m
[00:00:26.943,267] [0m<inf> gps_control: before the GPS is stopped. It's restarted every 30 seconds[0m
[00:00:26.952,514] [0m<inf> asset_tracker: GPS_EVT_SEARCH_STARTED[0m
[00:00:26.958,892] [0m<dbg> nrf9160_gps.gps_thread: A-GPS data update needed[0m
[00:00:26.966,125] [0m<inf> asset_tracker: GPS_EVT_AGPS_DATA_NEEDED[0m+CSCON: 0
[00:00:27.730,926] [0m<dbg> lte_lc.at_handler: +CSCON notification[0m
[00:00:27.911,193] [0m<dbg> nrf9160_gps.gps_thread: Waiting for time window to operate[0m
[00:00:27.919,281] [0m<inf> asset_tracker: GPS_EVT_OPERATION_BLOCKED[0m
[00:00:27.972,625] [0m<inf> asset_tracker: Sending A-GPS request[0m
[00:00:28.019,958] [0m<inf> asset_tracker: A-GPS request sent[0m
[00:00:28.080,718] [0m<dbg> nrf9160_gps.gps_thread: GPS has time window to operate[0m
[00:00:28.088,470] [0m<inf> asset_tracker: GPS_EVT_OPERATION_UNBLOCKED[0m
[00:00:28.095,153] [0m<dbg> nrf9160_gps.print_satellite_stats: Tracking: 0 Using: 0 Unhealthy: 0[0m
[00:00:28.104,125] [0m<dbg> nrf9160_gps.print_satellite_stats: Seconds since last fix 28[0m
[00:00:29.080,871] [0m<dbg> nrf9160_gps.print_satellite_stats: Tracking: 0 Using: 0 Unhealthy: 0[0m
[00:00:29.089,843] [0m<dbg> nrf9160_gps.print_satellite_stats: Seconds since last fix 29[0m

Parents
  • Hi Xinjiang,

    1.
    It is because you need to run the BSEC library, so just use that instead --> https://github.com/nrfconnect/sdk-nrf/blob/master/applications/asset_tracker/src/env_sensors/env_sensors.c#L196

    2.
    Could you share the full log over a longer period of time?

    Also make sure you are using the latest mfw: https://www.nordicsemi.com/Products/Low-power-cellular-IoT/nRF9160/Download#infotabs

    (you can try to send the A-GPS request before the GPS turns ON, and then give a delay around 5-10 seconds to respond before GPS (including PSM) turns ON).


    One quick test you can do is to set CONFIG_GPS_CONTROL_PSM_ENABLE_ON_START=n in prj.conf, to see if it is some issues with PSM.
    (which SIM card are you using?)

  • 1、The code in this website also does not initialize the air quality test. I tried to turn this on myself.

    +static struct env_sensor quality_sensor = {
    +	.sensor =  {
    +		.type = ENV_SENSOR_AIR_QUALITY,
    +		.value = 0,
    +	},
    +	.channel = SENSOR_CHAN_GAS_RES,
    +	.dev_name = CONFIG_TEMP_DEV_NAME
    +};
    
    /* Array containg environment sensors available on the board. */
    static struct env_sensor *env_sensors[] = {
    	&temp_sensor,
    	&humid_sensor,
    	&pressure_sensor,
    +   &quality_sensor
    };
    
    int env_sensors_get_air_quality(env_sensor_data_t *sensor_data)
    {
    +	if (sensor_data == NULL) {
    +		return -1;
    +	}
    +	k_spinlock_key_t key = k_spin_lock(&quality_sensor.lock);
    +
    +	memcpy(sensor_data, &(quality_sensor.sensor),
    +		sizeof(quality_sensor.sensor));
    +	k_spin_unlock(&quality_sensor.lock, key);
    +	return 0;
    //        return -1;
    }

    I get the following data. I don't know what this means. What are the units of this data?

    {"appId":"AIR_QUAL","data":"74625","messageType":"DATA"}
    {"appId":"AIR_QUAL","data":"81131","messageType":"DATA"}
    {"appId":"AIR_QUAL","data":"10675","messageType":"DATA"}
    {"appId":"AIR_QUAL","data":"10213","messageType":"DATA"}

    2、According to the nrf_cloud_apgs routine, I turned on the GPS three seconds after sending the A-GPS request and successfully received the A-GPS data.

    Best regards,

    Xinjiang

  • Hi Xinjiang,

    1.

    From the datasheet

    (Please note the BME680 sensor, like all VOC/gas sensors, has variability and to get precise measurements you will want to calibrate it against known sources! That said, for general environmental sensors, it will give you a good idea of trends and comparisons. We recommend that you run this sensor for 48 hours when you first receive it to "burn it in", and then 30 minutes in the desired mode every time the sensor is in use. This is because the sensitivity levels of the sensor will change during early use, and the resistance will slowly rise over time as the MOX warms up to its baseline reading.)


    2.
    Good to hear that you made it work out.

Reply
  • Hi Xinjiang,

    1.

    From the datasheet

    (Please note the BME680 sensor, like all VOC/gas sensors, has variability and to get precise measurements you will want to calibrate it against known sources! That said, for general environmental sensors, it will give you a good idea of trends and comparisons. We recommend that you run this sensor for 48 hours when you first receive it to "burn it in", and then 30 minutes in the desired mode every time the sensor is in use. This is because the sensitivity levels of the sensor will change during early use, and the resistance will slowly rise over time as the MOX warms up to its baseline reading.)


    2.
    Good to hear that you made it work out.

Children
No Data
Related