I'm making a device that will have contact with water, so the electronics are encapsulated in epoxy. I want to have the option to reprogram the microcontoller, so I want to add contact points that I can connect USB micro lines to. Problem is I obviously can't have current leaking out of those points when not connected to USB and it's in the water. I can stop the vin from reverse flow using a diode, but I can't figure out how to stop current from the tx line of the micro.
I tried a diode there too, but when connecting the tx line to the USB, I need current to flow from the micro. I tried an n channel mosfet using an I/o pin to control the gate and had the tx line divided between drain and source, but it didn't seem to work quite right.
Ideally I'd like the gate to be automatic, where it opens when the USB is connected/detected, but I could use an I/o pin to control a gate too because the micro has Bluetooth. The voltages are low--5v from USB, micro is 3.3v.
How do I stop the USB from leaking current when its not in use?