Hello everyone, and thanks for reading
I´ve been working in a project to dim lamps from a cellphone, and it´s so frustrating because everything works really good when I'm testing, but when I install the device in the wall to control actual lamps everything starts to behave in a non desirable way.
The circuit consists of a microcontroller controlling 2 triacs via optocouplers. Microcontroller knows the timing because it receives a Zero Cross signal from a full bridge rectifier (also via optocouplers). Microcontroller also receives Rx and Tx with messages to control de lamp.
So far everything works good, the problems start when I connect the wall switches to the Interruption on Change pins of the microcontroller.
I'm using the build-in pull-up resistors. The wall switches receives two small wires, one for ground and the other goes back to the microcontroller.
The problems I see is when I change a switch, sometimes nothing happens, sometimes the lamp turns on/off and sometimes the non related lamp turn on/off. I'm guessing that this is caused by the long wire that goes from the microcontroller to the wall switch. The wire is about 10 meters (30 feet).
Thinks that I believe is related:
I've done some research and found this article, so it looks like a Transient voltage suppressor may be needed, but how can I know if that is the case? And what kind of TVS do I need?
Please, keep in mind that when the wall switches are not connect, everything works fine, even the serial communication
I´m not home right now, but latter night I can post images of the circuit if it's necessary.
Thank you very much for taking the time to help me, and sorry for the long post.
I´ve been working in a project to dim lamps from a cellphone, and it´s so frustrating because everything works really good when I'm testing, but when I install the device in the wall to control actual lamps everything starts to behave in a non desirable way.
The circuit consists of a microcontroller controlling 2 triacs via optocouplers. Microcontroller knows the timing because it receives a Zero Cross signal from a full bridge rectifier (also via optocouplers). Microcontroller also receives Rx and Tx with messages to control de lamp.
So far everything works good, the problems start when I connect the wall switches to the Interruption on Change pins of the microcontroller.
I'm using the build-in pull-up resistors. The wall switches receives two small wires, one for ground and the other goes back to the microcontroller.
The problems I see is when I change a switch, sometimes nothing happens, sometimes the lamp turns on/off and sometimes the non related lamp turn on/off. I'm guessing that this is caused by the long wire that goes from the microcontroller to the wall switch. The wire is about 10 meters (30 feet).
Thinks that I believe is related:
- The triacs are model BTA16-600BW (and the W means it's snubberless)
- AC is 127V@60Hz
- VCC is 3.3V
- I´m using a 5 to 10 ms for debouncing the switches
- Circuit have a 1nF capacitor connecting the microcontroller pins to the ground (the pins related to interruption-on-change)
I've done some research and found this article, so it looks like a Transient voltage suppressor may be needed, but how can I know if that is the case? And what kind of TVS do I need?
Please, keep in mind that when the wall switches are not connect, everything works fine, even the serial communication
I´m not home right now, but latter night I can post images of the circuit if it's necessary.
Thank you very much for taking the time to help me, and sorry for the long post.