Hello,
I'm currently working on a project where there are 10 machines equipped with 10 machine terminal boards which are to be connected to one concentrator board using Wi-Fi. I'm planning use 10 esp32 boards, one for each machine terminal board in station/client mode. In the concentrator board I will be using one esp32 in AP-Server mode.
The goal here is to send sensor data from all the 10 machine terminals to the concentrator simultaneously.
I would like to know what approach should I follow to send data from these clients to the server simultaneously. For now I'm planning to use TCP Socket based communication, i.e, all the clients will have a TCP connection with the server to send the data within a time frame. No return data is expected from the server.Is it possible to connect all the 10 client esp32 to the server esp32 ( concentrator) at a time? each machine terminal would be sending nearly 850 bytes of data.
Is UDP a better choice of protocol than TCP here, If so why?
If I'm using TCP, will the esp32 in the concentrator board ( server ) be able to handle all the client connection requests and process all these data simultaneously? or is it always better that the esp32 server in the concentrator board shall accept only one client request at a time and scan all the client machines in a round robin manner? I am very much new to socket/network programming.I wish if you all could share your ideas for the same.
Regards,
Rakesh Menon
Wi-Fi : Client server data transmission
-
- Posts: 5
- Joined: Tue Mar 27, 2018 6:57 am
- Location: India
- Contact:
-
- Posts: 5
- Joined: Tue Mar 27, 2018 6:57 am
- Location: India
- Contact:
Re: Wi-Fi : Client server data transmission
Hello,
I had a rethinking, Is it better way to configure the esp32 in the concentrator board as a client and all the machine terminals as servers? so that the concentrator if connected to Internet can request to any machine terminal data from cloud application. For that to be done, the client must act as a Wi-Fi AP and all the servers must be connected to this client. I'm missing some concepts here?
Regards,
Rakesh Menon
I had a rethinking, Is it better way to configure the esp32 in the concentrator board as a client and all the machine terminals as servers? so that the concentrator if connected to Internet can request to any machine terminal data from cloud application. For that to be done, the client must act as a Wi-Fi AP and all the servers must be connected to this client. I'm missing some concepts here?
Regards,
Rakesh Menon
Re: Wi-Fi : Client server data transmission
In the make menuconfig we specify the maximum number of sockets that an ESP32 can support. The default is 4 but this can be turned up to 16. Since 16 > 10 you are OK for your solution. If I were in your place, I'd probably connect all 10 clients to the 1 server using TCP and leave the connections live. The way sockets works is that if an incoming transmission isn't handled immediately, that is ok. The data will be buffered until a read is performed. UDP might be easier to design and would be more resilient to outages but suffers from the obvious issue that the sender wouldn't know if the receiver received it correctly. UDP is datagram (fire and forget) based while TCP will capture errors in failure to deliver. You need to look at the nature of your solution and ask "Do I need to assure delivery?".
You also want to look at latency between the detection of your sensor event and how quickly that needs to be delivered to the target destination. Is it as close to real time as possible or are 100's of milliseconds latency ok? If the later, you may get mileage by raising your communications protocol story to a higher level abstraction such as MQTT.
You also want to look at latency between the detection of your sensor event and how quickly that needs to be delivered to the target destination. Is it as close to real time as possible or are 100's of milliseconds latency ok? If the later, you may get mileage by raising your communications protocol story to a higher level abstraction such as MQTT.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 5
- Joined: Tue Mar 27, 2018 6:57 am
- Location: India
- Contact:
Re: Wi-Fi : Client server data transmission
Hello Kolban,
First of all, thank you for the valuable reply, It is really motivating.
I would like to convey some more details about my project. The 10 machine terminals that I mentioned earlier are just for the prototyping and concept realization. When it comes to a product, according to customer requirement there might be 50-60 machine terminal boards communicating with the concentrator board. MQTT is great, but for the 1st phase of the project, it is not being considered.
As per your advice, I find that making 50 plus TCP clients communicate i.e, to pump data to the TCP server simultaneously is not possible to achieve. I am planning to get data from all the 50 machine terminals within one minute.( approximately 1s for 1 machine terminal: payload - 900 bytes ). The esp32 boards in the machine terminal will receive sensor data packet via UART from the main Renesas micro-controller. Considering all these, I'm thinking forward to configure the 50 machine terminals as servers, so that the concentrator can be made as TCP client and request can be made to a particular machine terminal at a time. I want to know whether this will be a good design approach or not. Is it possible that we can configure the esp32 in the concentrator board as an AP and also as a TCP client, as the configuration of AP/STATION mode deals with the physical layer and configuration of TCP client/server is at Network layer? The esp32 boards of machine terminals will act as Wi-Fi Stations and also as TCP Servers.
When everything gets powered up, the 50 machine terminal boards containing the esp32 boards will be configured as Wi-Fi Stations and connects to the concentrator board ( with esp32 configured as an AP ). The machine terminal boards will also collect the data via UART in parallel and store it in memory ( SD card ). The concentrator board is configured as TCP client and it requests for data from each machine terminal one after another. The time estimated to connect to a machine terminal's esp32 server and get data from it is assumed to be under 1 second. ( we know that the payload is around 900Bytes ). Will there be any additional time delay after closing the TCP connection from one machine terminal and establishing the TCP connection with the next machine terminal?
Thanks and regards,
Rakesh Menon
First of all, thank you for the valuable reply, It is really motivating.
I would like to convey some more details about my project. The 10 machine terminals that I mentioned earlier are just for the prototyping and concept realization. When it comes to a product, according to customer requirement there might be 50-60 machine terminal boards communicating with the concentrator board. MQTT is great, but for the 1st phase of the project, it is not being considered.
As per your advice, I find that making 50 plus TCP clients communicate i.e, to pump data to the TCP server simultaneously is not possible to achieve. I am planning to get data from all the 50 machine terminals within one minute.( approximately 1s for 1 machine terminal: payload - 900 bytes ). The esp32 boards in the machine terminal will receive sensor data packet via UART from the main Renesas micro-controller. Considering all these, I'm thinking forward to configure the 50 machine terminals as servers, so that the concentrator can be made as TCP client and request can be made to a particular machine terminal at a time. I want to know whether this will be a good design approach or not. Is it possible that we can configure the esp32 in the concentrator board as an AP and also as a TCP client, as the configuration of AP/STATION mode deals with the physical layer and configuration of TCP client/server is at Network layer? The esp32 boards of machine terminals will act as Wi-Fi Stations and also as TCP Servers.
When everything gets powered up, the 50 machine terminal boards containing the esp32 boards will be configured as Wi-Fi Stations and connects to the concentrator board ( with esp32 configured as an AP ). The machine terminal boards will also collect the data via UART in parallel and store it in memory ( SD card ). The concentrator board is configured as TCP client and it requests for data from each machine terminal one after another. The time estimated to connect to a machine terminal's esp32 server and get data from it is assumed to be under 1 second. ( we know that the payload is around 900Bytes ). Will there be any additional time delay after closing the TCP connection from one machine terminal and establishing the TCP connection with the next machine terminal?
Thanks and regards,
Rakesh Menon
Re: Wi-Fi : Client server data transmission
Hi Rakesh
Can I ask you what your project is, it sounds like we need a similar solution except I need much more data sending and I dont need to collect that data within a period of time. This is what I have done so far https://github.com/BaartCM/FFT-Analyser ... artFFT.zip the pc requests data from the esp32 (or stm32duino) via usb and responds. Want to be able to put esp32 nodes in a plant room with a hub or as you call it concentrator which can send the data either to a pc or the cloud - one step at a time, pc first then I can look at the cloud.
If we’re trying to build a similar solution, can we help each other with suggestions etc?
Steve.
Can I ask you what your project is, it sounds like we need a similar solution except I need much more data sending and I dont need to collect that data within a period of time. This is what I have done so far https://github.com/BaartCM/FFT-Analyser ... artFFT.zip the pc requests data from the esp32 (or stm32duino) via usb and responds. Want to be able to put esp32 nodes in a plant room with a hub or as you call it concentrator which can send the data either to a pc or the cloud - one step at a time, pc first then I can look at the cloud.
If we’re trying to build a similar solution, can we help each other with suggestions etc?
Steve.
-
- Posts: 5
- Joined: Tue Mar 27, 2018 6:57 am
- Location: India
- Contact:
Re: Wi-Fi : Client server data transmission
Hello Steve,
I'm building a part of an industrial on-line monitoring system, where there are 50-60 machines in a shed which will be running 24/7. These machines are equipped with terminal boards which monitor various data related to the production and send it to a master computer. Running rs485 or Ethernet cables between machines will be very difficult - means wireless communication has to be established. I'm planning to add an esp32 to each machine so that it can collect data from that machine and send that to a concentrator(equipped with esp32), from which I pass that data to the master computer via rs485 cable. The data will be uploaded to the cloud from the computer. I'm planning to use Wi-Fi at both ends so that the PC can be eliminated in the future(second phase) and the concentrator itself can have Internet connectivity.
I'm using ESP_IDF as the software core and eclipse as the IDE on a Linux machine. I'm in the planning and prototyping stage so I've not started building the actual code. I've created many snippets and I need to integrate them and add many more lines of code to make it a reality. The client-server architecture is what I'm trying to figure out as I'm new to socket programming.
I'd be glad if I could discuss technical aspects, but I'm afraid that I'm not authorized to talk much about the application.
Thanks and regards,
Rakesh Menon
I'm building a part of an industrial on-line monitoring system, where there are 50-60 machines in a shed which will be running 24/7. These machines are equipped with terminal boards which monitor various data related to the production and send it to a master computer. Running rs485 or Ethernet cables between machines will be very difficult - means wireless communication has to be established. I'm planning to add an esp32 to each machine so that it can collect data from that machine and send that to a concentrator(equipped with esp32), from which I pass that data to the master computer via rs485 cable. The data will be uploaded to the cloud from the computer. I'm planning to use Wi-Fi at both ends so that the PC can be eliminated in the future(second phase) and the concentrator itself can have Internet connectivity.
I'm using ESP_IDF as the software core and eclipse as the IDE on a Linux machine. I'm in the planning and prototyping stage so I've not started building the actual code. I've created many snippets and I need to integrate them and add many more lines of code to make it a reality. The client-server architecture is what I'm trying to figure out as I'm new to socket programming.
I'd be glad if I could discuss technical aspects, but I'm afraid that I'm not authorized to talk much about the application.
Thanks and regards,
Rakesh Menon
Re: Wi-Fi : Client server data transmission
Hi all, this is my first ever post on any online forum, please excuse my mistakes.
Months ago, i tried to get something similar-reading sensor data serially into arduino, passing the data to an ESP8266-01(tcp/ip-server) and airing it, finally receiving the data in PC or laptop(client) by connecting to the softAP(ESP8266-01).
Here my client-PC would connect to the server(softAP) setup by esp8266 and receive data.
I could only make limited progress, and the stability of esp8266 is poor(thanks to kolban that he advises to use 10mF capacitor, which i have not listened to because i dont have a microsolder iron ). My copied coding could not help much. Thanks to the open sources communities.
Now i want to try the same scheme of things using wifi-integrated-MCU(esp32), there by avoiding separate MCU&wifi-modules. Hope im on the right direction. Any further guidance would be appreciable.
Btw....i am a metallurgist tinkering with MCUs to kill my time.
Months ago, i tried to get something similar-reading sensor data serially into arduino, passing the data to an ESP8266-01(tcp/ip-server) and airing it, finally receiving the data in PC or laptop(client) by connecting to the softAP(ESP8266-01).
Here my client-PC would connect to the server(softAP) setup by esp8266 and receive data.
I could only make limited progress, and the stability of esp8266 is poor(thanks to kolban that he advises to use 10mF capacitor, which i have not listened to because i dont have a microsolder iron ). My copied coding could not help much. Thanks to the open sources communities.
Now i want to try the same scheme of things using wifi-integrated-MCU(esp32), there by avoiding separate MCU&wifi-modules. Hope im on the right direction. Any further guidance would be appreciable.
Btw....i am a metallurgist tinkering with MCUs to kill my time.
Re: Wi-Fi : Client server data transmission
NORVI Controllers are a ideal solution for your requirement. They come with ESP32 soc inside.
It supports industrial voltages and its a fully enclosed ready to run solutions for industrial IOT solutions.
Product range includes devices with 0-10V 4-20mA analog inputs and 24V DC supply voltages.More over there are expansion modules for GSM/GPRS applications. NORVI IIOT ESP32 INDUSTRIAL CONTROLLER.
You can check the details at www.norvi.lk
It supports industrial voltages and its a fully enclosed ready to run solutions for industrial IOT solutions.
Product range includes devices with 0-10V 4-20mA analog inputs and 24V DC supply voltages.More over there are expansion modules for GSM/GPRS applications. NORVI IIOT ESP32 INDUSTRIAL CONTROLLER.
You can check the details at www.norvi.lk
Re: Wi-Fi : Client server data transmission
You can use MQTT to send data. I have tested 30 devices sending data. 1 minute interval. With QoS enabled.
Who is online
Users browsing this forum: No registered users and 304 guests