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

idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #15 on: June 13, 2016, 08:09:59 AM »
Reinhard,

At the moment I don't know how to find the script you asked for. This is the small script I get when trying to run gphoto_timelapse

killall PTPCamera
gphoto2 --capture-image-and-download --interval 60 --frames 10

Here are three maybe useful links: program gphoto_timelapse, general description from gphoto on controlling cameras and one showing how to program for my camera Powershot A40

http://cl.ly/390o1D260d0O    download gphoto_timelapse. this was the app I tried

http://gphoto.org/doc/remote/    Doc :: Remote controlling cameras

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

This is specific to powershot a40

Have you set up your cameras for timelapse or do you control them differently?

Irving

wurzelmac

  • Storm
  • *****
  • Posts: 1117
    • 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 2,7 GHz Intel Core i7 with 12 GB of RAM | 2x Canon EOS 1100D | macOS 10.13.5 HighSierra
Re: "Homemade" Webcam
« Reply #16 on: June 13, 2016, 05:46:55 PM »
OK Ivring,

can't get this script to work here, either. Seems to be an AppleScript, not a bash script - so no idea, sorry. But try this (I assume that gphoto2 is installed correctly on your machine):

• Connect your Camera via USB to your Mac
• Open the Terminal, or if already open, a new Terminal window
• Type or copy&paste: killall PTPCamera
• Type or copy&paste: gphoto2 --list-ports (if this shows your Cam, youre good!)
• Type or copy&paste: gphoto2 --summary (shows a summary of your Cam)
• Type or copy&paste: gphoto2 --capture-image (takes a picture and stores it on your Cam)
• Type or copy&paste: gphoto2 --capture-image-and-download (takes a picture and stores it on your Mac)

If you are able to get this far, it is on you to determine all possibilities of gphoto2. For example you want let to take you Cam a picture every 15 min:

• Create a folder in your home directory
• Name it Camera
• Copy this code into a new txt-file and save it as camera.sh into the just created folder.
Code: [Select]
#!/bin/bash

while true; do # everything that is written between do and done loops infinitely
gphoto2 --capture-image-and-download --force-overwrite # takes a photo, downloads it to the Mac and overwrites the existing one
sleep 20 # waiting 20 seconds
done
• Execute the script using the Terminal:
• Type cd Camera and hit enter (cd = Change Directory, note that the commands are case sensitive)
• Type ./camera.sh and hit enter (look at the attached screenshot)

This small script creates a loop that takes a photo every 20 seconds. If you want to change the time between the photos are taken, change the number of seconds. If you want to abort the script hit ctrl+c into the Terminal or quit Terminal.

Enjoy!
Reinhard


idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #17 on: June 14, 2016, 08:28:38 AM »
Hi Reinhard,
I have downloaded gphoto and see a large number of files in a libgphoto2 folder. Not sure how to run it or use them.
I then plugged in camera and turned it on to auto.
Then tried pasting into terminal the first two scripts you sent, each followed by enter but got only these messages.
Last login: Tue Jun 14 09:08:45 on ttys000
Irving-Dunns-iMac:~ irvingdunn$ killall PTPCamera
No matching processes belonging to you were found
Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --list-ports
-bash: gphoto2: command not found
Irving-Dunns-iMac:~ irvingdunn$

So I wonder if gphoto is active just sitting in my download folder.
Also have I set the camera ok?
Have I used the terminal correctly, pasting in each followed by enter?

Thanks, Irving





idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #18 on: June 14, 2016, 10:18:27 AM »
Hi Reinhard,

Me again. With a couple questions.

Is it possible to fix the zoom using gphoto or on camera? I want to get closer to my mountains.
What is max cable length for USB?
Are you downloading webcams to WG?  Did not see them?
Would like to have a URL for my webcam separate from WG but dont have a website separate from WC and WG. Any ideas?

Attached is a photo from my Logitech Pro 9000 using Evocam.

Irving

wurzelmac

  • Storm
  • *****
  • Posts: 1117
    • 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 2,7 GHz Intel Core i7 with 12 GB of RAM | 2x Canon EOS 1100D | macOS 10.13.5 HighSierra
