Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Raspberry Pi as a webcamera

For discussion of DIY weather equipment - sensors, accessories, improvements to existing kit etc
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Raspberry Pi as a webcamera

Post by tumutbound »

Not sure if this should be in the Webcam forum, mods feel free to relocate if required.

Not the first to do this* but I thought I'd document my build of a weather camera based on a Raspberry Pi computer.

What you'll need is a Raspberry PI (I'm using a Model B), a Raspberry camera module, a WIFI dongle,, a box to put it in and some spare time.
A bit of programming knowledge would come in handy but there are enough guides out there to get you going using the standard picture taking utilities.
I'll post more once I get some photos organised.

Designing a web site to upload your images to is a whole other subject for which I'll soon be seeking assistance :D


*Thanks Karl from Bridge Lake Weather Station =

Regards
Geoff
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Sorry about the size of the images. I would have used thumbnails but didn't see an option to do so.

First step was to source a suitable camera housing. There are quite a few dummy security camera housings available on eBay but most of them seemed to be plastic.
I found this one at a local electronics retailer for about $A40. It has a slide in metal shelf on to which the components can be mounted.
camera_housing.jpg
As the camera will be 3 metres up on the side of my shed which is about 15 metres from the house, I decided to use WIFI dongle ($A9) and to provide 5V for the Pi,a DC-DC converter ($A10), both from eBay.
Power is supplied from an 8V wall wart through 10 metres of outdoor lighting cable. This was choosen as it's a tough, UV stable, weatherproof product with a 1.3mm core so they'll be hardly any voltage drop.

I made a camera bracket from a piece of 60mm aluminium angle into which I cut a slot for the camera flat cable. A couple of holes were drilled for mounting the camera module and it was secured with nylon screws and stand offs.
IMG_3765.JPG
IMG_3766.JPG
A few suitable holes were drilled on the supplied metal shelf to mount the Pi and the DC-DC convertor. Spacing is not critical but the camera cable is quite short so keep the Pi as close to the front as possible.
IMG_3761.JPG
IMG_3760.JPG
The only modification I made to the case was to drill a hole to mount the antenna on the back. To connect the antenna to the WIFI dongle, you need an co-ax extension cable (RP-SMA) which are readily available on eBay.
IMG_3764.JPG
The power cable is a bit stiff and was awkward to connect to the DC-DC converter so I mounted a small piece of screw terminal strip to the shelf to make the connection a bit easier and to provide some strain relief.
Last step was to clean off all the fingerprints off the glass and install the front and back covers..

Now I need to put it in its final location but that required a bit of wood butchery which I'll do tomorrow.

If you want to see a quick snapshot, pop on over to http://www.port-huon.com.au/weather/webcam/weather.jpeg
You do not have the required permissions to view the files attached to this post.
Last edited by tumutbound on Tue 01 Apr 2014 9:25 am, edited 5 times in total.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
captzero
Posts: 363
Joined: Wed 03 Mar 2010 10:20 am
Weather Station: Vantage Pro2 w/ daytime FARS
Operating System: Windows 10
Location: Brisbane, Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by captzero »

Geoff,
Great picture quality and resolution. Well done. :clap:
Dan

http://www.brisbaneliveweather.com




A man with a thermometer always knows the temperature. A man with two thermometers, not so sure.
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

I still have to decide what software to use to take/process the images.

I used Karl's method of taking three bracketing shots and then processing with enfuse. This gives good definition to the clouds at the expense of foreground detail. That's OK though as it's the clouds we're interested in, not my plants. :D
The software I used for the sample shot is a simple Python script using the picamera module.
If I take a snapshot using motion software, I get a much tighter shot i.e. narrow FOV. Both are taken with the same resolution (1280x768) so I need to find out how to duplicate the motion results with picamera.

