How to add a ESP8266-12E module to a PCB while still making it odable

Hey all, I'm working on a custom flight computer as a newer project, and I'm not sure weather or not i just misunderstand how the thing works, or I'm missing something or what.

essentially, I want to use the ESP8266-12E module in order to communicate with the rocket while its on the pad, since this is a new design, I need to be able to add different software and make updates.

as I understand it, you have to use a special board or circuit in order to program the Wi-Fi chip, since it will be soldered to a custom PCB, can I wire it in a way to flash the chip and then also update it? I'm using it in tandem with a teensy 4.1 and a bunch of sensors. does anyone have a solution to this?

if you need more information I'm happy to provide it. (I already know it can work... because this chip is used in another computer design, but since this is a new design and I will regularly be updating the software, will it not work?) surely there must be a way.....

For uploading to an ESP8266 there are 2 options. Either use the UART icw GPIO 0 being pulled LOW at boot, or use OTA updates. Since OTA updates depend on there being a supporting sketch already on it, i will just explain UART uploads.

First of all there are strapping pins on an ESP12F and the pullup and pulldown resistors are not present at all.
So in any board design make sure you add a 10K Pulldown resistor to GPIO 15 and make sure that RST & CH_PD (EN) have 10K pullup resistors.
Also make sure that GPIO 0, 1(TX) & 2 are not pulled LOW at boot for normal operation. (free-floating is OK though, but any LED connected should be active LOW eg. VCC -> LED -> Resistor -> GPIO)
I have a 5 pin connector to an external USB to TTL converter on my custom PCB which expose Vcc, GND GPIO 0 and TX and RX. Since my USB to TTL converter is 5v logic i use a voltage divider on the RX pin using 1K resistors (bigger values cause issues at higher speed) eg. USBtoTTL -> 1K -> ESP -> 1K -> 1K -> GND
And i have a Reset button on the board.

Module ? are you using a nodeMCU ? because for that the story is a little different again

If it's just the barebones chip make sure that there is nothing on the PCB obstructing the antenna !

this is specifically what i was talking about. esp8266-12e

I'm not totally sure if I understand this right, (feel free to correct me, and thanks for the help)
but what i need to while I'm programming the module is to pull GPIO pin 0 low, which will tell the ESP to program and not to power up, and then in general, GPIO 15 needs a pull down resistor,

what pins are these? I'm looking at a pinout diagram and I don't see these pins at all?

what do you mean by free floating? I've never heard that term?

I don't plan to connect any LEDs to this module, only the teensy so that wont be an issue.

the last thing I really don't get about this, and most of it makes a lot of sense, but how could a make a circuit that bypasses certain resistors when i want to normally power on the board for use? also if I'm using the Arduino IDE to flash my teensy, would i need one set of code that will program the ESP as well as a second set of code for just use on the teensy? (like have the teensy program the ESP, then load another code set that will actually run my program and talk to the ESP?)

thanks again for the help.

on the left side of the diagram 1 from the top and 3rd from the top.

the condition of the strapping pins ( GPIO 0, 1 & 2) at the time of power up define the selected boot mode. if you want to flash a program, GPIO 0 needs to connected to GND at the moment you power up (or reset) the ESP after that it doesn't matter any more.

Yes.

it means not connected to GND or Vcc neither directly nor indirectly thru components.

You could use mosfets to switch the pins. It is of a later concern. Normally speaking you would temporarily switch it to 'upload mode' upload the sketch and then reset and run the ESP in the 'normal mode'

I am not sure what you are planning here, they will need specific code each. You want them to communicate, they are different processors, they will perform different tasks and they have different instruction sets.

It can be a really cumbersome programming 2 boards and getting them to work together. The general recommendation is to try and avoid that and see if there is a board that can perform all of the tasks.

Let's take this step by step, let's first make the connections on the ESP to program and run a sketch on it.
What do you intend to use as a USB to TTL programmer ?

Originally I was planning to use a breadboard with an Arduino uno, that said if that will be really cumbersome, I can always get a USB to TTL programmer.

I was watching some videos to figure out how the best way to program it would be, and I stumbled upon this video, its somewhat similar to what I plan to do anyway since I want to make a webpage that ill be able to access settings on anyway. video

I could be totally wrong, please tell me if I am. but if I did this right, wouldn't I be able to program an initial sketch onto the board, and then later use the WIFI connection to upload future code.

