I have a nodemcu acting as a thermostat home office. The wall heating element is controlled with a solid state relay on D2. If i have it connected, I cannot program the board from the arduino ide. I disconnect it, I can program it, and then plug it back in and it runs fine. However if i push the reset button the serial output is garbage and the device does not seem to be doing what it should be(does not seem to connect to wifi or publish mqtt messages). I even tried delaying when I set D2 to an output to see if there was just too much current draw when it first powers up (even though it was not being set to ON until later in the code)

What I did find that worked is rather then connecting the other side of the solid state relay to GND, I connected it to another IO pin (D5). Then to actually initialize the relay, I set D2 and D5 to outputs, set D5 LOW and then use toggling D2 HIGH and LOW to actually toggle the heating. This seems to work fine even through a reset.

Any thoughts why this would be happening?

  • is it D2 as dogitalWrite(D2) or io 2 as digitalWrite(2)? – Juraj Jan 5 '19 at 6:42
  • 4
    by the way: the "garbage output" is at 74880 baud most likely - I always use 74880 in my sketches so I can see both the boot message and my outputs without fiddling with the baud rate on the "serial monitor" – Jaromanda X Jan 5 '19 at 6:59
  • @Juraj Its digitalWrite(D2); – Chad G Jan 7 '19 at 16:58
  • @JaromandaX Thats very handy to know! Thanks for that. – Chad G Jan 7 '19 at 16:59
  • how did you wire the SSR (module?) to NodeMcu? – Juraj Jan 7 '19 at 17:12

Your Answer

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

Browse other questions tagged or ask your own question.