Starting with SQL server and ESP32 (general concepts)

MoustachedBird
Posts: 4
Joined: Sat Jun 13, 2020 8:04 am

Starting with SQL server and ESP32 (general concepts)

Postby MoustachedBird » Fri Jun 19, 2020 11:13 pm

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 :)

ESP_Sprite
Posts: 9739
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » 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.

MoustachedBird
Posts: 4
Joined: Sat Jun 13, 2020 8:04 am

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

Postby MoustachedBird » Sat Jun 20, 2020 8:10 pm

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

ESP_Sprite
Posts: 9739
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Sun Jun 21, 2020 11:25 am

I'd say it depends on the database, but to be honest I'm not that familiar with the interfaces they have.

Who is online

Users browsing this forum: No registered users and 104 guests