another option, something i just thought of. but if the only pin that changes what config the ESP boots in is GPOI0, then on my bord, could I not add two vias, that I can connect with a jumper wire when I'm flashing. this concept might be a lot safter since it would mean i have to manually bridge the connection instead of wondering if I messed up a variable in the code that would make the module useless? right.... (what I mean by messing up the code is related to how he programs his in the video.)

I have been using that for year, mind you not for ESP12F but for ESP-01. Neither is really breadboard friendly, but at least the ESP-01 has header pins on it already. It works fine but you should use a voltage divider on the ESP Rx line to reduce the 5v logic level of the UNO to 3.3v. (and use 1K resistors not bigger values or it might not work) My UNO provides enough current from the 3.3v pin to power the ESP, but that is an original. The clones might not and particularly during WiFi connection there is quite a big demand.

I recently bought this unit which is solderless for barebones ESP8266 and ESP32, though i did mod it a little and removed the automated reset system and added leds on GPIO2, but it is a good and portable solution.

Sorry i couldn't watch that till the end.

Yes this is absolutely correct. I do it all the time it's very practical and the upload is faster than over USB. The Basic OTA example will show you how to do this. Of course any sketch that you do load onto it will need to have that part of code incorporated into it. If i remember correctly you will also need to Install Python (or maybe that's just for the FS OTA upload) and when you are experimenting, remember that you need to give the ESP a hard reset after the upload to take it out of the 'upload mode' even if the sketch is already running and it already appears to be in 'normal mode' it won't be until a hard-reset is performed.
There is also the option of exporting a compiled binary from the IDE and doing an HTTP upload, which can also be practical (i mean i do use it but i also sell and give away units that i provide firmware updates for at times.)

Well yes. As stated before, also GPIO 1(Tx) & 2 have an influence, but your basic switch is GPIO 0 since that switches between the 2 usable modes. Easiest is to add 2 push buttons, 1 connected to RST (EN) to GND which you should pull up with a 10K resistor, and 1 connected to GPIO 0 and GND. Hold the GPIO 0 button down while you press and release Reset and Bob's your uncle, and it's in 'upload mode' and all you need to do is connect RX & TX & GND. I put custom header pin whole on my boards and have a pogo pin adapter or solder onto it. you need the 4 pins TX, RX, GPIO0 & GND and have Vcc exposed can be really practical.

It should always be on your board as a backup option. Yes you may accidentally program an infinite loop or create some other mishap that stops OTA upload availability.

Alright, I drew up this schematic to see if I understand it all properly.

On a side note, I will actually be using the teensy4.1 for this project, which is very similar to the Arduino but a little more powerful.

when I go to upload a sketch to the ESP, obviously it will be going through the teensy, but is there specific code I need to tell the teensy that i want it to upload the sketch to the esp. and not itself? is there any you tube videos that might explain that part well?

This is something i can not give you a definite answer on. I have never owned a teensy and don't know what the internal workings of it are. When using an UNO you simply either disable the main MCU (the 328p) or just let it not interfere (by uploading a sketch that does not use 'Serial' and not uses pins 0 & 1) and the USB to TTL will communicate with the ESP. Send a query to which the ESP will respond and not the UNO, since it's the wrong device.
I think the teensy has native USB just like the USB to TTL converter on the UNO (the Atmega 16u2) and in that case you probably can make it work with a Serial - passthrough sketch, where you setup 2 UARTs both at the ESP upload speed that you set in the IDE (default 115200 should work) I have done this using a Mega.

You will never accidentally upload a sketch compiled for the ESP onto a different board since the device signatures won't match and the wrong board just won't respond correctly to the query.

You will have to experiment. With the teensy being a 3.3v device you won't need a voltage divider on the ESP Rx line like you would on an UNO.

Not quite. Normally you have RST pulled Up through the 10K resistor and us a button to connect it to GND (just like GPIO 0)

You will find the information on the website quite useful.
Several schematics are shown.
https://arduino-esp8266.readthedocs.io/en/3.1.2/boards.html#id1

Thank you all so much for the help. Someone else has brough to my attention that it might be better to use an esp32 instead of both the teensy 4.1 and esp8266.

if I have any more questions, ill be sure to post them here because you all have been super helpful, and I actually understand how the ESP8266 works a lot better now.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.