Thursday, 25 September 2014

PIR to control USB camera

One of the things I want to try out is automatic recording of birds which visit the bird bath so the idea was to use a passive IR movement detector to tell the RPi when to record a photo from a USB camera.

It took a couple of hours scouring the net to find all the information I needed along with lots of failed coding attempts but eventually I got the idea to work just as a test layout in the kitchen. Very few components are needed - the Raspberry Pi (B+ in my case), the USB camera and the PIR:
(clicking on a photo will open a larger copy)


Of course a screen, mouse and keyboard were attached while coding.

Cobbling together several pieces of code from different sources resulted in:


modules loaded:
GPIO to acces the pins
time to be able to add delays where needed
os to give access to fswebcam code

N is a numerical counter which increments each time a photo is saved and added as a four digit number to the file name.



Next will be to get the photos saved on a USB stick instead of the micro SD card.

Saturday, 20 September 2014


I ordered a BerryClip+ kit of parts from Ryanteck Ltd. In one of my fastest Round Tuits I had all the parts soldered in about an hour. Included in the parts are 6 LEDs, 2 push switches and a buzzer. The BerryClip+ is the red board:

BerryClip+  DSCN3468

By going to it is possible to download instructions as none come with the kit. Included in those are details of how to download a set of Python test files so all available facilities on the board can be tested.

It was a great relief when all 10 test files worked perfectly first time.
Here are two of them in operation:

For non morse readers the message should read "hello from m1btr"  (my amateur radio callsign).
The morse message is typed into the RPi and then the routine sends it in morse to the red LEDs and the buzzer.

Sunday, 14 September 2014

The Ups and Downs of a USB Camera

As I keep having problems with the RPi camera I've been having a play with USB cameras on the Raspberry Pi B+.  I have a couple of oldish USB cameras I used a few years ago when I used Skype. They both work on the RPi OK once fswebcam is installed. I also have the RaspiCam Remote app installed on a Samsung Galaxy Tab2 so that the photos can be sent from the RPi to the tablet through my wifi network.

RaspiCam Remote just needs the IP address of the RPi to make a connection and load shots from the USB camera. I find it's a bit temperamental and needs re-starting from time to time, especially after the Samsung goes to sleep.

The setup was tested with everything set up in the kitchen and the pictures from both cameras were reasonably good.

USB camera 1410610257699

What I was hoping to do was set up a USB camera with the RPi in the Summerhouse so it could look through a side window at the bird bath. Unfortunately it would appear that USB cameras are probably set up to work in relatively low light indoors and both were overwhelmed in daylight, even when it was cloudy:

USB camera

Once daylight had partly faded the results were better:

USB camera

I will have to have a long think, experiment some more and do some searching. The present setup would probably be OK on dull days in the Winter.