As the Pi only has an SD flash drive, writing to it as little as possible is a good idea, so images are stored on a Samba share that is mounted on the Pi from my Linux server. (I'll also change the logging so it goes to the Linux server). I need to update the script to ftp the processed images to the website. I also want to overlay some text e.g. current temperature, humidity etc. which can be done with ImageMagick

EDIT: Seems that the FOV issue is to do with whether the still or video port is used in the Pi camera. Video resolution is lower than for still pictures but a quick test shows it's still more than acceptable.

Sample image via video port is here: http://port-huon.com.au/weather/webcam/latest.jpg
Last edited by tumutbound on Wed 22 Jan 2014 2:24 am, edited 1 time in total.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Too windy today to climb a ladder and install the camera so worked on the software a bit instead.
Not having programmed in python before, it's a slow process. At least it's not javascript ...

For anyone who's thinking of installing a camera, here's a detailed costing of my effort (in Australian dollars):
  • Raspberry Pi (Model B) $A42
    Raspberry Pi camera module $A30
    Metal camera case and bracket $A50
    WIFI dongle $A9
    RP-SMA antenna cable extension $A2 (actually 5 off for $A9)
    DC-DC converter $A12
    10 metres of dual core cable $A12
The Raspberry Pi and camera module are available from RS-Components or Element-14 (Farnell). The other parts came from various eBay sellers. The cable I got from the local hardware store.
Total cost was $A157 which is about the price you'd pay for an HD outdoor camera but the Pi based camera can do so much more.
All the photo processing (taking the images, combining multiple shots, making a daily time-lapse video and uploading the results to my website).
Lots of room in the camera housing and lots of spare processing power so I'm thinking about what else I can add ;)
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
howesij
Posts: 15
Joined: Mon 20 Jul 2009 8:02 am
Weather Station: X7062 (Rebadged MyDEL WX2008 MK
Operating System: Win7, Linux
Location: Brisbane
Contact:

Re: Raspberry Pi as a webcamera

Post by howesij »

Hi Geoff,

Great Work I have been thinking about doing this since the RPi camera was released.

Have you found any good software yet for taking the shots?

My current weathercam takes 16 sec exposures at night which is good for capturing lighting, so I would like to continue to do this.

I was also thinking about powering the RPi by a solar panel and lithium battery pack.

Cheers

Ian
Nomads Weather http://users.tpg.com.au/howesij/weather/index.htm
Nomads WeatherCam http://webcams.bsch.au.com/ferny_grove.html
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Hi Ian,
The software is a script written in Python using the picamera library. The software to combine the images is enfuse and the GPS data is added using ExifTool.
The script is run from cron every 1 minute.
I plan to change the script to set the time of the first and last image based on sunrise/sunset times (supplied by Cumulus) as checking the cronjob is a pain and if I forget, results in black images at the end of the day. The script will be run as a daemon.
The Pi camera is not good in low light but I must admit I haven't played around with long exposure times. I've a second camera so might do some tests with it.
Also looking at using ImageMagick to overlay some text on the image

EDIT: A bit of browsing and some testing reveals that the Pi camera can have a maximum shutter speed of 9.7 seconds at ISO 800.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
howesij
Posts: 15
Joined: Mon 20 Jul 2009 8:02 am
Weather Station: X7062 (Rebadged MyDEL WX2008 MK
Operating System: Win7, Linux
Location: Brisbane
Contact:

Re: Raspberry Pi as a webcamera

Post by howesij »

Hi Geoff,

Thanks for that 9.7 second may just have to do.

why do you combine the images?

That would explain the ghost of a timber truck I noticed earlier today.

You can get imagemagick to detect black images but it is a bit convoluted
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Hi Ian,
I started combining three bracketed images to give better cloud definition. The idea came from Karl at Bridge Lake Weather Station. He's posted about his webcam setup in these forums.
Looking at the 'standard' exposure compared to the combined one does show a slight improvement in the combined one. As it's no great problem to have the Pi do the imaging work, I'll keep doing it this way. People will just have to get used to ghost vehicles :D
You can also see something similar when there are yachts in view but in that case, you get three, distinct, overlapping images as they're seldom travelling at the same speed as the cars!

Another bit of Pi software I've just downloaded is RPi Cam Control. This one provides a web interface to the Pi camera that lets you take images, videos or timelapse sequences. You can also change any of the cameras parameters (ISO, shutter speed, AWB, etc) via the interface in real time. I've built a second camera as per the build in this thread so I'm going to run RPi Cam Control on it to see how reliable it is.
You do not have the required permissions to view the files attached to this post.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
User avatar
marfanuk
Posts: 43
Joined: Wed 06 Nov 2013 5:27 pm
Weather Station: Davis Vantage Vue
Operating System: Raspbian on the Raspberry Pi 2
Location: Nantwich, United Kingdom
Contact:

Re: Raspberry Pi as a webcamera

Post by marfanuk »

This one on Kickstarter might be worth a look if you want the ready made option...

Image

https://www.kickstarter.com/projects/18 ... y-pi-and-c

http://elsondesigns.com/pice
Image
https://www.nantwich-weather.uk - Meteobridge

Darren
User avatar
KarlS
Posts: 137
Joined: Tue 30 Nov 2010 3:01 pm
Weather Station: Ecowitt GW1003 / WH32 / WH41
Operating System: 64bit Bookworm on Pi4
Location: Bridge Lake, BC, Canada
Contact:

Re: Raspberry Pi as a webcamera

Post by KarlS »

Luckily there are no fast moving objects in my field of view, so no "ghosts" when combining multiple images.

It might be obvious, but I mention it anyway: the default timeout between pictures is 5 seconds! You can reduce this value with the --timeout or -t parameter (in milliseconds). For example setting it to a value of "-t 500" will give you pictures at a 1/2 second interval.

My webcam is installed under a 4 foot roof overhang, so no need for weather protection. Here is my low tech housing, made out of scrap wood and masking tape :lol: :

Image
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Karl,

Thanks for the update and photo - nothing wrong with masking tape!

My camera is controlled with a python program that uses the picamera module. This drives the camera module directly and doesn't use raspitstill to take the images. I find with the settings I'm using, I can take an image in about .4 of a second.

Regards
Geoff
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Bugger!
Seems a recent software update to the Pi camera, caused a problem and after a reboot, it won't restart :cry:
This means getting out the ladder and climbing up on the roof to retrieve the camera - all for a software fix! Not fond of ladders so it may be a day or two until this is done.

If nothing else this has taught me I need some way to access the camera (short of the ladder method) in case wifi stops working. As I have a spare camera, I'm currently looking at a way to have a single cable (Cat5) carry both power and a USB console connection.
I might also take the opportunity to fit a small hard disk (USB). Anything that reduces SD card access has to be a good thing.

And if that wasn't enough, my weather station has stopped reporting rain...

LATER: I've made up a 12 metre USB to TTL cable from a length of Cat6 cable and it works like a treat.! Next test is to run the 12V power over the spare pairs.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
howesij
Posts: 15
Joined: Mon 20 Jul 2009 8:02 am
Weather Station: X7062 (Rebadged MyDEL WX2008 MK
Operating System: Win7, Linux
Location: Brisbane
Contact:

Re: Raspberry Pi as a webcamera

Post by howesij »

HI Geoff,

Check your rain gauge for spiders,

I have to clean mine out and spray it with a surface spray every 6 months.

they build a web and trap the tipper so it doesn't report rain.

Cheers

Ian
tumutbound
Posts: 154
Joined: Thu 11 Mar 2010 11:03 am
Weather Station: WH1081
Operating System: Linux, Raspberry Pi (Wheezy)
Location: Port Huon, Tasmania , Australia
Contact:

Re: Raspberry Pi as a webcamera

Post by tumutbound »

Thanks Ian.
I'm planning a spider eviction for today. They haver started to work on the webcamera too!
I'll also take some measurements of the transmitter unit so I can make up a fan aspirated radiation shield.

Geoff

edit:Several spiders in the rain sensor and in the temperature shield All now looking for a new home :)
New lithium batteries, tested rain, wind speed/direction. Now to clean up those entries in Cumulus.
My weather
CumulusMX (3036)
Raspberry Pi: Wheezy
FineOffset WH1081
Post Reply