A Telegram BOT for this awesome all-in-one board.
Dependencies: BSP_B-L475E-IOT01 mbed es_wifi jsmn
Telegram Bot for DISCO_L475VG_IOT01
This application embeds aTelegram chatbot into the DISCO_L475VG_IOT01 board.
The Bot answers to the users queries about:
- Real time environmental data taken from the on board sensors.
- Environmental data history of the latest 24 hours stored on board.
- Camera images taken from the Arducam-mini-2mp (optional).
This software uses:
- A modified version of the wifi library provided by ST in order to enable the TCP-SSL connection.
- An open source json parser jsmn (https://github.com/zserge/jsmn).
- A web service (http://now.http.org) to initialize the RTC.
- A web service (https://image-charts.com) to publish temperature,humidity and pressure charts.
- A modified version of the Arducam driver (https://os.mbed.com/users/dflet/)
Compilation
Import in your compiler and modify the following defines:
- WIFI_SSID
- WIFI_PASSWORD
- TELEGRAM_BOT_APIKEY
Please follow the Telegram bots documentation (https://core.telegram.org/bots) to better understand how the Telegram API works and how to create your bot.
In order to support the Arducam-Mini-2MP set WITH_ARDUCAM_2640 #define to 1.
Screenshots
Security
The Inventek wifi module creates the ssl connection but does not authenticate the server's certificate ( AT cmd P9=0 ).
For more details http://www.inventeksys.com/IWIN/programming-certificates-tcp-ssltls/
Diff: main.cpp
- Revision:
- 0:1fc46da4a976
- Child:
- 1:60fbd0835b9d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jan 23 13:06:11 2018 +0000 @@ -0,0 +1,66 @@ +#include "mbed.h" + +// Sensors drivers present in the BSP library +#include "stm32l475e_iot01_tsensor.h" +#include "stm32l475e_iot01_hsensor.h" +#include "stm32l475e_iot01_psensor.h" +#include "stm32l475e_iot01_magneto.h" +#include "stm32l475e_iot01_gyro.h" +#include "stm32l475e_iot01_accelero.h" + +DigitalOut led(LED1); + +int main() +{ + float sensor_value = 0; + int16_t pDataXYZ[3] = {0}; + float pGyroDataXYZ[3] = {0}; + + BSP_TSENSOR_Init(); + BSP_HSENSOR_Init(); + BSP_PSENSOR_Init(); + + BSP_MAGNETO_Init(); + BSP_GYRO_Init(); + BSP_ACCELERO_Init(); + + while(1) { + + led = 1; + + sensor_value = BSP_TSENSOR_ReadTemp(); + printf("\nTEMPERATURE = %.2f degC\n", sensor_value); + + sensor_value = BSP_HSENSOR_ReadHumidity(); + printf("HUMIDITY = %.2f %%\n", sensor_value); + + sensor_value = BSP_PSENSOR_ReadPressure(); + printf("PRESSURE is = %.2f mBar\n", sensor_value); + + led = 0; + + wait(1); + + led = 1; + + BSP_MAGNETO_GetXYZ(pDataXYZ); + printf("\nMAGNETO_X = %d\n", pDataXYZ[0]); + printf("MAGNETO_Y = %d\n", pDataXYZ[1]); + printf("MAGNETO_Z = %d\n", pDataXYZ[2]); + + BSP_GYRO_GetXYZ(pGyroDataXYZ); + printf("\nGYRO_X = %.2f\n", pGyroDataXYZ[0]); + printf("GYRO_Y = %.2f\n", pGyroDataXYZ[1]); + printf("GYRO_Z = %.2f\n", pGyroDataXYZ[2]); + + BSP_ACCELERO_AccGetXYZ(pDataXYZ); + printf("\nACCELERO_X = %d\n", pDataXYZ[0]); + printf("ACCELERO_Y = %d\n", pDataXYZ[1]); + printf("ACCELERO_Z = %d\n", pDataXYZ[2]); + + led = 0; + + wait(1); + + } +}