logo elektroda
logo elektroda
X
logo elektroda

[Solved] WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection

sebekk95 1884 48
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17981699
    sebekk95
    Level 7  
    Hi, I am trying to establish communication between the Wemos d1 mini and the Arduino Pro Mini via the WiFiesp.h library, to do this I downloaded an example use of the library and when trying to upload in the Arduino IDE an error is displayed. What is the problem? Can I use the analogue pins in SoftwareSerial? Should I connect the wemos directly to USB or maybe to the Arduino power supply?

    Program code:


    Code: C / C++
    Log in, to see the code
    .
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • Helpful post
    #2 17982003
    kaczakat
    Level 34  
    If you want to use the ESP8266 as a WIFI modem, you need to upload firmware that supports AT commands. There is one by default on the ESP01 model, not necessarily on others.
    Helpful post? Buy me a coffee.
  • Helpful post
    #3 17982094
    khoam
    Level 42  
    kaczakat wrote:
    This is by default available on ESP01, not necessarily on others.
    .
    AT firmware is available for the ESP8266 directly from the manufacturer Espressif:
    https://www.espressif.com/en/support/download/at?keys=&field_type_tid%5B%5D=14
    It does not matter in which module the ESP8266 is installed.

    Added after 2 [minutes]:

    sebekk95 wrote:
    I am trying to establish communication between the Wemos d1 mini and the Arduino Pro Mini
    .
    I suggest you load the AT firmware into the Wemos first, and then test the operation of the AT commands from the serial terminal. Only later connect the Wemos to the Pro Mini over the UART.
  • #4 17982781
    sebekk95
    Level 7  
    khoam wrote:
    kaczakat wrote:
    There is one for the ESP01 model, not necessarily for the others.
    .
    AT firmware is available for the ESP8266 directly from the manufacturer Espressif:
    https://www.espressif.com/en/support/download/at?keys=&field_type_tid%5B%5D=14
    It does not matter in which module the ESP8266 is installed.

    Added after 2 [minutes]:

    sebekk95 wrote:
    I am trying to establish communication between the Wemos d1 mini and the Arduino Pro Mini
    .
    I suggest you first load the AT firmware into the Wemos and then from the serial terminal test the operation of the AT commands. Only later connect the Wemos to the Pro Mini over the UART.


    This firmware from Espressif is problematic to flash because the AT commands do not show up after uploading. I have the 2016 version of the firmware 1.5.4 uploaded via the ESP8266 Flash Downloader. Can this version stay or does it need to be updated to the latest version?
  • #5 17982783
    khoam
    Level 42  
    sebekk95 wrote:
    I have firmware version 1.5.4 from 2016 uploaded via ESP8266 Flash Downloader. Can this version stay or does it need to be updated to the latest version?
    .
    I recently used version 1.6.2 on a Wemos D1 mini and had no problems.

    Added after 7 [minutes]:

    sebekk95 wrote:
    Firmware version 1.5.4 from 2016
    .
    As you can check for yourself, no such version number appears on the manufacturer's website.
  • #6 17982794
    kaczakat
    Level 34  
    sebekk95 wrote:
    no AT commands show up
    and they won't show up until you set the right baudrate in the terminal, start with 9600 or 115200.
    Helpful post? Buy me a coffee.
  • #7 17982802
    khoam
    Level 42  
    With AT firmware version 1.6.2 loaded, I connected from the serial terminal at 115200.
  • #8 17982840
    sebekk95
    Level 7  
    khoam wrote:
    With AT firmware version 1.6.2 loaded, I connected from the serial terminal at 115200.
    .

    I get something like this on the serial monitor (attachment). Is this OK and can I move on to communicating with the Arduino?
  • ADVERTISEMENT
  • #9 17982843
    khoam
    Level 42  
    This firmware version is from AI-Thinker, quite old and has bugs (not all AT commands work). However, I would suggest you to load version 1.6.2 from Espressif to avoid unnecessary problems.
  • #11 17983213
    sebekk95
    Level 7  
    kaczakat wrote:
    That is, AT commands work, if you can connect via AT commands to a WIFI network with the Internet then you can do the upgrade online.
    .
    How do you do this upgrade? I can't find anything on the internet.
  • #12 17983229
    kaczakat
    Level 34  
    I wrote about this quite recently here on the forum:
    
    AT+CWMODE=3
    AT+RST
    AT+CWJAP="ssid","haslo"
    AT+CIFSR
    AT+CIUPDATE
    Poczekać aż to przeleci:
    
    +CIPUPDATE:1
    +CIPUPDATE:2
    +CIPUPDATE:3
    +CIPUPDATE:3
    +CIPUPDATE:4
    
    OK
    
    I sprawdzić posiadaną wersję:
    AT+GMR
    AT version:1.6.2.0(Apr 13 2018 11:10:59)
    SDK version:2.2.1(6ab97e9)
    compile time:Jun  7 2018 19:34:27
    Bin version(Wroom 02):1.6.2
    OK
    

    https://www.elektroda.pl/rtvforum/topic3561901.html
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #13 17983255
    sebekk95
    Level 7  
    kaczakat wrote:
    I wrote about this quite recently here on the forum:
    
    AT+CWMODE=3
    AT+RST
    AT+CWJAP="ssid","haslo"
    AT+CIFSR
    AT+CIUPDATE
    Poczekać aż to przeleci:
    
    +CIPUPDATE:1
    +CIPUPDATE:2
    +CIPUPDATE:3
    +CIPUPDATE:3
    +CIPUPDATE:4
    
    OK
    
    I sprawdzić posiadaną wersję:
    AT+GMR
    AT version:1.6.2.0(Apr 13 2018 11:10:59)
    SDK version:2.2.1(6ab97e9)
    compile time:Jun  7 2018 19:34:27
    Bin version(Wroom 02):1.6.2
    OK
    
    .
    https://www.elektroda.pl/rtvforum/topic3561901.html


    It threw an error
  • ADVERTISEMENT
  • #14 17983258
    kaczakat
    Level 34  
    Read that thread, it doesn't always work, the server may be overloaded, maybe your modem is not connecting. Update online you can try a couple of times, of course once you're connected to the network all you need is the update part. Khoam seems to have thrown in there links to update manually too.
    Helpful post? Buy me a coffee.
  • #15 17983284
    khoam
    Level 42  
    Yes, as I wrote before: you have the version from AI-Thinker. This way (via WiFi) it will be unupgradable to the original software from Espressif.
  • #16 17984059
    kaczakat
    Level 34  
    If you managed to upload the custom version then you can upload the one from Espressif as well. Apparently the custom update doesn't actually work. I've uploaded it and even though it downloads something there, it's the same error.
    Nevertheless, in attachment #15 of that topic you have a flash uploader, very easy, all in one file and you upload at zero everything.
    I uploaded with these settings:
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection .
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection
    and then just press flash:
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection .
    Then you repeat the commands to update and you are done:
    AT+GMR
    AT version:1.6.2.0(Apr 13 2018 11:10:59)
    SDK version:2.2.1(6ab97e9)
    compile time:Jun  7 2018 19:34:26
    Bin version(Wroom 02):1.6.2
    OK
    
    .
    Or the same after downloading version 1.6.2 from Espressif
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection .
    Helpful post? Buy me a coffee.
  • #17 17985267
    sebekk95
    Level 7  
    Hey guys, I've already managed to deal with uploading firmware version 1.6.2.0 via esptool, however the sample script I uploaded at the very beginning of the thread still doesn't work. The wemos itself, when connected to usb, reads AT commands, but when connected to Arduino and switched to Arduino port, AT commands don't work (tx and rx are cross-connected via logic level converter). Any suggestions?
  • #18 17985292
    khoam
    Level 42  
    sebekk95 wrote:
    Any suggestions?
    .
    Change the default speed in the ESP from 115200 to 9600 and the same in the program in wifi.begin(). Of course you have to use the serial teminal for this and connect over the UART to the wemos.
    Code: Dos
    Log in, to see the code
    .
    After a wemos reboot it will only be able to connect to them at 9600 and therefore wifi.begin(9600) is necessary.
    SoftwareSerial is unlikely to work properly above 38400, so start at 9600.
  • #19 17985316
    sebekk95
    Level 7  
    khoam wrote:
    sebekk95 wrote:
    Any suggestions?
    .
    Change the default speed in the ESP from 115200 to 9600 and the same in the program in wifi.begin(). Of course you have to use the serial teminal for this and connect over the UART to the wemos.
    Code: Dos
    Log in, to see the code
    .
    After a wemos reboot it will only be able to connect to them at 9600 and therefore wifi.begin(9600) is necessary.
    SoftwareSerial is unlikely to work properly above 38400, so start at 9600.


    I did as you instructed and now I have something like this on the serial monitor (attachment). I don't think this is correct no?
  • #20 17985331
    khoam
    Level 42  
    sebekk95 wrote:
    This is probably not correct no?
    .
    Looks pretty OK. It has connected to the local WiFi network (PlayInternet), and further down the line it can't connect to the arduino.cc server, but that's a problem a bit further down the line too - I don't know if it's possible to connect to that server on port 80 at the moment. This example is from 4 years ago. Try maybe with a connection to another server e.g. from this example:
    https://github.com/bportaluri/WiFiEsp/blob/master/examples/WebClientSSL/WebClientSSL.ino
  • #21 17985424
    sebekk95
    Level 7  
    khoam wrote:
    It looks pretty OK. It has connected to the local WiFi network (PlayInternet), and further down the line it can't connect to the arduino.cc server, but that's a problem a bit further down the line too - I don't know if it's possible to connect to that server on port 80 at the moment. This example is from 4 years ago. Try maybe with a connection to another server e.g. from this example:
    .
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection Such a thing is already good?
  • #22 17985464
    khoam
    Level 42  
    sebekk95 wrote:
    something is already right?
    .
    It's OK. Don't expect too much from this kind of project - fey won't handle it ;) .
  • #23 17985523
    sebekk95
    Level 7  
    khoam wrote:
    It's OK. Don't expect too much from this kind of project - fey won't handle it
    .
    I just want to collect data from sensors like ds18b20, dht 22, etc. and send it to some Thingspeak, when I have the code ready I'll send :) It works a bit strangely with this module: once it connects to the page and once it throws an error.
  • #24 17985730
    khoam
    Level 42  
    sebekk95 wrote:
    I just want to collect data from sensors like ds18b20, dht 22, etc. and send it to some Thingspeak
    .
    Are you sure you need an extra Pro Mini for this? :)
  • #25 17985955
    sebekk95
    Level 7  
    I think so because there are 3 RGB LEDs to the sensors which means 9 digital outputs occupied (temperature and liquid level indication) + buzzer + display + Bluetooth module HM-11 :D .
  • #26 17985976
    khoam
    Level 42  
    That is, if instead of the wemos d1 mini and Pro Mini you used one NodemMCU it would be enough and you would have a decent WiFi :) .
  • #27 17985992
    kaczakat
    Level 34  
    However, you can put all the action of communicating with the world into the ESP, it has more RAM, MHz and flash. Every now and then you only need to send it sensor data via UART. Or use ESP32, ESP8266 with Node MCU or Wemos with have rather only IO alone, I counted 11 including UART.
    Helpful post? Buy me a coffee.
  • #28 17985996
    sebekk95
    Level 7  
    Actually, yes only that it was my promoter's idea to use the Pro Mini and ESP8266 :D
  • #29 17986038
    kaczakat
    Level 34  
    In the version that you put the WIFI communication into the ESP it is still the same set up. The only thing is that Promini takes care of the sensors and leds locally, the LCD, every now and then it sends a message to the UART, and the very control of the connection status, logging to the server and posting the measurement results there is handled independently by ESP. Now, you have to grasp the AT commands and responses in Promini to know what is happening with the connection. Unless you specifically have to use AT commands, this may be the case because there are currently fewer and fewer examples of this, since the core ESP8266 for Arduino came out rarely anyone uses it - more of your own self-work.
    Helpful post? Buy me a coffee.
  • #30 17986252
    sebekk95
    Level 7  
    kaczakat wrote:
    In the version that you put the WIFI communication into the ESP it is still the same set up. The only thing is that Promini takes care of the sensors and leds locally, the LCD sends a message to the UART from time to time, and the control of the connection status itself, logging to the server and posting the measurement results there is handled independently by ESP. Now, you have to grasp the AT commands and responses in Promini to know what is happening with the connection. Unless you specifically have to use AT commands, this may be the case because there are currently fewer and fewer examples of this, since the core ESP8266 for Arduino came out rarely anyone uses it - more of your own work yourself.


    So it is not possible to do it with this WiFiEsp.h library only I have to use AT commands?

Topic summary

The discussion revolves around establishing communication between a Wemos D1 Mini and an Arduino Pro Mini using the WiFiEsp.h library. The user encountered errors while uploading code in the Arduino IDE and sought advice on using SoftwareSerial with analog pins, as well as power connection options. Responses highlighted the necessity of uploading AT command firmware to the ESP8266, with suggestions to use version 1.6.2 from Espressif for better compatibility. Users discussed the importance of setting the correct baud rate for communication and provided troubleshooting steps for connecting the Wemos to the Arduino. The conversation also touched on the feasibility of using a NodeMCU as a more integrated solution, given its additional capabilities and ease of use compared to the Pro Mini and ESP8266 combination.
Summary generated by the language model.
ADVERTISEMENT