How To Create A Bluetooth Mesh that contain Servers with Multiple Sensor and 1 Client polling on sensor value

Hi everyone, I'm currently developing a application that tracking athlete status on a soccer field.

Can anyone help me with tutoring me to create a mesh that a client receives multiple servers(athletes) like 10 or 20  packet a second.

My server node contain IMU, GPS and a ECG sensor which already filtered and calculated to create some numbers like lat, long, orientation and heart beat per minute.

 

Thanks 

Hirls 

Parents Reply Children
  • Hi Hieu, I'm currently switched to modify the light switch example. I'm successfully publish a string from server to client that had like 50 char long but I'm not able to publish at high rate like 10 message a second. I check the log it's always miss like 7 to 8 messages. Does there any tips to increase the throughput of that.

  • Hi Hirls,

    Are you able to tell if your messages are transmitted, but failed to be received, or if they are never transmitted at all?

    How are you setting up the message transmit? What is the trigger?

  • Hi Hieu. What I'm doing right now is modify the light switch server example like below.

    static uint32_t string_send(generic_onoff_server_t * p_server,uint8_t *string)
                                
    {
        generic_onoff_status_msg_pkt_t msg_pkt;
        access_message_tx_t reply =
        {
            .opcode = ACCESS_OPCODE_SIG(GENERIC_ONOFF_OPCODE_STATUS),
            /* custom test*/
            .p_buffer = (const uint8_t *)string,// &msg_pkt,
            .length = strlen(string),//p_params->remaining_time_ms > 0 ? GENERIC_ONOFF_STATUS_MAXLEN : GENERIC_ONOFF_STATUS_MINLEN,
            /* custom test*/
            //.p_buffer = (const uint8_t *) &msg_pkt,
            //.length = p_params->remaining_time_ms > 0 ? GENERIC_ONOFF_STATUS_MAXLEN : GENERIC_ONOFF_STATUS_MINLEN,
            .force_segmented = p_server->settings.force_segmented,
            .transmic_size = p_server->settings.transmic_size
        };
            return access_model_publish(p_server->model_handle, &reply); 
    }
    
    uint32_t generic_onoff_server_send_string(generic_onoff_server_t * p_server,uint8_t *string)
    {
        if (p_server == NULL )
        {
            return NRF_ERROR_NULL;
        }
    
        return string_send(p_server,string);
    }
    

    generic_onoff_server.c

    void app_onoff_send_string(app_onoff_server_t * p_app,uint8_t *string)
    {
        (void) generic_onoff_server_send_string(&p_app->server,string);
    }

    app_onoff.c

    And in main, I use an app_timer to trigger each publish every 100ms.

    uint8_t test[350];
    uint8_t send_char;
    uint8_t num=0;
    
    static void repeated_timer_handler(void * p_context){
      num++;
      send_char=num+'0';
      
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO,"send_char is %c\n", send_char);
      test[0]=send_char;
      //test[1]='0';
      //test[2]='1';
      //test[3]='2';
      test[348]='3';
      test[349]='\n';
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, test);
      if(num==9) num=0;
      app_onoff_send_string(&m_onoff_server_0,test);
    }
    
    static void create_timers()
    {
        ret_code_t err_code;
    
        // Create timers
        err_code = app_timer_create(&m_repeated_timer_id,
                                    APP_TIMER_MODE_REPEATED,
                                    repeated_timer_handler);
        APP_ERROR_CHECK(err_code);
        err_code = app_timer_start(m_repeated_timer_id, APP_TIMER_TICKS(100), NULL);
        APP_ERROR_CHECK(err_code);
    }
    
    int main(void)
    {
        initialize();
        start();
        create_timers();
        memset(test,'k',350);
        test[348]='3';
        test[349]='\n';
        
    
        for (;;)
        {
            (void)sd_app_evt_wait();
            
        }
    }

    In client source I modify the struct generic_onoff_status_params_t so I can print out the data in set_cb function.

    typedef struct
    {
        uint8_t present_on_off;                                 /**< The present value of the Generic OnOff state */
        uint8_t target_on_off;                                  /**< The target value of the Generic OnOff state (optional) */
        uint32_t remaining_time_ms;                             /**< Remaining time value in milliseconds */
        uint8_t *cus_string;
    } generic_onoff_status_params_t;

    And here is the rtt log 

  • Hi Hirls,

    I am not able to go into the code at this moment, but it looks like your message is not 50 bytes, but rather 350 bytes.

    Do you actually receive all 350 bytes correctly? If I remember correctly, the limit of a Bluetooth Mesh segmented message is lower than 350.

    Have you tried with a smaller number? 50 or maybe 100?

Related