looking for a little help i have made a circuit board featuring 4 esp32’s the first three are driving 48 relay’s and work great the last right hand chip is used for digital inputs, doors / motion etc
the next input i’m using and the one thats causing a headache is used for motion. its done via a standard motion sensor with the 240v o/p driving a relay… i have my digital input conncted to the contacts on this relay. When i first installed the circuit board it worked fine but after a few weeks it went faulty and i noted the digital input voltage on the gpio pin had dropped from 3.3v to 2.6v and this caused it to float. Thinking it may have just been this particular gpio pin i moved the motion sensor to a diffrent gpio pin… this then worked but again after a few weeks it failed in the exact same way with the gpio pin dropping to just 2.6v (completely disconnected from the circuit)
The following esp code was used, as you can see it’s identical to the above working door contact code. I don’t believe its a software issue, Note its only # out because of the hardware failure
Its strange as the door contacts have been working for months with no fault & the only difference between the door and the motion is the motion switching is done via a relay ?
A few questions, but I have to admit this sounds bizarre.
What kind of relay? Dry contacts, opto-coupled or solid-state?
Also, is the relay connected as NC or NO? I would imagine you want an NO circuit, pulled high when the motion sensor is not triggered, so that the internal resistor isn’t actually active (i.e. no current running through it) most of the time.
If you disconnect the motion sensor and only have the relay connected, does this still happen?
Perhaps you can draw us a circuit of only the motion sensor, power inputs, relay and the pin plus ESP?
The cable I use from the relay to the esp32 is just single core and it runs a next to a lot of lighting circuits at 240v im wondering if it could be AC pick up and damaging the input pins so perhaps my solution is to run this short cable (within the panel) using a cable with a screen that’s earthed or even a Cat6a
I assume the NO contact labelled ESP32 3.3v is actually a GPIO with a pullup enabled?
Otherwise you are shorting the 3.3V supply to ground.
Possibly. You should actually be able to measure this with a multimeter. With the relay contact open what AC voltage do you measure on the GPIO?
A screened cable will reduce capacitively coupled noise (electrostatic) but do little for inductively coupled noise (magnetic).
You could place a 0.1uF 50V MLC capacitor from the GPIO to ground (keep the leads short as possible).
Also switching to the NC relay contact will ensure any noise is shunted to ground except for the brief periods the motion sensor is active. You can invert the logic in the ESP easily enough.
Sorry it wasn’t labelled very well yes it’s from a gpio pin on the esp32 going to the NO contact
I’ve measured AC pickup and I’m getting 1.5v ac, I think a screened cable should rectify this ?
That’s a good note about the esp32 clones because these are indeed from China / Aliexpress. do you know if the footprint on the ones suggested are the same…. ? I really don’t want to have to remake the boards again.