Author Topic: "Homemade" Webcam  (Read 25978 times)

idunn

  • Strong Breeze
  • ***
  • Posts: 158
  • name: idunn
    • icantono2
    • Magpie Hill
  • Station Details: WS1080, iMac 10.9.5, Canon Powershot A510 zoomed with gphoto2, located at 950m in Gross Switzerland, Webcam view SE to Alps on magpie-hill.com on WeatherCloud (MagpieHill) and Wunderground (ID icantono2)
Re: "Homemade" Webcam
« Reply #45 on: August 23, 2016, 01:55:55 PM »
Hi All
Inspired by Reinhard I have followed the idea of using a normal camera as a webcam. Reinhard told me how to get started with the software gphoto2 and a supported camera. Since it is basically very easy and not expensive I thought my experiences would be useful to someone who has a particularly good view for his webcam. So here is sort of a step by step procedure.
1. Camera, Canon Powershot A510 or other compatible camera. See a list here. http://www.gphoto.org/proj/libgphoto2/support.php I had trouble with my powershot A30 so I bought a used A510 on Ebay for about $20.
2. USB cable (powered) to reach from computer to location, Maybe about 15 m.
3. Buy 110-240V adapter for Canon camera DC 3.15V supply; mine is called ACK-800. Batteries last only a few hours. I do not yet know how long my adapter, costing about $15, will last.
4. Mount camera in protected box or inside a window. I am using a small plastic refrigerator box with a window cut out and plexiglas glued in. ThisNz is mounted on the house on a covered balcony.
5. Download and install gphoto2: This is done by first installing Homebrew ( http://brew.sh/ ). Then on the Mac Terminal use the command

brew install gphoto2

6. Program the camera with gphoto2 in the Mac Terminal to zoom, take photo at intervals in sec., overwrite and store as a desired file name. My program involves only two commands as follows:
First run this command twice

killall PTPCamera

You should see the response ?No matching processes?were found?. Then copy and paste and run this below command in the Terminal.  Make sure you get the entire line copied.

gphoto2 --set-config zoom=3 -I 600 --capture-image-and-download --force-overwrite --filename webcamcanon.jpg

This sets the zoom as desired to 3, the interval between taking shots of 600 sec and stores the image with a desired name, here webcamcanon.jpg.  The image taking will continue until stopped by closing the Terminal window. Failure of the power (batteries or adapter) to the camera will cause the program to fail.  Experiment with different zoom values(1-9), Interval values (I can be any value in seconds). Complex programs can be written with gphoto2 to control cameras but I found by Internet searching that these two will accomplish what I want to do. If there are problems the Terminal will go wild. If so then close the Terminal window and choose a new window.  Start over and run the two commands.

Using the images with Weathercat: 
1. Set path on Mac to the image file name with Preferences in WeatherCat on Webcam.
2. Using Simple Web Preferences with WeatherCat, setup a webpage with Text and test locally.
3. I am paying about $5 per month for a provider to host my Simple Webcam website: www.magpie-hill.com
4. Using WeatherCat you can send the image to Wunderground (preferences>online>Wunderground PWS).
5. From WG or your own website the image URL can be given to webcam hosts, such as Lookr. Other weather hosts can be used such as WeatherCloud for your PWS data and webcam image.
Note Evocam software is not needed here since it is useful only with a video webcam. The Canon camera here is taking only still images.
The system had been running for about 15h and taken 6 photos per hour, but about at about noon today it quit working. So I turned the camera off and on and started a new Terminal window.  It runs fine now at 3 pm. Hard to say how stable the whole thing is. Attached is my webcam. 

Thanks for reading,  Irving

Blicj11

  • Storm
  • *****
  • Posts: 3941
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Ventura 13.6 | Sharx SCNC2900 Webcam | WeatherCat 3.3 | Supportive Wife
Re: "Homemade" Webcam
« Reply #46 on: August 23, 2016, 03:02:09 PM »
Irving:

Thank you so much for taking the time to document this for us. With a  view like you have, it is no wonder you want a high quality webcam. Keep us informed as you have some extended runtime with this setup.
Blick


wurzelmac

  • Storm
  • *****
  • Posts: 1361
    • ITIROLPR2
    • Wetterstation Pr?graten am Gro?venediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1300D | macOS Sonoma 14.2
Re: "Homemade" Webcam
« Reply #47 on: August 23, 2016, 08:07:56 PM »
 [tup]

Very cool description - and a great view.  :)
Reinhard


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Left out the most important part! (Re: "Homemade" Webcam)
« Reply #48 on: August 23, 2016, 10:26:13 PM »
Dear Irving, Blick, Reinhard, and WeatherCat beautiful scenery fans,

Inspired by Reinhard I have followed the idea of using a normal camera as a webcam.

