I am currently building an ESP32-based dimmer control for halogen transformers.
The dimmer should be controlled by touching any part of the transformer output circuit. Thus, I somehow need to connect the transformer output with the dimmer circuit and detect touches using the ESP32.
I utilized a BC516 darlington PNP transistor to sense touches and connected the base towards the outer part of the lamp case (which will be touched later), in order to create a voltage drop from lamp to earth.
Dimming using phase angle control with a BTA16 TRIAC as well as touch sensing work just fine - until I connect the sense pin to any side of the halogen transformer output. Depending on which direction I plugged in the mains connector, I get either noise or my readings just drop to GND and touch information is completely lost.
Today I did some measurements and found out that voltage between earth (although transformer itself is only connected to N/L) and either transformer output is 230 VAC / 5-10 VAC (depending on plug direction). Short circuit current is roughly 0.5-2 mA, depending on the phase angle. How can this be? I assumed my transformer (OSRAM Halotec 225/230-240) offers galvanic isolation between input and output. But somehow I must have been wrong; otherwise, why is there current flowing?
I think that this will also induce the noise in my circuit. Mains voltage on my board is completely isolated using optocouplers.
simulate this circuit – Schematic created using CircuitLab
If you have any questions let me know; I am a beginner regarding electromagnetic interference and noise in general, so this is in fact all I can tell you.