I have a fog machine that I have used before with the same exact setup but this year I can't seem to make it work. Its been about a year so not sure if I'm going crazy or missing something.
I wired into the push button and use a NodeMCU to trigger the some every so often. The problem is its completing the circuit the second I wire it to the MCU. I have it hooked to Pin5 and Ground but I tried other pins and they are all working the same whether the MCU is powered or not. They all complete the circuit and act like the button is pushed. I have also received a shock so for some reason power is being back feed to the MCU.
Again this has worked in the past and nothing has changed so I don't understand what I am doing wrong.
void setup() {
// put your setup code here, to run once:
pinMode(5,OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(5,LOW);
digitalWrite(LED_BUILTIN, LOW);
delay(5000);
digitalWrite(5,HIGH);
digitalWrite(LED_BUILTIN, HIGH);
delay(30000);
}
What is wrong is you are not measuring the various voltages, AC and DC, that are involved with the system. How could you possible get shocked from 5 VDC? Or is there more to your project? A schematic or a block diagram showing all the connections to the various boxes, please!
A continuous shock from the power line is DANGEROUS to YOU and other humans and you should replace the fog machine (or get it professionally repaired).
If it has a 3-prong grounded power cord it's SHOULD be impossible to get a shock from the case and it's unlikely that you'd get a shock from the switch connections.
A quick static discharge "zap" (ESD) is when there is a high voltage charge on your body (from walking across carpet, etc.) and it's suddenly discharged when you touch ground or a large metal object. Sometimes there's a spark and sometimes you feel it. It's not dangerous to you but it can instantly kill electronics. Sometimes you don't feel anything be the electronics are killed. It's risky (for the electronics) to have an exposed circuit board that someone can touch.
Are you sure the MCU is still running?
The manual pushbutton still works, right?
You're saying it worked before, but if you don't know the schematic the best way to "simulate" a switch is with a relay. A relay is an electrically-activated and electrically-isolated switch.