I’m trying to setup a D1 mini to detect a machine when it is on. I’m using a basic Piezo disk with a rectifier circuit (4-1N4007 diodes) and a 0.22uF 50v capacitor. When the machine is ON, I’m getting a satisfactory Vout fluctuating from 0.03v to 0.06v. With the machine OFF, the voltage drops >=0.02v with the 1M resistor discharging the capacitor. This is great and suits my needs.
The problem comes into play when the door of the machine closes. I get a momentary spike upwards of 3 to 6 volts depending on how hard the door is closed. This obviously isn’t good for the D1 mini. Since the ON voltage is so low, how can I correct for this spike problem?! I’m not an electronics expert by any means.
The recorded voltages while machine is running is below. The door was not opened or closed during the trial due to the spikes.