💾 Archived View for benjaminja.com › projects › timelapse_cam captured on 2024-08-25 at 00:17:40. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-08-18)

-=-=-=-=-=-=-

Timelapse Webcam

2021-02-01

đź–Ľ Film photo of the webcam

My parents have done an addition to their house and they wanted to be able to watch the progress of the house as time goes on. Instead of buying a camera that could do the same thing, I decided to develop my own solution.

It is built with a Raspberry Pi, Django, and Vue. My first thought was to use the live mjpg feed that OctoPrint uses, but I found that it is difficult to have a lowish quality stream and a high quality timelapse so I developed my own streaming system.

Design

The streaming system puts the camera in picture mode and takes a hi-res photo at a specified interval. If there is someone watching the stream, a second low-res photo is taken and sent to the client. The client will request for a link to the latest stream photo: if there is an active stream, then the latest photo link will be returned along with the time of the next stream photo, otherwise a new stream will be started and the client will be told to wait a few seconds for it to start.

I’ve setup the webcam to get a frame once every 5 seconds. When it’s running for up to 12 hours a day, you end up getting a large amount of redundant photos. To combat this, I compile all the photos into an mp4 file at the end of each day. The only problem is that the raspberry pi cannot handle that amount of load before the next day starts, so I setup a system where one of my servers will take care of rendering the day’s timelapse.

Problems

If this system may sound a little sketchy, that’s because it is a little sketchy and that’s ok because it works… mostly. The biggest problem that I have faced with this project is the fragility of the Pi’s sd card. Because the house has become a construction site, it is common for the power to go out once every few months. Almost every time an unexpected power outage occurred, the sd card has become corrupted. I think that this is because it takes a photo every 5 seconds, so it’s very possible that the pi was in the middle of a write when the power got cut.

It has gotten to the point that I had to figure out a way to combat this as to not lose my hair. My final solution has been to use an external usb drive for non-volatile storage and boot the pi into read-only mode. I think that this has fixed the problem of corrupt Pi’s, but I’ll have to wait and see when the next power outage occurs.

Another problem that I have faced was from solar heat. The Pi would easily get up to 80°C when in the sunlight. So our simple fix was to put a bucket on top of it. I think I could have gotten away with putting some sort of reflectors on the back, but the bucket works well enough.

Reflection

Overall, this has been a pretty crazy project. I think that most of my design decisions have been poor ones. Particularly when some problem happens months after I have forgotten about the project. But, seeing what has come out of it has been prety amazing.

If I were to do it all again, I would probably use mjpg streamer or at the very least use a websocket.

đź”™ Projects