Hi. I have simple circuit for camera remote shutter. I wanted to separate Arduino from camera circuit so decided to go with ouptocoupler.
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.
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+
@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?
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.