0

I have a humidity sensor monitoring but I only want it to monitor for a short time and then I want to power it off. It is 3.3v. I am using CRON to call a script.py When the script finishes I would like power cut to the device. I am assuming I would use another GPIO to do this but I wanted to see if there are other ways?

Is it as simple as either hooking the 3.3v pin or ground PIN to another GPIO? Thanks!

4
  • 1
    What sensor? What are the sensor's power requirements? Please edit this information into your question.
    – joan
    Dec 5, 2018 at 20:47
  • 1
    Why do you want the power cut to the device?
    – CoderMike
    Dec 5, 2018 at 21:08
  • long periods of inactive times and dont need extra wear on the device. Dec 5, 2018 at 21:10
  • 1
    @OblongMedulla Note that if you are using a DHTXX (DHT11, DHT22 etc) you will have to make two readings and discard the first if it is powered down then up. The first reading after power up is inaccurate.
    – joan
    Dec 5, 2018 at 21:58

1 Answer 1

2

If the sensor can be powered from 3V3 and the sensor requires less than 16mA

Power the sensor with a GPIO. Set the GPIO to 1 to switch the sensor on. Set the GPIO to 0 to switch the sensor off.

If the sensor can't be powered from 3V3 or the sensor requires more than 16mA

Power the sensor with a transistor or relay controlled by a GPIO. Set the GPIO to 1 to switch the sensor on. Set the GPIO to 0 to switch the sensor off.

3
  • Thanks Joan! I just wanted to be sure before I brink the Pi, or maybe was a better way! Dec 5, 2018 at 21:15
  • GPIO pins can sink up to 16mA, but how much can they source? Dec 6, 2018 at 0:07
  • 1
    @PetrusTheron A Pi GPIO can source/sink 16mA. However it's suggested you don't source/sink more than 50mA from the GPIO as a whole.
    – joan
    Dec 6, 2018 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.