A little research online seems to indicate the potential for IR LEDs to damage eyesight. Perhaps this is the tinfoil hat squad talking, but I don’t want to take chances with my kid’s eyesight. Thus, we need to wire/program the pi so that it only flips the IR array on during active recording.
A little poking around revealed that the status of the camera (“ready” or “halted”) is held at /var/www/status_mjpeg.txt . I created a simple python script in the same directory called checkCam.py:
# status can be "ready" or "halted"
import RPi.GPIO as GPIO ## Import GPIO library
GPIO.setwarnings(False) ## Prevent constant warnings (maybe I did something inelegant?)
GPIO.setmode(GPIO.BCM) ## Use board pin numbering
GPIO.setup(7, GPIO.OUT) ## Setup GPIO Pin 7 to OUT
if 'ready' in open('/var/www/status_mjpeg.txt').read():
GPIO.output(7,True) ## Turn on GPIO pin 7
GPIO.output(7,False) ## Turn off GPIO pin 7
Lastly, edit /etc/rc.local with nano to include python /var/www/checkCam.py somewhere before exit 0 . That will cause the script to run on startup.
Next up: connect pin 7 to a transistor so that it can control an IR array!