Hi, I'm pretty new to Arduino but wanted to use my esp8266 to send sensor data gathered by my arduino uno. So when i bought my esp it worked with AT commands and i could upload a program to my arduino uno that used the esp to connect to my home wifi.
But when i decided to upload a program to the esp8266 - 01S, basically nothing worked anymore, After this i didn't manage to upload any new code to it or use any AT-commands. The esp is still working to some extent as it blinks when i try to do things with it.
So, as i've understood this is that when i upload my program to my esp, it overwrites the "factory software" that was on it before. This is the software that used AT-commands. I've heard that i should flash the esp with factory software, but this has not worked for me. The flashing tool didnt find my esp (Mac-adress and so on)
I decided now that i would like to reset from the beginning but this hasn't gone so well. I would really appreciate some help with making my esp working with AT-commands again and then i can start over.
Thanks in advance!
Get yourself one of these so you can re-program the ESP8266 with ease
ESP8266 programmer
Also, make sure you use the correct version and memory map when uploading the AT firmware. This one works for me for the ESP-01S
Thank you! I have tried software similar to this but with no sucess. How do i find out the stats of my esp8266 such as the flash size?
This is where i bought the esp from: Wifi-modul för Arduino ESP8266 - Moduler | Kjell.com
Also, I bought this one from aliexpress to help with programming the esp but that will take 30-50 days to arrive so in the meantime i would like to make it work without such a programmer. I'm not sure how i should make the circuit or what software to flash onto it. I've tried to follow some guides but with no sucess
You can connect a 3.3V FTDI (important that it is 3.3V and not 5V or you will destroy your ESP01) USB-to-Serial manually and follow the procedures here
But shouldnt it be possible to flash the esp and upload sketches to it using my computer via the arduino uno? That is what i have read. I have read that I can use my arduino as a gateway to the esp to upload code to it. If possible i would like to avoid buying extra "boards" to program my esp
It's possible, but you have to make sure that you are not connecting the ESP directly as your UNO is 5V and the ESP can only tolerate 3.3V. Do you have the hardware to level shift the 5V Arduino outputs to 3.3V?
Yes, I have an external power supply which i could use to supply the esp8266 with 3.3V.
I'm not talking about the power supply. I'm talking about the 5V serial TX output of the Arduino UNO to the 3.3V serial RX of the ESP01
You also need GPIOs to drive the 3.3V RST,3.3V CHPD, and 3.3V IO0 inputs of the ESP to go into flash programming mode. You have to have a level shifters too for these pins
Okay i see, i dont have any voltage regulator but i could buy that if its needed. Using the 3.3V pin of the arduino uno is not an option right? As it cant supply enough current to the esp.
Is this correct then:
So, the arduino TX pin outputs 5V but the esp RX wants 3.3V, so i have to lower the voltage between those two connections with a voltage divider?
The CHPD pin and VCC pin of the esp wants 3.3V which i could get from the arduino uno 5V pin with a voltage divider too?
And to flash the esp i also need to send 3.3V to IO0 pin in the same way as VCC and CHPD?
Connections
ESP 3.3V -- a good 3.3V power supply (the ESP can use upto 300 mA)
ESP CH_PD -- voltage divider (hold to HIGH)
ESP IO0 -- GND (for programming mode)
ESP RST -- GND (initially)
ESP RX -- TX pin of Arduino (voltage divider)
*** never connect any 5V output to any of the ESP pins ***
You can then use an Arduino sketch to program the ESP. When you start programming, disconnect the RST from ESP to create a rising edge, which will START it in programming mode
So i shouldnt use the 5V pin of the arduino to connect to neither of the esps pins even though its through a voltage divider? and what do you mean by "(hold to high)"?
You can use the 5V (with a voltage divider) to hold the IO pins to high (meaning digital HIGH). But you can't use the 5V(with a voltage divider) to supply power to the ESP 3.3V power input.
Oh ok, why cant i use it for the power input of the esp? insufficient current supply from arduino?
Also, would this voltage regulator work? or is the current too low?
https://www.digikey.com/en/products/detail/stmicroelectronics/L78L33ACZ-AP/5764810
Okay, I will buy a regulator which can supply at least 500mA. And i should use that one to power my esp8266-01S from an external power supply?
external DC power (5V and above) --> 3.3V regulator --> ESP 3.3V power input
Thank you, By the way, if i buy a esp8266 programmer such as the one you suggested earlier. https://www.aliexpress.com/item/1005001775453469.html?spm=a2g0s.9042311.0.0.27424c4dibMOXw
Can i just plug that into my computer via USB and power the esp8266 and upload a arduino sketch to it just by having it powered?
Yes. It will show up as a COM port in your device manager, and you can do all the Arduino stuff with it. No need to mess with level shifters, jumping pins, etc. I use it all the time to update the firmware on my old ESP8266 modules
That sounds much more simple than what im trying to do. I think im just going to go with that instead.
Another question, After programming the esp, to send sensordata from arduino uno to the esp, do i do that with the SoftwareSerial librarry preferably? through digital pins on arduino to the RX-pin on esp?
I'm not a fan of software emulated peripherals i.e. SoftwareSerial. If I need more than two serial ports, I select a CPU with more than two hardware serial ports. There's just too many caveats with SoftwareSerial and it's not reliable at higher baud.
You could connect the ESP to the hardware serial (D0 and D1), and use SoftwareSerial for debugging. Though you'll lose the ability to use the Arduino Serial monitor for debugging.