Samstag, 28. April 2012

Just one picture every day

The Idea is simple: one Photo every day. I knew that if I would have to do this by myself, I would forget it. If not at the first day at least at the third one...

I had an old webcam, so i decided to connect the webcam to my router and let it upload the pictures to my webserver. And because he does all the stuff, he could also take a photo every fourth hour.

I had to struggle a bit but after all it wasn't too hard.

First install the required software to connect the webcam.
I figured this out from this List: http://www.ideasonboard.org/uvc/ Now i can connect to my webcam. The tool I used to actually take the photos is fswebcam. you have to create a config file to use fswebcam with your preferred settings. I also changed some stuff to get a better image quality I just edited my video settings and the output file. I also added a command to the end of the settings file. I need this later to read out the name of the last picture. Now you can test it and take a photo: You should now have a photo in your /root directory with date- and timestamp. Nearly done. Because my router is very limited in space, I need to upload the files. Also because I want to view them in my browser. So I wrote a little script which does all the Stuff. As you see, not very difficult. Now the hard part has begun. Dropbear is a very lightweight ssh server and client. You can't use normal keys with it. See this error: So i had to create a 'little' Key. Now you can add converted_key.pub to the authorized_keys on your server. I found this here For all this you need a user on your server: And for the end we need to call the script every fourth hour, so we add a cron job: I had to start and enable it. Now you should get a photo every fourth hour. Now lean back and enjoy the photo series next year ;) One thing to remember: my webcam takes crappy pictures! €1: really crappy pictures! Have to fix this soon.