So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By QuickFix
#83599 Koop alsjeblieft eerst een ontwikkelbord voordat je aan de slag gaat met losse modules en adapters en gebruik modules pas als je een beetje thuis bent in het gebruik van de ESP8266. :idea:
Ontwikkelborden als de NodeMCU en de Wemos kosten maar €2 á €3 per stuk, dus het loont niet echt de moeite om een losse module te nemen tijdens ontwikkeling.
Dit is geen aanval naar jou toe overigens, maar overal op internet wordt de ESP-01 aangeprezen voor beginners, terwijl losse modules het meest onhandig zijn om mee te beginnen, zeker omdat er al langere tijd zeer betaalbare ontwikkelborden zijn om kennis te kunnen maken met dit platform.

Please get yourself a development board first before playing with separate modules and adapters and only start using modules once you get accustomed to the ESP8266. :idea:
Development boards like the NodeMCU and the Wemos are only between €2 and €3 each, so it doesn't really pay to use separate modules in a development process.
User avatar
By Bram van Oosterhout
#83630 @QuickFix: Thanks for the response. I agree that a development board is much simpler than the loose modules. Let me ask a follow up question first and then give my rationale.

Question: Do you know other commercial boards that I can use to program an ESP01 (or 8266, although I don't need that many IO pins)?

Rationale:
I came to my decision after some extensive experiments with an Arduino (using a development board ;) ). I have a system running on an arduino, which passes the telemetry serially to a Unix box. The Unix box then sends it wireless to a server using mqtt.

I originally planned to replicate this system across the block with 10 sensors, running wires from the Arduino to the Unix box. Then I found the ESP01, which could implement the telemetry without wires.

The attraction is the simplicity. I can use 1 development board and just flash the esp01 modules, plug them into the telemetry board and all is set. The only commercial board that i could find that separated the controller board from the programming board is the one I am using. I have found several DIY boards on the internet, but purchasing the individual components seemed higher risk and more expensive. So I took the option that led me into trouble.

From the answers I believe I have a faulty programming board. So I will purchase another one. I don't need 10 development boards. It's overkill and adds power requirements in operation which will reduce battery life.

So: Do you know other commercial boards that I can use to program an ESP01 (or 8266, although I don't need that many IO pins)?
User avatar
By schufti
#83631 you didn't write which version of arduino esp8266 core you are using and the settings applied.
If it is latest "stable" version and windows, I would try going back to some 2.4 version with the non python flasher using the standard "Generic ESP8266 Module" with it's "ck" reset method.
Then show the result of the flashing atempt in the log window with "Show verbose output during ... upload" ticked,
The changed behaviour of the python flasher still gives a lot of trouble...
User avatar
By Bram van Oosterhout
#84075 Hi All,
Thanks all for the advice. I have made some progress and can now answer my own questions.

Re 1. The voltages I measure on the pins of the USB To ESP8266 Serial Adapter are real and correct. The threatening 5V reading on GPIO3/TX does not do any damage to the chip. At least not in the short run. Today I managed to upload a sketch (Blink) successfully to the ESP8266. And it works! No damage done.

Re 2. How to load a sketch?
The real question should have been: "Why do I get the message 'esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header'?" I did the right thing (wiring and IDE) to load a sketch, but physics got in the way. I was running the USB To ESP8266 Serial Adapter from a USB2 connector on my laptop. As far as I can see USB2 does not specify the minimum current available from the power line. But my laptop specification limits this current to 200mA.

This article (https://www.ondrovo.com/a/20170207-esp-consumption/) makes it clear that 200mA is not enough for reliable operation. If you have an oscilloscope, you can directly observe the voltage drop on the 3.3V (Vcc) pin. And that's what caused the problem. The under powered startup, the ESP8266 ends up in a weird state (more on that below) and uploads fail with "esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header".

The solution for me is to
a. Use the USB To ESP8266 Serial Adapter as supplied.
b. Instead of connecting the ESP8266 board 3.3V (Vcc) pin to the 3.3V out on the USB To ESP8266 Serial Adapter you connect the ESP8266 board 3.3V (Vcc) pin to a separate power supply providing 3.3V with a current rating > 500mA. I use a 1 Amp/5V power supply with a 3.3V regulator.

When you upload a sketch in this configuration, the oscilloscope shows no voltage drops on the 3.3V (Vcc) ESP8266 pin during upload and the upload completes successfully!

And I suspect that, if my USB port had provided enough current in the first place, the USB To ESP8266 Serial Adapter would have worked satisfactory first time. But I cannot test that.

Some other observations
Whilst investigating the issues described above I learned a fair bit about the ESP8266.

1. It is completely usable with the USB To ESP8266 Serial Adapter as supplied and the Arduino IDE. There are some quirks though:
1.a When you reset the ESP8266 by putting RST to ground for a short time, the ESP8266 will sent a message of successful reset "ets Jan 8 2013,rst cause:2, boot mode:(3,3)" which you can see in the Serial monitor of the Arduino IDE. Provided you have set the baud rate to 74880!!
Ref: http://cholla.mmto.org/esp8266/weird_baud/. Of course this had already been reported on this forum (https://www.esp8266.com/viewtopic.php?f=160&t=12635), but I did not know to look for it :-(

1.b Once you can read the reset message, you can get info from the reported boot mode (3,3) is fine for upload. But in my case i found that my ESP8266 booted up with boot mode (3.7) or (3.6). The documentation I found (https://www.esp8266.com/viewtopic.php?f=6&t=8386 - Barnabynear last message) made it clear that my ESP8266 was in a "weird" state.

1.c To get out of the "weird" state I needed to completely disconnect all power, let all capacitors drain (60 seconds) and start again with a fresh instance of the Arduino IDE. No other sequence of events gave a reliable boot result.

1.d Once the ESP8266 reports a successful boot in the right mode, you are able to run AT commands successfully from the Serial terminal in the Arduini IDE at 115200 baud!! (not 74880!!)

2. To upload sketches your power supply to the ESP8266 must be able to supply sufficient current, as described above. The wiring is quite simple.

2.a Connect the ESP8266 to the USB to ESP8266 Serial Adapter, minus the 3.3V (Vcc, pin 4)
2.b connect GPIO0 (FLASH, pin 6) to ground
2.c connect ESP8266 3.3V (Vcc, pin 4) to the high current 3.3V power supply
2.d Connect the USB To ESP8266 Serial Adapter to the USB port on your laptop
2.e Start the Arduino IDE on your laptop
2.f reset the ESP8266 by pulling RST (pin 3) momentarily to ground
2.g the Serial Monitor (74880 baud) will show boot mode (3,3)
2.h switch serial monitor to 115200 baud
2.i upload your sketch
2.j finishes with: "Hard resetting via RTS pin...". But that does not happen A manual reset with RST to ground is required.
2.k DONE!

3. Boot modes, rst causes and exceptions - references.
Once you know to ask the right question, there are plenty references on the web. Here is a start.
https://riktronics.wordpress.com/2017/10/02/esp8266-error-messages-and-exceptions-explained/
https://zoetrope.io/tech-blog/esp8266-bootloader-modes-and-gpio-state-startup/
https://robertoostenveld.nl/esp-12-bootloader-modes/
https://arduino-esp8266.readthedocs.io/en/latest/boards.html