Relay Stops Working When Temp Sensor Added

The relay node works fine until I add the dht2x node. As soon as it’s added my relay will no longer work.
Any help on why the relay stops, but the temp displays on the LCD?

Thanks
xod

I have seen this in the past when using PWM output pins because I2C and PWM both require timers & XOD might try to re-use the same timer for both. The fix for this is usually to try a different pin for PWM, but that is not going to help in this case.

I assume you are seeing the relay staying on when you run the code… Have you double-checked your wiring to make sure your LED (or whatever you have connected to D14) is really still connected to D14? It is possible you pulled a wire out when adding temp sensor & put it back in the wrong place…I can’t think of any issue with the code you have shown that would cause this issue.

I am 100% my wiring is good. When I delete the dht2x node the relay works (not changing the wiring). As soon as I add the dht2x node back in without even including it in the flow the relay will stop working.

The pin for the relay stays at what it is set at on boot. I tried another pin for the relay but it did not work. The hardware I am using is a wemos d1 mini. I guess I will try a nodemcu or esp32

As a test, can you add the following nodes to force the relay to activate 1 second after boot?
image
If this does work, my guess would be that the “act” node within the “relay” node is sending its pulse before the code has initialized. Since there are no updates to the “relay” node after boot, it never gets set. A fix for this might be to add a “defer” node after “boot” node in “act”, but that is something that should be done by XOD developers, not you locally.

If this still doesn’t work, I’m at a loss as to why it is not working if you have different port numbers for hygrometer & relay. Do you leave the LCD node when you delete the hygrometer node to get relay working?

I switched to a nodemcu and it works. Not sure why a wemos d1 mini wont work.

Does the code I posted above allow the wemos d1 mini to work?

I tried your code and it does not work. If I delete the dht2x from the flow it will work with your code.
test

Fascinating…I wonder if the wemos board has a bug… Glad you had another board to test with that works.

1 Like

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