False interrupt on switching AC solenoid valve

mukund.k
Posts: 1
Joined: Sat Aug 03, 2024 3:06 pm

False interrupt on switching AC solenoid valve

Postby mukund.k » Sat Aug 03, 2024 4:02 pm

Objective : Switch 240V AC solenoid valve using ESP32.

Hardware Setup : An IR sensor (J6) to detect the input from the user, which in turn switches on a 12V operated relay (K8) via a BC547 transistor (Q1)

Schematic :
RelayDrive1.png
Schematic to swtich 240V AC solenoid valve
RelayDrive1.png (22.86 KiB) Viewed 817 times
Algorithm:
a. Setup a "NEGEDGE" interrupt on GPIO18
b. Upon receiving an interrupt, check level of GPIO18, if grounded -> then switch the state of relay (i.e if ON turn OFF, if OFF turn ON)

Issue:
ESP32 is getting false interrupt just after the 240AC solenoid valve is turned ON. This issue occurs 6 out of 10 times, the remaining 4 times, it works as intended. Here is a snapshot from the DSO-
DSO_False_Interrupt.jpg
Snapshot of testing on DSO
DSO_False_Interrupt.jpg (568.07 KiB) Viewed 817 times
CH1 is attached to GPIO18 i.e data signal from the IR sensor
CH2 is attached to GPIO19 i.e output signal for the transistor
On receiving the a negative edge, the ESP32 switches on the relay. However, roughly 5ms later, it switches it off as it receives another negative edge interrupt, which is not visible in the DSO.

Few Points to Note:
1. The happens only with 240V AC solenoid valves.
2. It works perfectly if no solenoid valve is attached or if a DC solenoid valve is used.
3. This doesn't happen when turning off the solenoid probably because of the snubber circuit (we tried without the snubber and then the solenoid would valve would turn on back again)
4. This has been tested with ESP32-S3 too. Same issue.
5. We have even tried isolating the power supply of the relay and ESP32 using an optocoupler. But the issue still persists.

Questions:
1. Why and how is the ESP32 receiving a false interrupt specifically when turning on an AC solenoid valve?
2. How can this issue be resolved?

ESP_Sprite
Posts: 9568
Joined: Thu Nov 26, 2015 4:08 am

Re: False interrupt on switching AC solenoid valve

Postby ESP_Sprite » Sun Aug 04, 2024 12:46 am

Your relay probably shoots a bunch of ESD noise into the rest of the circuit, triggering the interrupt logic. You could try filtering it out, but I'd personally simply ignore any interrupt that comes too soon after an already-processed interrupt.

Who is online

Users browsing this forum: No registered users and 131 guests