Thanks for the explanation but you forgot the most important part of how you did it!

 [wink] . . . . You need to explain to me how to turn the dried grass and beaten up pine trees in front of our house into some beautiful scenery like you have on your webcam! . . . .  [lol2]

Seriously, thanks for taking the time to provide the clear explanation.  Perhaps I'll pursue this someday, but alas, I just don't have much of an incentive! 

Cheers, Edouard  [cheers1]

idunn

  • Strong Breeze
  • ***
  • Posts: 158
  • name: idunn
    • icantono2
    • Magpie Hill
  • Station Details: WS1080, iMac 10.9.5, Canon Powershot A510 zoomed with gphoto2, located at 950m in Gross Switzerland, Webcam view SE to Alps on magpie-hill.com on WeatherCloud (MagpieHill) and Wunderground (ID icantono2)
Re: "Homemade" Webcam
« Reply #49 on: September 11, 2016, 12:03:19 PM »
Hi Reinhard,
Do your cameras ever get  frozen up, say every few days?  My Canon A510 seems not so accept instructions until I turn it on and off and then redo the one-line program with the Terminal. Maybe memory gets full after a few days. I am shooting, deleting and saving every 10 min. Other than that all is working fine.  Nice weather here now north of the Alps. See attached. Thanks again for your help in getting me started with gphoto2.
Regards, Irving

xairbusdriver

  • Storm
  • *****
  • Posts: 3126
    • EW7115 (E7115)
    • KTNGERMA20
    • Mid-South Weather
  • Station Details: Davis VP2 wireless + remote Anemometer/2014 Mac min - 10.15.7/WC 3.0.5
Re: "Homemade" Webcam
« Reply #50 on: September 11, 2016, 02:30:18 PM »
I think you are on target with the "Memory" idea.
Quote
I am shooting, deleting and saving every 10 min.
Are you sure you are deleting from the camera's memory? If so, I'm not sure how the memory could be filling.

Does the camera have a separate memory card? Is it new? If it is removable, do you have a card reader to see what it shows of an "erased/deleted" card? This kind of memory does not last forever. There are varying numbers of recording/erasing actions for each cell. That's the reason SSDs usually have 'leveling' functions to try to use all cells rather than always starting at fixed addresses.

BTW, the images you have shown show their size as "594.11 KB". However, mathematically, they are 3,145,728 bytes. Perhaps that's the final size of the JPEG manipulations? However, if the actual image, in the camera, is that large, you may be filling the memory much faster than you think. OTOH, math beyond adding and subtracting was not my outstanding skill! [blush] [rolleyes2] [banghead] [lol]
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system


idunn

  • Strong Breeze
  • ***
  • Posts: 158
  • name: idunn
    • icantono2
    • Magpie Hill
  • Station Details: WS1080, iMac 10.9.5, Canon Powershot A510 zoomed with gphoto2, located at 950m in Gross Switzerland, Webcam view SE to Alps on magpie-hill.com on WeatherCloud (MagpieHill) and Wunderground (ID icantono2)
Re: "Homemade" Webcam
« Reply #51 on: September 11, 2016, 03:01:38 PM »
Thanks Xair,
Maybe, as you suggest, I am not deleting from the camera memory. Guess I don't know how to program that anyway. Works ok for a few days and the on-off with camera and reprogramming with the Terminal is just a few minute's work. Guess I will leave it as is.
Regards, Irving

wurzelmac

  • Storm
  • *****
  • Posts: 1361
    • ITIROLPR2
    • Wetterstation Pr?graten am Gro?venediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1300D | macOS Sonoma 14.2
Re: "Homemade" Webcam
« Reply #52 on: September 11, 2016, 04:07:43 PM »
Hello Irving,
I have had this problem with my G10 sometimes, but *only* every since and then (sometimes within days, sometimes within weeks). I do not think it has to do with the cam memory but I am not sure. All I can say is that this never happened with my old G5 and also never with the EOS1100d.

By the way, this command will remove all jpg's in your cam memory (if there are some):
Code: [Select]
rm *.jpgLet it run immediately before
Code: [Select]
capture-image-and-download
Cheers,
Reinhard


idunn

  • Strong Breeze
  • ***
  • Posts: 158
  • name: idunn
    • icantono2
    • Magpie Hill
  • Station Details: WS1080, iMac 10.9.5, Canon Powershot A510 zoomed with gphoto2, located at 950m in Gross Switzerland, Webcam view SE to Alps on magpie-hill.com on WeatherCloud (MagpieHill) and Wunderground (ID icantono2)
Re: "Homemade" Webcam
« Reply #53 on: September 15, 2016, 09:31:26 AM »
Reinhard,
Thanks for the camera tips. I am almost afraid to push my luck. Amazing that I got it running at all. Actually for me resetting is no problem.
Is there a directory here on WC for the webcams?
How do you get your banner under your signature (name)?
Thanks and regards,  Irving

