mavishak / cnss-embedded

1 stars 0 forks source link

Testing Firebase connection #18

Open mavishak opened 3 years ago

mavishak commented 3 years ago

24/03/2021

Today we let the device run for a few hours and recorded the last hour's logs - the file is attached below. The main program sent ongoing alert records to Firebase under zazu_device_ID.

The purpose of this test was to check the reliability of the connection with firebase and check if there are any AT commands that need timing or general functionality adjustments.

All in all, around 400 messages were sent to the real-time database in the last 4 hours, The log file recorded 100.

Pass is identified with :) Fail is identified with :(

The AT commands that where problematic: AT+CIPSTART="SSL","firebase-url.com",443 AT+CWMODE=1

They might need more time, or we might need to disconnect with a CIPCLOSE after CIPSTART even if it fails. 1 hout run output 17/03/2021.log

NaomiCreate commented 3 years ago

26/03/2021

We recorded an hour log of the following main:

#include "stm32f103xb.h"
#include "hc-sr501pir_sensor.h"
#include "usart.h"
#include "esp8266_Firebase.h"
#include "esp8266_WiFi.h"
#include "timers.h"
#include "common.h"

int main(void)
{
init_usart2();
init_timer4();
init_usart1();
write_usart2((uint8_t*)("\r\n_______________\r\n"));
while(1)
{
if(recordAlert()){
write_usart2((uint8_t*)(":)\r\n"));
}
else{
write_usart2((uint8_t*)(":(\r\n"));
}
write_usart2((uint8_t*)("\r\n.....................\r\n"));
write_usart2((uint8_t*)("\r\n\r\n"));
}
}

The delay times and timeout in the test were: _ssl_tries = 3 _cipstart_tries = 3 _ssl_timeout = 6 _cipstart_timeout = 20 We set them in the following call to function: connectFirebaseHost(3,3,6,20)

The alerts are sent to firebase under the id: Timon-device-ID

1 hour run output 26-03-2021.log

mavishak commented 3 years ago

29/03/2021

After analyzing both log files, we found that setting the timeout value, when connecting to the Firebase host, as described above seems to do the trick. In one hour we sent 549 alerts in firebase, not one of them failed.

We need to test a few more times to make sure that it was not pure luck...