Re: "Homemade" Webcam
« Reply #19 on: June 14, 2016, 12:52:27 PM »
Hi,
first of all you need to install gphoto2 - seems like it sleeps in your downloads-folder. Move it to the trash and use Homebrew to install it. Just follow the instructions on their website ( http://brew.sh/ ) to install Homebrew. When this is finished, you can install gphoto2 and all that is needed via one single terminal command: brew install gphoto2

When this is done, we will move to the further steps.
Reinhard


Blicj11

  • Storm
  • *****
  • Posts: 2880
    • EW3808
    • KUTHEBER6
    • Timber Lakes Utah
  • Station Details: Davis Vantage Pro2 Plus | WeatherLinkIP™ Data Logger | iMac (late 2013), 3.5 GHz Intel Core i7, 24 GB RAM, macOS High Sierra | Sharx SCNC2900 Webcam | Supportive Wife
Re: "Homemade" Webcam
« Reply #20 on: June 14, 2016, 03:19:26 PM »
Nice photo Irving. I can see why you want to improve the quality of the camera: the view is stunning.
Blick


xairbusdriver

  • Storm
  • *****
  • Posts: 2078
    • EW7115 (E7115)
    • KTNGERMA20
    • Mid-South Weather
  • Station Details: Davis VP2 wireless + remote Anemometer/2014 Mac min - 10.13.4/WC 3.0
Re: "Homemade" Webcam
« Reply #21 on: June 14, 2016, 04:28:32 PM »
Great view! Are those 'hills' on your property?

USB is a specialized method of connecting devices to a computer. It is not designed for networking, like Ethernet. However, some extensions to its normal maximum distance of 5m by using <hubs>. Here are some recommendations fro the different versions of USB from <a company> happy to sell you the cables. ;)

idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #22 on: June 15, 2016, 09:55:03 AM »
Hi Reinhard,

I have used homebrew to install gphoto2.  Would be happy to follow your next instructions.

Regarding USB extensions, I am using a 5m repeater cable with another 5 m normal cable and the Logitech pro 9000 works ok. Think I will order another 10m repeater cable from China and hope that it also works.  Costs only about 7.  I see a used powershot A40 on ebay for about 10.  They have 2mp, which should be all one needs for a good webcam.  I have one A40 now.

Attached is my present webcam photo. It would look better if I could just get the mountains (from base at 1000m to 2000m) and sky. I think I saw zooming script for the A40.

Irving

==> Summary
🍺  /usr/local/Cellar/readline/6.3.8: 46 files, 2M
==> Installing gphoto2
==> Downloading https://homebrew.bintray.com/bottles/gphoto2-2.5.10.mavericks.bo
######################################################################## 100.0%
==> Pouring gphoto2-2.5.10.mavericks.bottle.tar.gz
🍺  /usr/local/Cellar/gphoto2/2.5.10: 11 files, 177.4K
Irving-Dunns-iMac:~ irvingdunn$

wurzelmac

  • Storm
  • *****
  • Posts: 1117
    • 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 2,7 GHz Intel Core i7 with 12 GB of RAM | 2x Canon EOS 1100D | macOS 10.13.5 HighSierra
Re: "Homemade" Webcam
« Reply #23 on: June 15, 2016, 12:16:19 PM »
Irving, happy to hear your installation of gphoto was successful. Now try the commands I posted earlier (13. June 18:46). To see what is possible with gphoto, go to the reference page of it: http://www.gphoto.org/doc/

Good luck!
 :)
Reinhard


idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #24 on: June 15, 2016, 01:03:24 PM »
Reinhard,
Quite successful. Took 2 photos. Where should the camera folder be?  Photos ended up in iphoto library. Maybe did not wait the 20 sec. There was an error that showed up so I repeated with a new terminal.
Have to play with it a bit now after taking garbage away. ha ha
I would think others would like to try. Powershot A40 cameras are very cheap.
Very encouraging. Thanks. Irving

