NodeMCU v3 freez on start with optocoupler

Hi. I have simple circuit for camera remote shutter. I wanted to separate Arduino from camera circuit so decided to go with ouptocoupler.

Issue

  • NodeMCU hangs right after attaching power source
  • works when start withoud D2 connected and then connect it after second

Whole circuit works except that I can't just power it up with D2 connected. Also I can't programm board if optocoupler is connected. Camera shutter works fine with this circuit. Problem seams to be only on start. D2 is configured as output.

I'm prividing simple circuit to explain it.
NodeMCU

Are you sure it's on D2 ? not on D3 ? Anyway, you will probably resolve the issue by making the opto-coupler 'Active-LOW' that means connecting the cathode to the data pin and connecting the anode via the resistor to 3.3v+

1 Like

GPIO 2 must be pulled up to HIGH at system start. D2 does not appear to have any special requirements.

@Deva_Rishi I actually had D2 and D3 connected since need 2 ports. Checked it and if any of those 2 was connected it was blocking startup of ModeMCU.

So you mean to set D2 as high output by default and setting it to low will give enough potential difference. Any ideaa why this D2 and D3 works like that? Also do you know if it will behave in similar way on Attiny13?

NodeMCU

In this configuration it works fine. Thanks

does it means that I did something wrong? In setup part of code I'm setting

  pinMode(SHUTTER_PIN, OUTPUT);
  digitalWrite(SHUTTER_PIN, LOW);

Do you mean that D2 can't be set to low on start? Seams that D3 can't be also then since any of those ports connected to this circut will block board setup.

See this for which pins have special requirements at start time: A Beginner's Guide to the ESP8266
(It is D3, D4 and D8 that is GPIO 0, GPIO 2 and GPIO 15 respectively). Be careful of the different pin numbering systems across boards.
D2 has no such special requirements.

1 Like

And GPIO 1 also should not be pulled LOW at startup

Great !

Have you a link for this? I have not yet seen requirements for GPIO 1 so explicitly documented for ESP8266 devices.

Yep here On an ESP-01 that leaves GPIO3 (RX) that can be HIGH at boot.

There is also this boot behavior to keep in mind.

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