Aah – the summer arrives, so now I can actually finish/document some work that languished during the academic year. Have a look at this project over on Github and build your own! This fork of the popular RPi_Web_Cam_Interface adds support for night vision via IR LED ring (including auto shutoff so you’re not blasting your tot with IR all night).
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
/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!
Today I got down to business on a new Raspberry Pi project. I started with the following parts:
- RPi 2B (w/ 8G NOOBS)
- USB wifi dongle
- RPi Noir camera board
- Monitor, keyboard and mouse (just for setup)
Following a clean install* I set up my RPi to enable SSH and the camera. If your RPi system software is already installed, you can reach these features by entering
raspi-config in the Terminal. I also got the wifi dongle talking to my network. Camera installation is really simple. See this link to make sure you get the ribbon cable polarity right.
Now we install RPi-Cam-Web-Interface. The documentation is a little hard to follow, so here’s a condensed version:
sudo apt-get install lsb-release
- Confirm OS code name is “Jessie”
git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
chmod u+x *.sh
- Enter the IP address of the RPi into a browser from another computer on your network. You should get a page full of options and a live image from the camera.
Ok! Next time I’ll talk about adding UV LEDs.
*After one unsuccessful run at this project, I ran into problems trying to reinstall NOOBS from the RPi boot screen. You’re supposed to be able to do this by holding shift, but I couldn’t get it to work (even after trying all the voodoo like rapidly pressing both shift keys in alternating fashion). I wound up downloading a fresh copy of NOOBS and copying it to the SD after wiping it with the OSX disk utility. Everything worked perfectly after that.