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 :
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-
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?
False interrupt on switching AC solenoid valve
-
- Posts: 9708
- Joined: Thu Nov 26, 2015 4:08 am
Re: False interrupt on switching AC solenoid valve
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: Baidu [Spider], Google [Bot] and 60 guests