
	{"id":1382,"date":"2024-12-06T12:12:57","date_gmt":"2024-12-06T12:12:57","guid":{"rendered":"https:\/\/mm0zif.radio\/current\/?p=1382"},"modified":"2024-12-07T11:03:44","modified_gmt":"2024-12-07T11:03:44","slug":"ultimate-guide-to-timelapse-automation-with-raspberry-pi-zero-2w","status":"publish","type":"post","link":"https:\/\/mm0zif.radio\/current\/2024\/12\/ultimate-guide-to-timelapse-automation-with-raspberry-pi-zero-2w\/","title":{"rendered":"Ultimate Guide to Timelapse Automation with Raspberry Pi Zero 2W"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\"><strong>Overview<\/strong><\/h4>\n\n\n\n<p>Welcome to the MM0ZIF-WX <strong>Timelapse Automation Project<\/strong>! This lightweight and portable system is powered by the <strong>Raspberry Pi Zero 2W<\/strong>, a <strong>Pi Camera<\/strong>, and a <strong>power bank<\/strong>, making it perfect for outdoor or remote use. The setup is designed to capture high-quality timelapse images, organize them, and automatically upload them to a remote server for safekeeping and further use. In this case I will be using another computer to create timelapse videos but that is for another article.<\/p>\n\n\n\n<p>A unique feature of this project is its <strong>WiFi failover<\/strong> capability. If the primary WiFi network becomes unavailable, the Raspberry Pi seamlessly switches to a secondary WiFi network, ensuring uninterrupted operation and uploads.<\/p>\n\n\n\n<p>The Raspberry Pi OS&#8217;s can be found <a href=\"https:\/\/www.raspberrypi.com\/software\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Here<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>What You Need<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Raspberry Pi Zero 2W<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Compact, energy-efficient, and powerful enough for image processing and FTP uploads.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Pi Camera<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Compatible with the Raspberry Pi for capturing still images.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Power Supply<\/strong>:\n<ul class=\"wp-block-list\">\n<li>A USB power bank for portable operation. Capacity depends on desired uptime.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Storage<\/strong>:\n<ul class=\"wp-block-list\">\n<li>A microSD card (32GB or higher) to store the operating system and captured images.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>WiFi Network<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Primary and secondary WiFi networks for seamless failover.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Software<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Raspberry Pi OS Lite.<\/li>\n\n\n\n<li>Custom Python scripts for timelapse and network management.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Features<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Automated Timelapse Capture<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Captures images every 5 minutes and saves them in a date-organized folder.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Remote Backup via FTP<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Compresses daily captures into a ZIP file and uploads them to a remote FTP server at midnight.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>WiFi Failover Support<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Switches to a secondary WiFi network if the primary network is unavailable, ensuring uninterrupted operation.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Portable and Efficient<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Powered by a USB power bank, the Raspberry Pi Zero 2W offers long runtimes and low power consumption.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Customizable and Expandable<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Easily modify capture intervals, storage locations, or add features like cloud integration.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>How It Works<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Image Capture<\/strong>:\n<ul class=\"wp-block-list\">\n<li>The Pi Camera captures images every 5 minutes and saves them in a folder named after the current date. Now updated from RaspiCam2 to libcam.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Daily Upload<\/strong>:\n<ul class=\"wp-block-list\">\n<li>At midnight, the script compresses the previous day\u2019s folder into a ZIP file and uploads it to a configured FTP server.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>WiFi Management<\/strong>:\n<ul class=\"wp-block-list\">\n<li>The Raspberry Pi checks connectivity to the primary WiFi network.<\/li>\n\n\n\n<li>If the connection fails, it automatically switches to a per-configured secondary WiFi network to maintain upload functionality.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Portability<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Powered by a USB power bank, the setup can operate in remote locations without reliance on a fixed power source.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Setting Up WiFi Failover<\/strong><\/h4>\n\n\n\n<p>To configure WiFi failover, the Raspberry Pi&#8217;s <code>wpa_supplicant.conf<\/code> file is set up with multiple network configurations:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>country=UK<br>ctrl_interface=DIR=\/var\/run\/wpa_supplicant GROUP=netdev<br>update_config=1<br>network={<br>    ssid=\"Primary_Network\"<br>    psk=\"Primary_Password\"<br>    priority=1<br>}<br>network={<br>    ssid=\"Secondary_Network\"<br>    psk=\"Secondary_Password\"<br>    priority=2<br>}<br><\/code><\/pre>\n\n\n\n<p>The network with the highest priority (<code>priority=1<\/code>) will be used first. If unavailable, the Pi switches to the next available network.<\/p>\n\n\n\n<p>This as you can imaging will work with both fixed and hotspot wifi.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Hardware Setup<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Attach the Pi Camera<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Connect the Pi Camera to the Raspberry Pi Zero 2W using the appropriate camera ribbon cable.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Power the System<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Connect a USB power bank to the Raspberry Pi\u2019s power input.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Network Configuration<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Configure WiFi failover using the method described above.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Run the Script<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Upload the provided Python script to the Pi and run it to start capturing images.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Software Setup<\/strong><\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Install Required Libraries<\/strong>: Run the following commands to install dependencies: <code>sudo apt update sudo apt install libcamera-apps python3-pip pip install schedule<\/code><\/li>\n\n\n\n<li><strong>Download and Configure the Script<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Clone the project repository:<code>gh repo clone TheLich2112\/PiPicFtp<\/code><\/li>\n\n\n\n<li>Edit the script to configure FTP credentials and storage paths.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Run the Script<\/strong>: Start the script manually:<code>python3 <a href=\"https:\/\/github.com\/TheLich2112\/PiPicFtp\/blob\/main\/pipicftp.py\">pipicftp.py<\/a> <\/code>Or set it up as a service to start automatically at boot.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Example Use Cases<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Nature Timelapse<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Capture stunning sunrise-to-sunset sequences in remote locations.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Construction Monitoring<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Document the progress of long-term projects.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Weather Observations<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Use the setup as part of an automated weather station.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Expandability<\/strong><\/h4>\n\n\n\n<p>This project is a foundation for further enhancements:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Cloud Integration<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Replace FTP uploads with cloud services like Google Drive or AWS S3.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Solar Power<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Add a solar charging setup for long-term outdoor use.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Environmental Monitoring<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Incorporate sensors to log weather data alongside images.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>In my case the powerbank I am already using has a Solar recharger build in. I have yet to test its efficiency, but I will report back on that matter.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Sample Output<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"450\" src=\"https:\/\/mm0zif.radio\/current\/wp-content\/uploads\/2024\/12\/image_12-14-43-600x450.jpg\" alt=\"\" class=\"wp-image-1386\" srcset=\"https:\/\/mm0zif.radio\/current\/wp-content\/uploads\/2024\/12\/image_12-14-43-600x450.jpg 600w, https:\/\/mm0zif.radio\/current\/wp-content\/uploads\/2024\/12\/image_12-14-43-300x225.jpg 300w, https:\/\/mm0zif.radio\/current\/wp-content\/uploads\/2024\/12\/image_12-14-43-768x576.jpg 768w, https:\/\/mm0zif.radio\/current\/wp-content\/uploads\/2024\/12\/image_12-14-43-1536x1152.jpg 1536w, https:\/\/mm0zif.radio\/current\/wp-content\/uploads\/2024\/12\/image_12-14-43-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h4>\n\n\n\n<p>This project showcases the versatility and power of the Raspberry Pi Zero 2W in creating a portable, reliable, and automated time-lapse system. With features like WiFi failover, remote backups, and easy customization, it is an ideal solution for hobbyists, researchers, and professionals alike.<\/p>\n\n\n\n<p>For more details or to get started, explore the <a href=\"#\" target=\"_blank\" rel=\"noopener\" title=\"\">GitHub repository<\/a> or reach out to <a href=\"mailto:marcus@mm0zif.radio\" title=\"\">Marcus<\/a>.<br><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ultimate Guide to Timelapse Automation with Raspberry Pi Zero 2W<\/p>\n","protected":false},"author":1,"featured_media":1383,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"give_campaign_id":0,"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","omw_enable_modal_window":"enable","osp_disable_panel":"default","osh_disable_topbar_sticky":"default","osh_disable_header_sticky":"default","osh_sticky_header_style":"default","osh_sticky_header_effect":"","osh_custom_sticky_logo":0,"osh_custom_retina_sticky_logo":0,"osh_custom_sticky_logo_height":0,"osh_background_color":"","osh_links_color":"","osh_links_hover_color":"","osh_links_active_color":"","osh_links_bg_color":"","osh_links_hover_bg_color":"","osh_links_active_bg_color":"","osh_menu_social_links_color":"","osh_menu_social_hover_links_color":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[37,128,140],"tags":[153,125,151,150,152,149,57],"class_list":["post-1382","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics","category-home-automation","category-rpi","tag-code","tag-learning","tag-photography","tag-pi","tag-picam","tag-raspberry","tag-timelapse","entry","has-media"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/posts\/1382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/comments?post=1382"}],"version-history":[{"count":0,"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/posts\/1382\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/media\/1383"}],"wp:attachment":[{"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/media?parent=1382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/categories?post=1382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mm0zif.radio\/current\/wp-json\/wp\/v2\/tags?post=1382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}