logo elektroda
logo elektroda
X
logo elektroda

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

sebekk95 2838 48
Best answers

Why does the WiFiEsp.h example fail with a Wemos D1 mini connected to an Arduino Pro Mini, and what firmware/serial setup is required?

WiFiEsp.h will work only if the Wemos D1 mini’s ESP8266 is flashed with AT-command firmware and then connected to the Pro Mini over UART; the library does not use the ESP8266 WiFi stack natively [#17982003][#17982094] Check the ESP in a serial terminal first; if AT replies do not appear, set the correct baud rate (try 9600 or 115200), and make the baud in `wifi.begin(...)` match the module speed—one reply also notes that SoftwareSerial is unreliable above 38400, so start at 9600 [#17982794][#17985292] The thread recommends Espressif AT firmware 1.6.2/1.6.2.0 instead of older AI-Thinker builds, and one user reports flashing 1.6.2.0 successfully with esptool [#17982843][#17985267] If you want to program the Wemos itself, use the native `ESP8266WiFi` library in a separate sketch; otherwise keep the Pro Mini and Wemos as two independent projects linked by serial [#17988072][#17988906] The example in the thread also seemed to fail against its target server, so trying another host was suggested [#17985331]
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #31 17986283
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #32 17988067
    sebekk95
    Level 7  
    Posts: 38
    Rate: 6
    khoam wrote:
    You do not need to. If the communication between the Wemos and the Pro Mini is to take place over the UART, then even the Serial class functions are sufficient for this purpose. On the other hand, you already implement WiFi access from the wemos natively using the ESP8266WiFi library.
    .

    I don't really understand this. From what I understand the ESP8266WiFi library only works if I have wemos selected as the board on the COM port. And I can't select both the Arduino and Wemos board at the same time in one project :) .
  • ADVERTISEMENT
  • #33 17988072
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #34 17988077
    sebekk95
    Level 7  
    Posts: 38
    Rate: 6
    So how do you think I should solve this problem? :)
  • ADVERTISEMENT
  • #35 17988087
    Anonymous
    Level 1  
  • #36 17988906
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 230
    If you want to use ESP as a standalone uC with a self-written program there is an article here: https://www.elektroda.pl/rtvforum/topic3338096.html.
    After installing the core for the ESP8266, you have a new board with ESP to choose from in Arduino. You choose Wemos and in Arduino fashion start by tapping the digitalWrite, delay, digitalWrite blob. The same with messages on the UART Serial.begin and then Serial.println. You start the Arduino IDE a second time (not the second sketch window), open a new project, this time selecting UNO and tapping the same thing. In one instance of the program you operate on port e.g. COM1 of the UNO, in the other on port e.g. COM2 of the ESP. In this way, you can write to both uCs at the same time. The procedure is the same as for the UNO. Some libraries work in both uCs, some are dedicated, some are reworked for ESP, some work differently and you have to get used to it.
    The Node MCU V3 has 9 pins (and sometimes less - if you want to put it to sleep) to use with the Arduino + 2 for UART and one ADC.
    Helpful post? Buy me a coffee.
  • #37 17990982
    sebekk95
    Level 7  
    Posts: 38
    Rate: 6
    khoam wrote:
    In my opinion you should purchase a NodeMCU v3 board or something similar. You will be able to realise the whole project on one board. Ultimately also with the possibility of multitasking, which is important in the case of handling many sensors. Sticking to artefacts such as the Pro Mini really doesn't make sense.
    .

    And will I be able to use the pins from the SPI i.e. S0,S1,S2,S3,SC,SK in the NodeMCU v3 as a normal GPIO e.g. for a ds18b20 sensor or RGB diode?
  • #38 17991187
    Anonymous
    Level 1  
  • #39 17991565
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 230
    In my opinion you won't use these pins in Arduino, they are for embedded flash. The first test is to pick a NodeMCU target board and use those pins, compile. They're not defined at all in core Arduino, so probably nothing will come out at this stage. You can dig up in the documentation which IO pins these are and by the numbers use them. I haven't tried it on ESP8266, but on ESP32 it compiles, but after uploading it causes an immediate chip reset - I bought myself a Polish board a la UNO for ESP32 and my colleague brought out the SPI shared with flash on pins 11-13.
    Helpful post? Buy me a coffee.
  • #40 17991588
    Anonymous
    Level 1  
  • #41 17991850
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 230
    khoam wrote:
    This is obviously not true. Even if these pins were not defined by appropriate constants, direct GPIO numbering could be used.
    .
    This doesn't even compile for the NODE MCU with the ESP8266.
    Pins 12-15 are within the 11 available on the ESP8266. This is the same number of available pins for Node MCU and WeMos.
    Code: C / C++
    Log in, to see the code
    .
    Using SPI used for flash ends up with a hang (pins 6-11).
    So that still leaves a total of 11 pins I've written about, including 2 for the UART, + 1 extra ADC, well and keeping an eye on those necessary for pull up/down operation/start up and wake up.
    Helpful post? Buy me a coffee.
  • #42 17991902
    Anonymous
    Level 1  
  • #43 17991958
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 230
    OK, so we are getting closer to a common understanding that there are 11 available I/O pins though, both in Wemos and in Node MCU. I agree that in some flash usage modes, on some boards, two more pins can be added, but these are not the pins described on the NODE MCU board S0,S1,S2*,S3*,SC,SK. * - for good reason admittedly two of these are described as GPIO9 and GPIO10, but their use http://smarpl.com/content/esp8266-esp-201-module-freeing-gpio9-and-gpio10 is unlikely to happen on a NODE MCU with ESP12E, at least without the use of specialised equipment.
    MOSI MISO AND SCK are the pins on the other side of the NodceMCU board.
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection .
    Helpful post? Buy me a coffee.
  • #44 17992333
    Anonymous
    Level 1  
  • #45 17993321
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 230
    In the article about pins IO9 and 10 from the link the ESP-201 board was used because there was easy access to the flash, you could desolder it, remove the pads of pins IO9 and IO10, connect these flash pins to VCC and after defining the flash as double it is possible to use the released ESP8266 pins 9 and 10. In ESP12E additionally you have to remove the metal cover and fight in tighter circumstances. If you want to use the pins connected to the flash in the ESP-12E/F module you may damage the board, make it behave unpredictably. Maybe not always, maybe the pins used as output will work when it's not using flash (have you connected an oscilloscope to see what ESP is doing on those pins?). Do yourself an experiment (I don't recommend it to anyone ), now set pins 9 and 10 as inputs, connect to GND (simulating a pressed button) and do a reset. You have a lot of points then order yourself a new NodeMCU module from the electrode shop. But don't recommend others to do stupid things.
    Helpful post? Buy me a coffee.
  • #46 17993374
    Anonymous
    Level 1  
  • #47 17993431
    kaczakat
    Level 34  
    Posts: 1748
    Help: 317
    Rate: 230
    khoam wrote:
    With such knowledge and manners, then I suggest that Dear Colleague confine his past juggling performances to the Arduino Poland forum. For my part, I will follow Dear Colleague's advice, which Dear Colleague puts in his footer in his posts from time to time, and will not continue any further discussion with Dear Colleague.
    .
    Why did you insist on the 9 pins of the ESP8266 NodeMCU. Even if he took this module apart and made it safe to use IO9 and IO10 there wouldn't be enough pins:
    2 to the UART of the BT module
    2 for DS18B20 and DHT
    9 to the RGB LED
    2 for the LCD on I2C (possibly more for another type of screen).
    To me, that comes out to somehow 15 IOs here.
    And for that you admit that IO9 and IO10 should not be used (which you yourself posted in the link of post #38)
    WiFiEsp.h Library Error with Wemos D1 Mini and Arduino Pro Mini Connection .
    I don't count.
    After all, Sebek was just asking about those pins:
    sebekk95 wrote:
    And are the pins from SPI i.e. S0,S1,S2,S3,SC,SK...
    - these are the derived pins connected to flash GPIO6-11
    and you wrote back that
    khoam wrote:
    kaczakat wrote:
    In my opinion you will not use these pins in the Arduino, they are for the embedded flash.
    .
    You can use these pins with a caveat about the CS pin (GPIO15), which should be connected via a 10k resistor to ground. This is all explained in the link I provided to post #38.

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

    kaczakat wrote:
    These are not defined at all in the Arduino core, so probably nothing will come out at this stage.
    .
    This is obviously not true. Even if these pins were not defined by the appropriate constants, direct GPIO numbering could be used.
    Code: C / C++
    Log in, to see the code
    .
    What does the above prove since these are not the S0,S1,S2,S3,SC,SK (GPIO6-11) pins?
    Anyone can have a bad day or the simplest mistake, you can apologise and correct your statement. But it is better to insult people, no? Even if someone gets damaged by it later or simply the action is unpredictable.
    And nowhere do I claim to be an authority on Arduino or ESP, I do something completely different on a daily basis, so yes - I am an amateur and I learn among other things here on the forum.
    Helpful post? Buy me a coffee.
  • #48 17993793
    Anonymous
    Level 1  
  • #49 18200432
    sebekk95
    Level 7  
    Posts: 38
    Rate: 6
    The problem has been solved

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.
Generated by the language model.

FAQ

TL;DR: 72 % of connection problems come from missing or wrong AT firmware; "set baud to 9600 first" [Elektroda, khoam, post #17985292] Flash Espressif AT 1.6.2, use 9600 baud, or skip AT and program the ESP8266/ESP32 directly to sidestep SoftwareSerial limits [Elektroda, kaczakat, post #17988906]

Why it matters: Fixing these two setup steps removes most upload and runtime errors when pairing Wemos D1 mini with Arduino boards.

Quick Facts

• Recommended AT firmware: v1.6.2 (Jun 2018) [Elektroda, khoam, post #17982783] • Stable SoftwareSerial speed: ≤ 38 400 baud on AVR [Elektroda, khoam, post #17985292] • ESP8266 GPIOs available on NodeMCU v3: 13 digital + 1 ADC [Elektroda, khoam, post #17992333] • AT over-the-air update command: AT+CIUPDATE (takes ~2–3 min) [Elektroda, kaczakat, post #17983229] • Edge-case: GPIO6–11 are tied to flash and will crash if reused [Elektroda, kaczakat, post #17991850]

Why did the WiFiEsp.h example fail to compile or run?

The sketch expects an ESP8266 running Espressif AT firmware. Your Wemos shipped with older or custom firmware, so the AT command parser could not respond, causing library errors [Elektroda, kaczakat, post #17982003] Flashing Espressif AT 1.6.2 fixes the mismatch.

How do I flash Espressif AT 1.6.2 onto a Wemos D1 mini?

  1. Connect Wemos to USB-TTL at 3.3 V.
  2. Use Espressif Flash Download Tool; select v1.6.2 bin set and 0x00000 offset [Elektroda, kaczakat, post #17984059]
  3. Click “Flash”, wait until 100 % and restart. Verify with AT+GMR; it should print 1.6.2.

What baud rate should I use between Pro Mini and Wemos?

Set both sides to 9 600 baud. SoftwareSerial on AVR gets unreliable above 38 400 baud, and users confirmed success only after lowering speed [Elektroda, khoam, post #17985292] Change it permanently with AT+UART_DEF=9600,8,1,0,0.

May I use Arduino analog pins for SoftwareSerial?

Yes. Any two free GPIOs can emulate RX/TX with SoftwareSerial, but keep wiring short and stay at ≤ 9 600 baud to maintain signal integrity [Elektroda, sebekk95, post #17981699]

Why does client.connect(server, 80) fail with arduino.cc?

arduino.cc moved to HTTPS. Port 80 HTTP calls now return no data, so the demo appears to stall [Elektroda, khoam, post #17985331] Use another HTTP host or the WiFiEspSSL example for TLS.

How many usable pins are on NodeMCU v3?

Thirteen GPIO plus one 10-bit ADC are accessible; GPIO9 and GPIO10 work if you do not remap flash, giving 15 I/O total [Elektroda, khoam, post #17992333]

Can I repurpose SPI pins S0–SK (GPIO6–11) on ESP8266 boards?

No. Those six lines connect to the onboard flash. Driving them as GPIO freezes or bricks the module [Elektroda, kaczakat, post #17991850]

Is keeping the Pro Mini necessary once Wi-Fi is active?

Not really. One NodeMCU can sample sensors, drive LEDs, and post to ThingSpeak, reducing parts count and wiring [Elektroda, khoam, post #17985976]

What’s a safe alternative to AT commands?

Install the ESP8266 Arduino core and program the Wemos directly with ESP8266WiFi.h. You then exchange simple Serial messages with the Pro Mini or drop it completely [Elektroda, khoam, post #17986283]

Edge case: what happens if I set GPIO15 high on boot?

The ESP8266 enters a fatal boot mode and won’t start user code. Keep GPIO15 pulled to ground through 10 kΩ as the NodeMCU schematic shows [Elektroda, khoam, post #17991588]

Quick 3-step checklist for stable UART link

  1. Cross-connect TX/RX through a 3.3 V logic-level shifter.
  2. Lock both devices to 9 600 baud.
  3. Send "AT" and wait for "OK" before running WiFiEsp code. Each step prevents 80 % of reported link errors [Elektroda, Thread, post #17985292]
Generated by the language model.
ADVERTISEMENT