I have been using the Raspberry Pi camera for a few days and I have been really impressed by the quality of the image and video. As you know, I have also been playing a lot with Racket recently. Yesterday I thought that one could take a time lapse using Racket. In fact, I thought that one could build a “portable time lapse maker” as follows:
- Set up the Raspberry Pi as a wireless access point, as described here: http://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/overview
- Create a Racket web server that can create a new thread to take the time lapse.
- The actual Racket code for time lapse just calls raspistill for a certain number of times. This is basically the same thing explained here: http://www.fotosyn.com/simple-timelapse-camera-using-raspberry-pi-and-a-coffee-tin/ but using Racket instead of Python and with a few additional parameters
- Finally, it is also possible to use the Raspberry Pi to generate an AVI file from the images using mencoder. This is explained in the previous link.
Put everything in your backpack, go on location, switch on the Raspberry Pi, attach your phone to the WiFi created by the Raspberry Pi, launch the job and you have an extremely portable, light and (hopefully) not-too-power-hungry time lapse maker. For instance, you could leave it on top of a mountain or next to the sea at night and go to pick it up the following day.
There was nothing on TV yesterday night, so I tried to see if it was possible to build a prototype. In the end, it turned out to be easier than I expected :-). I just had to play a bit with the parameters of raspistill but overall it took me:
- 45 minutes to write takeTimeLapse.rkt from beginning to end.
- 20 minutes to debug it and fix a few problems with parameters for raspistill.
- 35 minutes to build the Illy waterproof box as described in the link above.
- 10 minutes to build the cardboard version to be attached overhead (see picture above).
- 25 minutes to write WebRacketLapse.rkt (with very little debugging, so it is probably not going to work very well… I have already noticed a bug: the thread variable is not set to null when the thread finishes, this needs to be fixed).
I have uploaded the code here: https://github.com/fraimondi/racketlapse. If you want to try it, just download it to your Raspberry Pi and launch racket WebRacketLapse.rkt.
This is the result of 1h30 mins of coding, so use with extreme caution! Contributors are welcome…
These are the results of some experiments:
- Playing with play-doh on a race track… http://www.youtube.com/watch?v=J37blYg5BoI This is at 6 fps; check this other version at 24 fps (I think this is too fast). This could be another interesting application: creating stop motion videos with play-doh or other media.
- Dawn in Temple Fortune: http://www.youtube.com/watch?v=BHUBwiwjZcs. I left the Illy box outside for the night using a 9000 mAH rechargable battery and I managed to have enough power to go for 8 hours and a half (the video is trimmed at the begin and at the end); the temperature was around 7 C. Considering that the WiFi USB dongle is probably using a lot of power, one can expect at least 10 hours of battery life if the dongle is disconnected. 8 hours of 1920×1080 images taken every 15 seconds took approx 2 Gb of disk space. I have and 8 Gb SD card, so plenty of space left.
I am happy with the results so far and. If anyone has time to make this more user-friendly with a bespoke image for the Raspberry Pi and a better user interface in HTML, then I think it could have a number of applications. Drop me a line if you are interested.