Last login: Wed Jun 15 13:42:37 on ttys001
Irving-Dunns-iMac:~ irvingdunn$ killall PTPCamera
No matching processes belonging to you were found
Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --list-ports
Devices found: 6
Path                             Description
--------------------------------------------------------------
ptpip:                           PTP/IP Connection               
serial:                          Serial Port Device             
usb:006,005                      Universal Serial Bus           
usb:036,006                      Universal Serial Bus           
usb:006,003                      Universal Serial Bus           
usb:036,003                      Universal Serial Bus           
Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --summary
                                                                               
*** Error ***             
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (No such file or directory). Make sure no other program (MacOS PTPCamera service) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
*** Error (-53: 'Could not claim the USB device') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@lists.sourceforge.net>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --summary

Please make sure there is sufficient quoting around the arguments.

Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --summary
Detected a 'Canon:PowerShot A40'.                                             
Camera summary:

Camera identification:
  Model: Canon:PowerShot A40
  Owner:

Power status: on battery (power OK)

Flash disk information:
  Drive D:
      125'034 bytes total
      115'844 bytes available

Time: 2016-06-15 13:47:48 (host time +0 seconds)

Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --capture-image
                                                                               
*** Error ***             
An error occurred in the io-library ('Could not claim the USB device'): Could not claim interface 0 (No such file or directory). Make sure no other program (MacOS PTPCamera service) or kernel module (such as sdc2xx, stv680, spca50x) is using the device and you have read/write access to the device.
ERROR: Could not capture image.
ERROR: Could not capture.
*** Error (-53: 'Could not claim the USB device') ***       

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <gphoto-devel@lists.sourceforge.net>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --capture-image

Please make sure there is sufficient quoting around the arguments.

Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --capture-image-and-download
Detected a 'Canon:PowerShot A40'.                                             
New file is in location /DCIM/100CANON/IMG_0025.JPG on the camera
File IMG_0025.JPG exists. Overwrite? [y|n] y                                   
Saving file as IMG_0025.JPG
Deleting file /DCIM/100CANON/IMG_0025.JPG on the camera
Irving-Dunns-iMac:~ irvingdunn$

idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #25 on: June 16, 2016, 09:47:58 AM »
Reinhard,

I realize that my camera powershot A40 is not listed with known control features by gphoto2 . This may explain error messages and the frequent moving of lens in and out. I have found a A510 for little money and may buy it. It has 3.2 mp. Can one see the difference between camera quality and mp size on the computer screen? I also have a son who is not bad at computing, so I may enlist him in this project. More and more rain here at 900m, N side of Alps.

Irving

idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #26 on: June 17, 2016, 05:22:41 PM »
Hi Reinhard,

Want to give you an update.

I made good progress with gphoto2 but I see limitations with my hardware.

I am not able to get the signal over 10m usb cable like I can with my Logitech webcam (2 mp).  I will get another 10m active usb cable from China, about $7, and try it out.

My A40 (2mp) camera seems ok, except with each command the lens goes in and out about 10 times. Don't know how to prevent this. But I have bought a used A510, 3.2mp, camera for 8€ and will see how that is.

My main goal is to be able to zoom on my mountains and I will try to rig a lens system with my Logitech 9000, which has been working faithfully for a few years.  It has 2mp with a good lens and I am very satisfied with the picture. I think I will buy a used one for 20€ from ebay to experiment with.

So my direction seems now to be trying to get a zoom lens system on the Logitech. I will also continue to fool around with the gphoto2 programming and see if I can zoom the camera.

My cable problems could be solved with a dedicated Macmini like you have.   

Again now some thunder over the mountains, at least no rain today and warm weather expected by Wed. The Rhine is very high and the Bodensee is over its banks. The south side of the Alps (Lugano) got about 18cm of rain overnight. Locally here on the north side no problem.

Hope all is well, Irving


xairbusdriver

  • Storm
  • *****
  • Posts: 2078
    • EW7115 (E7115)
    • KTNGERMA20
    • Mid-South Weather
  • Station Details: Davis VP2 wireless + remote Anemometer/2014 Mac min - 10.13.4/WC 3.0
