Dynamically pausing the Raspberry Pi Camera

For several months, i have set the time frame for creating the "zip file" to a static value. But a disadvantage of this approach is, a few minutes pass by, in which the Raspberry Pi has nothing to do at all. Because i reserved with 15 minutes a generous amount for the quite demanding job. Since the "zip file" sizes with up to 600 MB were too big anyway, i changed the way i do it. Instead of making one big archive at midnight, i create two small ones, one every 12 hours, as instructed in my shell scripts, and set up in crontab. Files with around 300 MB are just more manageable on the "Zero W", especially with the workload it has.
I also make use of a "file locking" mechanism to get the transitions seamless. This way the Raspberry Pi will immediately continue to take photos when the packaging of the JPEG files is done, simply by checking for the absence of a "lock file", which prevents it from doing multitasking. I wrote four separate "Unix shell scripts" for this process, and added them to cron: camera, cameraSweep, cameraWatchdog, and cameraZip. They explain themselves by their filename, and i already presented some functions in older posts, except for the second one: After a fresh start, it deletes all "lock files", just in case if the reason for the reboot was a crash and crumbs are left behind.

Optimizing Raspberry Pi time-lapse workflow

After having produced 11+ time-lapse videos continuously by running over 70k JPEG files from the Raspberry Pi through several hardware and software, i did some further optimization. I removed the batch editing step, and let "ffmpeg" crop and scale all at once. This way i'm saving almost an hour of processing time, and a lot of energy too. But it was a good exercise in adding pieces to the chain.
After all, "ImageMagick" can do a lot more than only cutting photos to the right size. For example, select parts to be blurred for privacy reasons, or create animated GIF images for low-bandwidth users. And if i ever need some of the features, i can easily incorporate them to meet future requirements. Remotely related, so far, i have made over 10.000 videos in my life, and since May 2008, i distributed them across multiple YouTube channels, combined with more than 12 million views.
Having the Pi running for a week results in a video length of around 6 minutes. The encoding takes close to 14 minutes and ends with a size of up to 500 MB. Since i let the headless "Zero W" run without any breaks, except at midnight for creating the zip file, the flow of clouds and stars feels much smoother now. To get this to work, without to crash the Raspberry Pi too often, i made "FreshRSS" only check for new updates every two hours, limited from 6 am to 10 pm. Because at night, the camera job requires a bigger portion of the very few resources of the Zero W, since the "exposure time" is set to be longer, and the ISO is higher. And to reduce noise, i adjusted the compression rate, which makes the file sizes larger too.

Binge watching in mid 2018

As in the last two years, i got me a BitTorrent client "in the cloud" for a whole month again. During the past year, i collected movies and shows i want to watch, just like with a grocery list. Among them are titles that i have already seen some time ago, but i like to have them on my local drive anyway, since i rarely get the chance to have "full access". Especially after i cancelled my Amazon Prime subscription. Good things don't have to be new, and vice versa:I also loaded the latest seasons of all shows i follow. Among them are old titles from my childhood: "Roseanne", "The Simpsons", and "The X-Files". After having fast-forwarded some more recent TV series i wanted to like, i realized there is a lot of trash being released people seem to enjoy. They tell similar stories, just with fancier equipment each time. This is why i almost didn't get any new shows into my current watchlist. Thank you to Martin Noras for recommending "The Expanse" and many other titles to me in the past years:
12 Monkeys, Agents of Shield, Colony, Dark Matter, Doctor Who, Elementary, Game of Thrones, Gotham, Homeland, Jessica Jones, Killing Eve, Lost in Space, Outlander, Roseanne, Star Trek Discovery, Supergirl, The 100, The Crossing, The Expanse, The Simpsons, The Strain, The X-Files, Time After Time, Timeless, and Westworld.

Switching from IrfanView to ImageMagick

After having spent a couple of hours to write several hundred lines of Perl code to block access from certain countries, because of "GDPR", i finally can sleep again, since i have done enough to keep the wildlife out. These people don't understand technology, by choice, to maintain the status quo. Because it can empower everyone, what these politicians don't want. It feels like they have no real ideas, only nightmares and a Ponzi scheme. This will not end well with these kind of priorities: Procrastination makes the hard things even more difficult to solve. Europe has too much overhead, and they love the lag. Especially the Germans and their faulty cars.
This is why i wrote some rules, combined with a "GeoLite2" IP geolocation database by MaxMind, to protect the last survivor of my purge after the burn out: My 10 years old embeddable "chat widget" with an integrated automated management system, without any need for moderators or admins since 2008. Everything based on Perl made from scratch by myself. And the best part: No "personal data" required, since there is no sign up process. I also stopped Apache logging IP addresses. But since i'm not making any money with it, i'm not going to waste time explaining. It's just something i like to keep alive on the internet for fun. Unlike these animals, i know how to create a hobby. And i have never run a web project for that long before. FYI, i'm not into math, but i like Google Analytics anyway.
While getting myself into more PowerShell, i discovered "ImageMagick" again, which i found around 15 years ago. But without a lot of experience with command-line interfaces, i did not much with it, back then. After having now worked with computers for twenty years, i see all these things as Lego bricks. In this year alone, for my time-lapse photography with a Raspberry Pi, i processed over 60k JPEG files with "IrfanView" and a Windows batch script. But now, i wrote the job in PowerShell, and switched to ImageMagick. The image quality is better, which gives "ffmpeg" more bits to work with, for additional details in the highlights and shadows. The performance is otherwise similar for batch editing around 8k photos each week.

Watchdog for the Raspberry Pi Camera

My second Raspberry Pi is now running since more than 63 days without a break, also known as 24/7. It takes a photo at the window every minute, except when it has to do some other jobs, or goes down unexpectedly. But thanks to the built-in hardware "watchdog", the Pi Zero W goes up again automatically. On two occasions, raspistill and the "Camera Module v2" stopped working for no reason, but everything else was still just fine.
This is why i created my own software watchdog exclusively for checking the function of the attached camera: I wrote a "Unix shell script" looking for the latest photo every thirty minutes. And if the JPEG file is older than 240 seconds, the Pi Zero W will reboot to start fresh. I have scheduled this task in the crontab of the root user, as required by "shutdown -r now". Because of this, i did not need to touch the Raspberry Pi physically since at least one month.
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14