3

Wiring diagramI've got a Raspberry Pi Zero W which is connected to a 4 relay module, servo motor, and IR sensor. It has two functions: first, it operates continuously, watching the IR sensor and, when tripped, it flicks one of the relays which turns on an LED strip behind my bed. At 6:40 in the morning, it begins executing a different program which flicks two more relays and operates the servo motor which, connected to a dimmer switch, operates a sunrise alarm. The python script for the sunrise alarm can be found here: https://github.com/Ryan-M-Clare/RaspberryPi/blob/master/simple_sunrise.py

The problem is, when the sunrise alarm is activated, it will operate for a little while -- maybe a minute or two -- before it shuts off. When it shuts off, if I'm connected via ssh, the connection will terminate. If it's running on a hidden screen, the screen will terminate. Is this a symptom of working the Pi too hard? It doesn't seem like a particularly demanding script.

It seemed to work just fine when I was testing this code on my Pi 3 B. Is the only way to fix this to swap out the Zero for a 3?

Thanks.

  • Okay, I've included the diagram (yes, a Pi 3 is pictured but I'm using a Pi Zero). Out of curiosity, how do you expect this will help? If it worked with the Pi 3, isn't that a sign that it's correctly wired? – Ryan Clare Jul 25 at 11:13
  • You might want to have a look at the system logs to see if there is any indication of the cause. – goldilocks Jul 25 at 12:06
  • the schematic completes the question that you posted .... it also helps to actually see the schematic, instead of trying to inagine it .... try to narrow down the cause ... disconnect the motor and the relay module ... does it still reset? – jsotola Jul 25 at 16:43
0

I would suspect "ground bounce" on the gpio connections inducing a reset. The Pi3b is a more robust design (to handle the increased surge current from the larger processor and USB ports), so try adding larger bypass caps between 3.3 V and ground on the Pi Zero W and peripherals, and adding current limiting resistors (say 100 Ohms?) to the GPIO lines near the Pi zero W.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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