Re: "Homemade" Webcam
« Reply #27 on: June 17, 2016, 08:15:02 PM »
If I remember correctly, 10m is the limit for USB (not sure is any version has different maximums). But many suggest that distance can be dramatically improved by using powered hubs. I would suggest using shorter cables and two powered hubs. The main problem (unlike PoE) is the extremely low DC voltages with USB. Thus the requirement of powered hubs. These will act as power-boosting relay stations.

Different devices can operate on higher or lower voltages. Some can get along with simply detecting voltage or none. I suspect your camera will need much more than that simple 'signal'. Powered hubs will create another problem, of course; access to an 'mains' outlet.

So, shorter cables will mean less voltage drop with the powered hubs acting as signal boosters so that the voltage reaching the camera will be as high as possible.

As for the cycling of the lens, it sounds similar to what many cameras do when shut down and/or started up. I might be helpful to know if there is a setting to control any automatic 'sleep' mode for the camera. It could also be an automatic focusing behavior that might be set to manual. :)

Thanks for your perseverance and please keep us up-to-date on your progress! [cheers1]

wurzelmac

  • Storm
  • *****
  • Posts: 1117
    • 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 2,7 GHz Intel Core i7 with 12 GB of RAM | 2x Canon EOS 1100D | macOS 10.13.5 HighSierra
Re: "Homemade" Webcam
« Reply #28 on: June 19, 2016, 12:26:24 PM »
Hello Irving,

glad you got it running! To see what gphoto2 is able to do with your camera type into terminal the following command:
Code: [Select]
gphoto2 --list-config
The output should list all possible variables that you can use to control your cam. For example with a G5 or G10 I can set the zoom-level between 0 and 5, if I recall correct. It is set to level x with a command like this:
Code: [Select]
gphoto2 --set-config-value /main/capturesettings/zoom=x
But, as said previous, look at this document to see what cam is supported and what features are supported. This document gives an overview on how gphoto works and what all is possible.

Looking forward to see a website of your live cam and your weather station!  :)
Reinhard


idunn

  • Strong Breeze
  • ***
  • Posts: 145
  • 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 #29 on: June 19, 2016, 01:34:15 PM »
Hi Reinhard,

Thanks for the tip on the zoom. I made the list-config a few days ago and got this.
Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --list-config
Detected a 'Canon:PowerShot A40'.                                             
/main/settings/ownername
/main/settings/capturesizeclass
/main/settings/iso
/main/settings/shootingmode
/main/settings/shutterspeed
/main/settings/zoom
/main/settings/aperture
/main/settings/exposurecompensation
/main/settings/imageformat
/main/settings/focusmode
/main/settings/flashmode
/main/settings/beep
/main/actions/syncdatetime
/main/status/model
/main/status/datetime
/main/status/firmwareversion
/main/status/driver
/main/Driver/list_all_files

Then I tried to set the zoom with
Irving-Dunns-iMac:~ irvingdunn$ gphoto2 --set-config zoom=2 --capture-image-and-download

Got this error comment
*** Error ***             
The passed value 2.000000 is not within the expected range 0.000000 - 0.000000.
New file is in location /DCIM/100CANON/IMG_0028.JPG on the camera
File IMG_0028.JPG exists. Overwrite? [y|n]       

So maybe my zoom is not controllable on the A40.  I will get a A510 next week and try. Interestingly I was not able to repeat the gphoto2 --list-config. Maybe I need the killall PTPCamera command more often.

I found 2 interesting blogs on gphoto2.

http://www.moreno.marzolla.name/software/linux-time-lapse/
http://blog.dcclark.net/2009/05/how-to-gphoto-primer.html

I emailed with Moreno Marzolla a few times. He is a prof. of computer science in Italy.

I want to experiment with using a small 2.5x telescope in front of my logitech 9000.  This has been a fantastic webcam for me, running day and night for more than 6 years. I am bidding on another at Ebay for about 20€.

Irving