A while ago, I decided to wire up a Raspberry Pi (Zero W) to a few peripherals, but it stopped working shortly afterward (not entirely, but I think it was undervolting the power rails). I had connected a Relay Module, a PIR Module, and a DHT22 Shield. The Relay and DHT22 were on the 3.3v pins, and the PIR was connected to the 5v rail. DHT22 data was connected to pin 7, PIR to to pin 12, and Relay to pin 13.

All was working fine until the PIR started misbehaving in a way that is consistent with being undervolted (I don't have a functional multimeter atm to confirm, but various results searching for "False alarms at exactly 2 minutes" gave a similar answer).

I had connected them all directly to the pi (no pull-up or down resistors), based on some information I had gleaned from searching. I opted for the DHT22 Shield as it seemed to have an integrated resistor into it (and worked better with the form factor I was going for).

So, I assume this was wrong due to the outcome, so can anyone give any recommendations on what I should add to the circuits so when I do this to a new pi, I don't see the same results?

Additionally, I am thinking about adding another component, which would require sharing of some of the power pins. Is that something that is not recommended, or special steps that need taking? Based on the amperage of the components I intend to run in parallel, everything seems like it should work, but I would like to double check before possibly damaging another pi.

  • Without a schema and references to all components it's hard to do more than general recommendations. It could be the relay, does it have flyback protection and how is it controlled, what is the power consumption? You need to add more info. – MatsK Feb 21 '19 at 12:24
  • @MatsK Thanks for the update, not sure quite, but I have linked the Relay in question, and it seems to have an onboard flyback diode – topherg Feb 21 '19 at 12:29
  • Ok, thats a "Relay Module". – MatsK Feb 21 '19 at 12:35
  • 1
    @MatsK Apologies, updated – topherg Feb 21 '19 at 12:36
  • And to power the "Relay Module" with 3,3volt is a bad idea, its a 5V relay. A god practice is to have a separate 5V feed/rail, don't use the Raspberry Pi as a power supply. – MatsK Feb 21 '19 at 12:38

You need to do a power budget.

I would recommend a external power supply for 5volt devices.

You also need to interface the PIR's 5volt output to Raspberry Pi's GPIO of max 3,3volt. Either you can do a voltage divider or modify the PIR to 3,3volt.


simulate this circuit – Schematic created using CircuitLab


Example power budget:

  • PIR (HC-SR501) ~ 65mA

  • Relay module ~80mA

  • DHT22 < 1.5mA

  • Would you be able to recommend what I need to wire the Relay into this as well? Presently, if I connect it in the way described above, it causes the 2 minute issue again. Would it be a simple transistor bridge? Not sure of what resistances to use though... – topherg Feb 28 '19 at 12:08
  • The relay module has a transistor driver circuit so just supply the Vcc to the relay module from an external power source. An alternative is to add a big electrolyte capacitor over Vcc to GND on the relay module that can smooth the power dip/spike that the relay can cause. – MatsK Feb 28 '19 at 15:53

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