Power leak, turn off rx pin

I noticed I have a power drain through the RX pin. My sensor has 3.3v directly from the pin, and I disconnect it through a MOSFET disconnecting the ground. However, I notice that the RX still has some power to it, which I think is causing my power drain.

If I put the RX pin into output mode, will that remove the power drain? Then I can turn it back to input mode before reading.

pinMode(RX, INPUT);
//read data
pinMode(RX, OUTPUT);

Why do you think that is causing your power drain? How are you measuring your power? It would be helpful to see how you have things wired up.

4 Likes

I think I fixed it, I didn’t set the pinMode(RX, INPUT) in the startup. I think it was the power drain, because it is the only line with power on it and if I disconnected it from the RX pin, then my battery doesn’t drain.

Wiring
3.3 -> Sensor +
B0 -> mosfit

Sensor TX -> Particle RX.
Sensor ground -> mosfit
Mosfit -> Particle Ground

Just for nit-picking - it’s a MOSFET (metal oxide semiconductor field Effect transistor).

If you never called Serial1.begin() the RX GPIO will be in Hi-Z (INPUT) mode by default. And when you want to deactivate the interface call Serial1.end().

1 Like