I am creating an Alexa controlled smart switch using a Wemos D1 Mini.
it is a hybrid of two projects i found online;
but i am building my own CT senor circuit based on emonpi and using the EmonLib;
info found here;
i have successfully created my own code using both of these projects.
and without the relay connected i get accurate readings from the CT sensor.
but with the relay connected i get a false readings from the CT senor.
i have tried adding a transistor to the digital output for the relay but i must be doing something wrong as it seems to send the Wemos nuts (i.e. will not boot up).
i found the info for this here;
from research i can see that adding a relay (or other loads) to the digital pins can affect analog results, but i just cant find a solution.
i have altered my code to take a sample over 1000ms on the analog reading, to give it time to settle, but again this does not seem to help.
i think my problem is electrical not code..
any advice on how to correctly connect the relay would be welcome.
currently it is powered from the 5v on the Wemos and connected to D4.
The prerequisite for asking for help with wiring and circuitry is to post the schematic. It would also be helpful, if possible, to post a few pictures of the setup as well.