logo elektroda
logo elektroda
X
logo elektroda

Configuration of ESP8266 as UDP server with RS232 - IP 10.10.2.1, port 22000, AT?

heyka 6045 78
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17824897
    heyka
    Level 17  
    Please advise me how to configure the ESP8266 module to work:
    - as a UDP server
    - to listen on IP address 10.10.2.1 and port 22000
    - to send everything that comes to it via RS232 to the processor and if the processor responds to something to send it back to the client via WiFi

    Added after 18 [minutes]:

    Is it possible to set all this up using AT commands?
  • ADVERTISEMENT
  • #2 17824939
    Anonymous
    Level 1  
  • #3 17826908
    heyka
    Level 17  
    Code: C / C++
    Log in, to see the code
    .

    does not accept my command to set up the server
  • #4 17826945
    Anonymous
    Level 1  
  • #5 17827032
    heyka
    Level 17  
    Code: C / C++
    Log in, to see the code
    .

    From the above information , it appears that the module is set as an AP, it sends received data to the serial port, it handles one connection at a time.
    How do I check if it is acting as a UDP server with IP 10.10.100.254 and has a listening port set to 32000?
  • #6 17827073
    Anonymous
    Level 1  
  • #7 17827076
    heyka
    Level 17  
    Code: C / C++
    Log in, to see the code
    .
    I have set the IP, still only the port , but I do not know with what command
  • #8 17827087
    Anonymous
    Level 1  
  • #9 17827186
    heyka
    Level 17  
    Code: C / C++
    Log in, to see the code
    .

    When I set according to the link, something is wrong

    Added after 27 [minutes]:

    Code: C / C++
    Log in, to see the code
    .
    I reset the module and set everything as above
    what does the Cipstatus number 12819 and that zero at the end mean?

    Can it be assumed that everything is set correctly?

    Added after 1 [minute]:

    Code: C / C++
    Log in, to see the code
    .
  • ADVERTISEMENT
  • #10 17827222
    kaczakat
    Level 34  
    In my opinion the method from the first link will be more effective, you upload the code exactly as you need it and the ESP is immediately in that mode after the reset. With AT commands you will have to be careful if you accidentally do a reset and set it up again.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #11 17827471
    heyka
    Level 17  
    kaczakat wrote:
    upload the code exactly as you need it
    .
    OK

    I need the module to work in AP mode as a UDP server listening on IP 10.10.100.254 on port 32000 and everything that arrives to it forwarded to RS232 with ASCII transmission.

    I have no experience with these modules and with Arduino.

    So do I need to write code in Arduino and program the module?
  • #12 17827888
    kaczakat
    Level 34  
    You don't need to know too much with Arduino, in the sticky in this section it is described what you need to do to install ESP8266 boards to Arduino. But it's still a lot of work ahead of you, I've been playing with Arduino for over 2 years and I still learn what I didn't know every day. If you have a NODE MCU/ WEMOS, a MICRO USB cable + Arduino is enough for programming. For the ESP-01 you need a 3.3V UART converter and a sequence of shorted pins to program, some 3.3V power supply, a tad harder to start with. In both cases you open a new sketch, paste the ready-made from the link from @khoam, modify the ready-made to send only the buffer to the serial (delete the extra lines) and you're almost done. ESP can be configured for a fixed IP and all network parameters, you need to add reading the response from Serial and writing back with either an incoming UDP or serial message (now the default is acknowledged) . For testing, you can use the TCP/UDP client SocketTeset v3.0.0 or something like that on a PC, there are also some for Android. It is also a question of how much of this data flies and how often. Whether AP or station this is specified when initialising WIFI in the sketch, for everything there are plenty of examples and in the Arduino IDE and on google. With Arduino you are most likely to even find something exactly like you need, there are many other hits for UDP - e.g. https://github.com/roboremo/ESP8266-WiFi-UART-Bridge/tree/master/v1.1 A week is not enough to review, copy, compile and test everything.
    Helpful post? Buy me a coffee.
  • #13 17827968
    heyka
    Level 17  
    I've got the Arduino installed, I've got the ESP8266 board installed, I've got the converter, I've got everything ( how little it takes to have everything :) )

    I need some code as simple as possible that will set up the module according to what I need to be able to analyze and understand it. This example pd mate khoma is heavily elaborated and I don't know how to go about it.
  • #14 17828289
    Anonymous
    Level 1  
  • #16 17828710
    Anonymous
    Level 1  
  • #18 17828720
    Anonymous
    Level 1  
  • #19 17828728
    heyka
    Level 17  
    address is posted , but I have a download error message as I have attached on screean
  • #20 17828737
    Anonymous
    Level 1  
  • #21 17828743
    heyka
    Level 17  
    At my place yesterday everything was OK, strange, Arduino doesn't like me. Something makes me think I'll stick with C and Eclipse
  • #22 17828769
    Anonymous
    Level 1  
  • #23 17828989
    kaczakat
    Level 34  
    heyka wrote:
    I fired up the Arduino today and the ESP 8266 board disappeared in the board manager.
    .
    But how did it disappear, did you manage to install it? If you can't connect to the Arduino IDE somewhere, it's not likely to be a problem of network blocking software. Confirm by trying to fire up the library/board manager. The program in the first link from @khoam works OK, upload, test, disable what you don't need, upload, test, add what you need from the UART side (I recommend the serialEvent example), upload, etc.
    Helpful post? Buy me a coffee.
  • #24 17829051
    heyka
    Level 17  
    I can't upload because I don't have a board available in Arduino in the board manager, yesterday I installed it was available,and today I turned on Arduino and it's not there and I can't install it.
  • #25 17829056
    kaczakat
    Level 34  
    Well, download again/uninstall/install, you didn't have the day before yesterday so it's a small loss too. It will go faster the second/next time. There are also ZIP versions, which do not require installation.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #26 17829113
    heyka
    Level 17  
    kaczakat wrote:
    .
    The program from the first link from @khoam works OK.


    Where to enter in the code
    - IP no. of the UDP server
    - port no. on which the server should receive


    I get an error when trying to compile

    Code: C / C++
    Log in, to see the code
    .
  • #27 17829132
    Anonymous
    Level 1  
  • Helpful post
    #28 17829149
    kaczakat
    Level 34  
    Well, it works OK, but there is something wrong with the fonts, I changed the inverted commas to Polish.
    See this version, my modifications towards your requirements:
    Code: C / C++
    Log in, to see the code
    .
    Helpful post? Buy me a coffee.
  • #29 17830044
    heyka
    Level 17  
    Code: C / C++
    Log in, to see the code
    .

    Is this the IP setting of the module or the UDP server?
  • #30 17830051
    Anonymous
    Level 1  

Topic summary

The discussion revolves around configuring the ESP8266 module to function as a UDP server with a specific IP address (10.10.2.1) and port (22000), while also facilitating RS232 communication. Users explore the feasibility of using AT commands for setup, troubleshooting connection issues, and the limitations of the AT firmware. Several users share their experiences with command sequences, firmware versions, and the necessity of using Arduino for more complex configurations. The conversation highlights the importance of setting the correct operating mode (AP or Station), managing IP addresses, and handling incoming and outgoing data through UDP. Additionally, users discuss programming the ESP8266 using Arduino IDE, including code snippets for establishing UDP communication and responding to UART data.
Summary generated by the language model.
ADVERTISEMENT