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);
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.
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().