wurzelmac

  • Storm
  • *****
  • Posts: 1361
    • ITIROLPR2
    • Wetterstation Pr?graten am Gro?venediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1300D | macOS Sonoma 14.2
Re: "Homemade" Webcam
« Reply #54 on: September 15, 2016, 04:26:56 PM »
Irving,
I let WeatherCat create the banner and upload it via Custom Web to my webspace. Once it is present there I can link it to everywhere I want, for example to this forum as signature underneath my name. I do not know how to handle this with Simple Web, sorry. If you use the Banner Generator, where do you find your Banner on your Mac? If the file is being generated and stored somewhere on your Mac you have to upload it onto your webspace somehow. This automated upload is done by Custom Web here on my side.
Reinhard


idunn

  • Strong Breeze
  • ***
  • Posts: 158
  • name: idunn
    • icantono2
    • Magpie Hill
  • Station Details: WS1080, iMac 10.9.5, Canon Powershot A510 zoomed with gphoto2, located at 950m in Gross Switzerland, Webcam view SE to Alps on magpie-hill.com on WeatherCloud (MagpieHill) and Wunderground (ID icantono2)
Re: "Homemade" Webcam
« Reply #55 on: September 18, 2016, 05:00:37 PM »
Hi Reinhard,
My Canon webcam still shuts down every few days. I think I have discovered that I do not need to turn the camera on and off. It seems enough to unplug the USB feed at the computer and then to reenter the Terminal lines. I am very happy with the photo, zoomed with a 2 factor. 
Irving

idunn

  • Strong Breeze
  • ***
  • Posts: 158
  • name: idunn
    • icantono2
    • Magpie Hill
  • Station Details: WS1080, iMac 10.9.5, Canon Powershot A510 zoomed with gphoto2, located at 950m in Gross Switzerland, Webcam view SE to Alps on magpie-hill.com on WeatherCloud (MagpieHill) and Wunderground (ID icantono2)
Re: "Homemade" Webcam
« Reply #56 on: September 08, 2017, 04:02:52 PM »
Hi All,
As I reported a year ago, Reinhard (see "Homemade webcam" from wurzelmac) instructed me how to use a normal camera as webcam, employing the software gphoto2. This gives a much clearer and nicer photo than you could get with most webcam cameras. Based on my one year experience, I would like to update my procedure as follows:
1. Camera, Canon Powershot A510 or other compatible camera. See a list here. http://www.gphoto.org/proj/libgphoto2/support.php  I bought a used A510 on Ebay for about $20.
2. USB cable (powered) to reach from computer to camera location. Mine is 10 m, two cables coupled together, reaching from camera to computer.  This might be about the maximum possible length.
3. The ACK-800, 3.15V DC power supply for the Canon camera, which cost about $15 from China, has never failed over 1 year continuous duty. 
4. For the camera mount. I am using a small plastic refrigerator box with a window cut out and plexiglas hot-glued in. This is located outside the house on a covered balcony.
5. Following Reinhard's instructions for gphoto2, I first installed Homebrew ( http://brew.sh/ ). Then on the Mac Terminal used the command

brew install gphoto2

6. My gphoto2 programming ability is very limited, but I managed with some guidance from the Internet to write gphoto2 instructions, which are entered in the Mac Terminal.  Thus the camera will zoom, take photos at desired intervals in sec., overwrite and store as a desired file name. These instructions involve only two command lines as follows:
With the camera turned on, first run this command twice

killall PTPCamera

After the second time you should get the response ?No matching processes were found?.
Then copy and paste and run in the Terminal this command line shown below.  Make sure you get the entire line copied.

Code: [Select]
gphoto2 --set-config zoom=3 -I 60 --capture-image-and-download --force-overwrite --filename webcamcanon.jpg
This sets the zoom as desired to 3, the interval between taking shots of 60 sec and stores the image with a desired filename, here webcamcanon.jpg.  The last image is deleted by the "force-overwrite" The image-taking will continue until stopped by closing the Terminal window.

At first, often the zoom will not be found, causing a non-zoomed photo to be taken. If I want to zoom, I need to close the Terminal window, open a new one and enter the command line again.

Here is the gphoto2 reply I get in the Terminal window after each photo:

Waiting for next capture slot 55 seconds...
Capturing frame #276...
New file is in location /store_00010001/DCIM/900CANON/IMG_0029.JPG on the camera
Saving file as webcamcanon.jpg                                                 
Deleting file /store_00010001/DCIM/900CANON/IMG_0029.JPG on the camera
Waiting for next capture slot 55 seconds...
Capturing frame #277...
 

