Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Sum~guy
#82057 I have bought recently some of those small relay boards that come with ESP8266-01S modules. The relay board has GPIO-0 used as the relay control (it goes to a transistor to control the relay). There is a youtube video that explains that using GPIO-0 is not good because transistor bias circuit can bring that line low and hence 8266 starts in program mode. The video shows how to fix these relay boards and make them work.

I have modified the board and connected the relay control to GPIO-2. I have also flashed the module with ESPEasy. The relay board is powered with 5V and has 3.3V regulator for 8266. When the board is powered up with 5V the relay seems to hum right away and the 8266 is not functional. If I power up but GPIO-2 is not connected to relay control then the 8266 powers up OK - I then connect GPIO-2 to the relay control line everything is still ok and I can turn the relay on and off. I have ESPEasy set the boot state of GPIO-2 to output low, but perhaps it is in an undetermined state first during power-up and hence it is causing relay to chatter and maybe VCC is noisy and 8266 crashes because of this?
User avatar
By QuickFix
#82059 If you're making sure that GPIO15 is pulled LOW and GPIO0 and GPIO2 are pulled HIGH with resistors (and keeping an eye on the internal resistance of other connected components), the ESP should always boot correctly.

Please remember that GPIO2 is the debug TX-port and will duplicate the data sent on the "Normal" TX port (GPIO1).
If you don't directly set GPIO2 in code to a specific mode (ie. output), this port will output serial data as well, letting the relay "Hum". :idea:

See this older page of a guy that shows how to get the most out of an ESP-01.

Please note that it's often wiser to chose other ESP boards, for instance a NodeMCU or a Wemos. :idea:
User avatar
By Sum~guy
#82064 >If you're making sure that GPIO15 is pulled LOW

GPIO-15 is not present on the 8-pin header block. Is it on one of the pins of the 32-pin 8266 (8266EX) chip? Are any other IO pins available (with careful soldering) on the 32-pin 8266 chip?

> See this older page of a guy that shows how to get the most out of an ESP-01.

There does not seem to be a way to control a relay from an ESP8266-01 module using either of the available IO pins (IO-0 or IO-2) when the relay is active-high and the relay does not power-up (turn on) immediately upon power applied to the module. It was stupid to use one of the 8 pins on the connector block for IO-2 when IO-2 is used as a debug TX pin and it's state can't be controlled immediately upon power-up. They should have used another IO pin so that the module could have maximum flexibility as a control device with at least a single dedicated IO pin with no conflicts like IO-2 has.

It looks like if I want to control this relay I will have to configure the transistor control circuit as active-low, so that I can use IO-0 because IO-0 must be high upon power-up and then set the boot state of IO-0 to output mode, high state and then control the relay (turn relay on) by commanding IO-0 to go low.

Another alternative is to solder a dedicated wire from another available IO pin on the 8266 directly to the relay board. Since the 8266 chip has 32 pins - I assume there are many more IO pins available than just IO-0 and IO-2?

EDIT: ok, I have found a complete pinout for the 8266 EX chip and it does have many i/o pins and the ADC pin available. I will re-wire one of my 8266-01 modules so that a different I/O pin is connected to the 8-pin header block in place of I/O-2. I/O 4 seems to be a good candidate.

http://henrysbench.capnfatz.com/henrys- ... nnections/
User avatar
By QuickFix
#82065
Sum~guy wrote:>If you're making sure that GPIO15 is pulled LOW

GPIO-15 is not present on the 8-pin header block.

I was talking about the ESP8266 in general; the ESP-01 has the necessary pull-up and -down resistors already installed on board.

The ESP-01 isn't a very good choice in a lot of situations, especially when a free GPIO has to be in a certain state at boot.

You could use GPIO3 (the RX line) to control your relay, but in that case it might be a good idea to create a separate "Programming"-adapter when you need to flash the board.
After flashing, you can insert the ESP into the PCB that holds your relay.

I think such a solution is much easier (and more stable) than to solder a dedicated wire to one of the un-connected (but available) GPIO's.

Or you could just get yourself a NodeMCU or Wemos (of which the last option has a lot of available and cheap shields, including a relay shield).