Page 1 of 1

Starting with SQL server and ESP32 (general concepts)

Posted: Fri Jun 19, 2020 11:13 pm
by MoustachedBird
Hello (sorry if my doubts are kind of basic but i'm just starting).

I want to start a new project related to sending data from a sensor to an SQL-Server. I've been looking for information trying to understand how it works and I see that some users make HTTP REQUESTS (most of cases POST request) to their servers, then this request is processed with PHP and finally stored in an MySQL database. If I could do a diagram I would do something like this:

Code: Select all

[SENSOR] --> [MICRO-CONTROLLER] ---> [HTTP REQUEST] ----> [SERVER] ----> [PHP] ----> [DATABASE]
But is there a way to link the micro-controller with my database without using an HTTP request and PHP? Something like this for having a faster communication between my micro-controller (ESP32) and my database.

Code: Select all

[SENSOR] --> [MICRO-CONTROLLER] ---> [UNKNOWN REQUEST] ----> [DATABASE SERVER]
I ask this because for example if my sensor sample rate is about 400 HZ, I need to make an HTTP request every 1/400 seconds and it sounds kind of inefficient. I guess a solution is making a 400 size buffer and sending it, for example, every second, but I'm not sure if it is the best solution. Is this possible with the ESP32 or I need to change to something more powerful like a RaspberryPi?

Thank you for your time :)

Re: Starting with SQL server and ESP32 (general concepts)

Posted: Sat Jun 20, 2020 11:11 am
by ESP_Sprite
Sending a request, be it a SQL or a HTTP[-S] one, 400 times per second is pretty inefficient in the first place. Suggest indeed saving up e.g. 1 second of samples and sending it like that. If you do that, it doesn't quite matter if you drop it directly into a SQL database or if it needs to go through php first.

Re: Starting with SQL server and ESP32 (general concepts)

Posted: Sat Jun 20, 2020 8:10 pm
by MoustachedBird
ESP_Sprite wrote:
Sat Jun 20, 2020 11:11 am
Sending a request, be it a SQL or a HTTP[-S] one, 400 times per second is pretty inefficient in the first place. Suggest indeed saving up e.g. 1 second of samples and sending it like that. If you do that, it doesn't quite matter if you drop it directly into a SQL database or if it needs to go through php first.
Thank you for your response :)

It sounds interesting, It is possible just dropping the information into my SQL database without PHP using the ESP32? What should I know for doing something like that? Does it exist a project like that I can use as an example?

Regards

Re: Starting with SQL server and ESP32 (general concepts)

Posted: Sun Jun 21, 2020 11:25 am
by ESP_Sprite
I'd say it depends on the database, but to be honest I'm not that familiar with the interfaces they have.