You can experiment with different zoom values(1 to 9). The interval values I can be any value in seconds. Complex programs can be written with gphoto2 to control the camera but these above commands accomplish what I want to do.  Additional ideas can be obtained from the references below. I am attaching 2 photos, unzoomed and zoom=2

If the photo file is selected, the resulting photos appear in Preview, and the new one is seen by clicking on the last one.

Failure and restarting procedure:
On my system with the long 10m USB cord or 2 shorter cords put together, failure may occur every day or so. This is indicated by the message PTP I/O Error , and the picture-taking and downloading then fails.  If this happens I then close the Terminal window or force-quit Terminal. Then I disconnect the camera USB at the computer for a few seconds, restart Terminal and choose a new window.  Start over by running  the two commands. This procedure will take less than a minute.
It can happen that the camera might turn itself off. This occurred recently when I shut down my computer because of an approaching thunderstorm.   
When restarting, I noticed that when I entered the first "killall PTPCamera" that I got the reply ?No matching processes were found?. Normally this comes only after the second "killall PTPCamera" command. I simply went outside and pressed the camera's on-off button. Then I started the procedure with the terminal window again and all was well. Recently I had to turn the camera on a second time and repeat the procedure. After every restart remember to go to Weathercat and reset the Webcam Local File, as explained below. 

Images can be saved individually and as 1-hour videos with Weathercat as follows: 
Set path to the image file name with Preferences>Webcam. On my iMac these are located at Users>Irvingdunn>Library>Application Support>WeatherCatMedia>Movies and Pictures. If you have a disruption in the image-taking, after restarting make sure that you check to see that Weathercat is saving the images. This is done by clicking on Show Video Preview on the Webcam page. If the current image is not shown then you have to reset the Set Path.

I sometimes use iMovie to make longer videos from the individual jpg photos saved by WC.  WC saves one hour .mov videos which can be imported directly into iMovie. The normal speed can be decreased or increased by a factor of 8.  The .mov files can also be imported into QuickTime Player by simply dragging them in one by one to create a large .mov video for the day. This can be uploaded to YouTube. You can see a recent unzoomed result here.

www.youtube.com/watch?v=qRgRhpaY0sE&feature=youtu.be

As always when taking WC-saved images, there is a reduced resolution caused by the WC compression.

Using your webcam image online:
Setup a Simple Web weather webpage in the Preferences of WeatherCat.
I am paying about $5 per month to a provider for hosting my Simple Webcam website: www.magpie-hill.com
WeatherCat can send your image to Wunderground (preferences>online>Wunderground PWS) and to other weather sites (>additional services).
From Wunderground or your own website the image URL can be given to webcam hosts, such as Lookr.

I hope some of this is useful. 
Irving

Some useful links on using gphoto2
https://www.linux.com/news/controlling-your-camera-your-computer-gphoto

http://www.moreno.marzolla.name/software/linux-time-lapse/

https://wiki.archlinux.org/index.php/Digital_Cameras

Blicj11

  • Storm
  • *****
  • Posts: 3941
    • EW3808
    • KUTHEBER6
    • Timber Lakes Weather
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP Data Logger | iMac (2019), 3.6 GHz Intel Core i9, 40 GB RAM, macOS Ventura 13.6 | Sharx SCNC2900 Webcam | WeatherCat 3.3 | Supportive Wife
Re: "Homemade" Webcam
« Reply #57 on: September 08, 2017, 04:15:12 PM »
Irving:

Thank you very much for taking the time to document your procedures. The photos are stunning, not only because of where you live, but the improved quality of photo using a better camera is quite remarkable. Well done, mate.
Blick


elagache

  • Global Moderator
  • Storm
  • *****
  • Posts: 6494
    • DW3835
    • KCAORIND10
    • Canebas Weather
  • Station Details: Davis Vantage Pro-2, Mac mini (2018), macOS 10.14.3, WeatherCat 3
Thanks Irving! (Re: "Homemade" Webcam)
« Reply #58 on: September 08, 2017, 11:26:13 PM »
Thanks Irving for taking the time to document your setup!  [tup]

I wish I had the time to take on something like this!

Cheers, Edouard

wurzelmac

  • Storm
  • *****
  • Posts: 1361
    • ITIROLPR2
    • Wetterstation Pr?graten am Gro?venediger
  • Station Details: Davis Vantage PRO2 Plus (24h fan aspirated, wireless) with UV/Solar | Weather Envoy Data Logger | Mac mini 2023 M2 8/256 | 1x Canon EOS 1300D | macOS Sonoma 14.2
Re: "Homemade" Webcam
« Reply #59 on: September 09, 2017, 06:09:47 AM »
Hello Irving,

very nice work, thanks for sharing!  [tup]
Reinhard