I'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?