Disabling external sensor while in deep sleep on Expansion Board 3.1
-
Hi everyone,
I'm pretty new to this so apologies if this ends up being something simple. I'm trying to build a remote water level sensor using a LoPy4 along with an expansion board 3.1 and an external ultrasonic sensor connected to the 3.3v power pin on the expansion board.
I have managed to get everything working, and the whole setup seems to function as expected, however the sensor remains powered while in deep sleep mode (machine.deepsleep()). From what i have read it seems like this command simply puts the LoPy4 to sleep while not affecting the Expansion Board, so I was wondering if there is a way to cut the power to the external sensor similar to the go_to_sleep() function on the Pysense/Pytrack?
-
@ZachH Most GPIO Pins can drive up to 40 mA, but then the output level drops to ~2.6V. Using an transistor is the better choice.
-
@ZachH Unfortunately it looks like my ultrasonic sensor needs up to 30mA which i believe is a bit high for the GPIO pins. Looks like its going to need a transistor switch
-
@jcaron Ah yeah I was wondering if that would be possible. I'll check on how much current I can get from the pins and hopefully that will be enough
-
@jcaron There may be another constraint, which is how much power your sensor needs, as GPIO pins have a limite on how much current they can source. You may need a transistor or something similar if your needs exceed that limit.
-
@ZachH You could power your sensor with a pin of the LoPy4, and just set it low before going to sleep. Make sure you use a pin which can be "held" at its level during deep sleep.