I'm currently programming a Nodemcu ESP8266 board, fully compatible with Arduino IDE. The project drive a relay board with a GPIO pin set as output.

You can see the board pinout in the following image:

enter image description here I am forced to use GPIO15 (labeled D8 on this board). My code set the pin value to HIGH in setup() (a LOW value triggers the relay).

Unfortunately, at boot the pin goes LOW for say a millisecond. It is something related to bootloader, as the pin goes HIGH as soon setup() is executed.

The final result is that the relay is triggered for a very short time every time the board reboots.

I really would like to get rid of this short signal. Is there some simple circuit I can realize to ignore every signal shorter than a few millisec?

The pin goes from a LOW value (0v) to a HIGH value (3,3v). The relay board should trigger the relay for any signal > 1,5v.

If I use another pin the problem is not present. Thus I think the connection (quite simple actually) is correct and no problem with the software. Unfortunately I should use D8 in the final setup.

  • 1
    \$\begingroup\$ Please show a schematic how GPIO15 (labeled D8 on this board) is connected in your application. \$\endgroup\$
    – Huisman
    Oct 18 '19 at 7:17
  • \$\begingroup\$ The connection is very very simple: GPIO15 is connected to IN1 of the relay board, 3,3v pin to VIN and GND to GND. As reference, consider that my board is similar to this one: microbot.it/open2b/var/products/1/49/… except it works with 3,3v instead of 5v. \$\endgroup\$
    – Desmond
    Oct 18 '19 at 7:23
  • 1
    \$\begingroup\$ Try adding a pull up resistor to the pin. Likely, the pin is a high impedance input until the io pin can be configured for output. The external pull-up will often fix this for you. Could be something else, of course. But that pops to mind. \$\endgroup\$
    – jonk
    Oct 18 '19 at 7:28
  • \$\begingroup\$ You could also try setting the internal pull-up resistor. Otherwise Jonk is probably right. \$\endgroup\$
    – Joe Mac
    Oct 18 '19 at 8:17
  • \$\begingroup\$ @JoeMac I could, but still it will be done in setup() that happens after the boot up of the board. By the way, pullup could it be set for a pin used as output? \$\endgroup\$
    – Desmond
    Oct 18 '19 at 10:27

Use an invert circuit to create an active HIGH signal. Connect the GPIO to an npn transistor base. Connect the collector with a pull up to the relay board and the emitter to ground. When the pin is low (like at startup) the relay input is high (from the pullup). If you switch the GPIO HIGH, the npn becomes conductive and pulls the relay input low.


simulate this circuit – Schematic created using CircuitLab

  • 1
    \$\begingroup\$ Your schematic will result in a large current draw, possibly enough to Dana the output pin. \$\endgroup\$ Oct 18 '19 at 7:36
  • \$\begingroup\$ Your circuit basically invert the logic I should use on my pin: HIGH to open the relay, LOW to close. This way, the LOW on boot just trigger a "close" on the relay. Maybe should it be "easier" to swap "NO" and "NC" in the relay and invert the logic on D8 in the software, connecting the D8 pin directly to the relay board? Anyway thank you for your help! \$\endgroup\$
    – Desmond
    Oct 18 '19 at 7:40
  • \$\begingroup\$ @Caleb True! Sure you need a base resistor ;) \$\endgroup\$
    – jusaca
    Oct 18 '19 at 7:41
  • \$\begingroup\$ Mosfet switch is better though \$\endgroup\$
    – Mitu Raj
    Oct 18 '19 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.