{"id":1586,"date":"2021-02-20T08:31:44","date_gmt":"2021-02-20T13:31:44","guid":{"rendered":"https:\/\/teakdata.com\/blog\/?p=1586"},"modified":"2021-02-20T08:31:47","modified_gmt":"2021-02-20T13:31:47","slug":"time-lapse-with-raspberry-pi","status":"publish","type":"post","link":"https:\/\/teakdata.com\/blog\/time-lapse-with-raspberry-pi\/","title":{"rendered":"Science Project Recorded as Time-lapse with Raspberry Pi"},"content":{"rendered":"\n<p>One science project we had for school was to <strong>observe the influence of light warmness over growth of plants<\/strong>. <\/p>\n\n\n\n<p>The scientific method has six basic steps: <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li> State the problem<\/li><li>Gather information about the problem<\/li><li>Formulate a hypothesis<\/li><li>Test the hypothesis by experimentation<\/li><li>Record and analyze the experiment<\/li><li>State the conclusions<\/li><\/ol>\n\n\n\n<p>In order to record the experiment, we have decided to create a time-lapse video taking pictures at 5 minutes intervals. This would allow us to compare the growth of plants in the two scenarios, using cold and warm light.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">List of materials<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>plant tray (with multiple cells)<\/li><li>soil for plants<\/li><li>plant seeds<\/li><li>light source (led light is best, one cold one warm)<\/li><li>Raspberry Pi  (<a href=\"https:\/\/www.raspberrypi.org\/products\/raspberry-pi-zero-w\/\">Raspberry Pi Zero W<\/a> costs 10$, you can use any model with wifi to avoid network cables) <\/li><li><a href=\"https:\/\/www.raspberrypi.org\/products\/camera-module-v2\/\">Raspberry Pi Camera Module<\/a> (or you can use an old web cam attached to the usb port)<\/li><\/ul>\n\n\n\n<p><em><strong>What is Time-lapse<\/strong>? the photographic technique of taking a sequence of frames at specific intervals to record changes that take place over time. When the photos are assembled in a video and shown at normal speed the action seems faster<\/em>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Experiment Setup<\/h2>\n\n\n\n<p>The setup for our project looked like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/IMG_4972.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/IMG_4972-768x1024.jpg\" alt=\"Time-lapse with raspberry pi\" class=\"wp-image-1587\" srcset=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/IMG_4972-768x1024.jpg 768w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/IMG_4972-225x300.jpg 225w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/IMG_4972.jpg 900w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><\/a><figcaption>Time-lapse with raspberry pi<\/figcaption><\/figure>\n\n\n\n<p>Placed each tray on a separate shelf and attached the lights on top of the shelf. Top light warm, bottom light cold. <\/p>\n\n\n\n<p>In order to avoid ambient light interfere with the led light, a cardboard was placed on the side of the shelf.<\/p>\n\n\n\n<p>We have used two Raspberry Pi devices to record each shelf independently. If you have enough space you can place only one camera that can cover both shelfs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Raspberry Pi Setup<\/h2>\n\n\n\n<p>After attaching the camera and configuring the OS on the Raspberry Pi, you are ready to take pictures.<\/p>\n\n\n\n<p>Test that you can run the raspistill command. (<a href=\"https:\/\/www.raspberrypi.org\/documentation\/usage\/camera\/raspicam\/raspistill.md\">see here raspistill documentation<\/a>)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>raspistill -o test.jpg<\/code><\/pre>\n\n\n\n<p>Create a script to start the raspistill in timelapse mode:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano timelapse.sh<\/code><\/pre>\n\n\n\n<p>Copy paste the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>raspistill -o plants-%04d.jpg -tl 300000 -t 1209600000 --rotation 90<\/code><\/pre>\n\n\n\n<p>Note: the above command will take on picture every 5 minutes and a total time of 1.4 days. The rotation parameter was needed to rotate the image at capture time, you can rotate to accommodate your specific setup. (<a href=\"https:\/\/www.raspberrypi.org\/documentation\/usage\/camera\/raspicam\/timelapse.md\">see more details about raspistill timelapse<\/a>)<\/p>\n\n\n\n<p>Save the script and exit, make the script executable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod a+x timelapse.sh<\/code><\/pre>\n\n\n\n<p>Run the script:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nohup .\/timelapse.sh &amp;<\/code><\/pre>\n\n\n\n<p>Sample of pictures:<\/p>\n\n\n\n<figure class=\"wp-block-gallery columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650-1024x768.jpg\" alt=\"Time-lapse with raspberry pi\" data-id=\"1592\" data-full-url=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650.jpg\" data-link=\"https:\/\/teakdata.com\/blog\/?attachment_id=1592\" class=\"wp-image-1592\" srcset=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650-1024x768.jpg 1024w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650-300x225.jpg 300w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650-768x576.jpg 768w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2b-0650.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Time-lapse with raspberry pi<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971-1024x768.jpg\" alt=\"Time-lapse with raspberry pi\" data-id=\"1591\" data-full-url=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971.jpg\" data-link=\"https:\/\/teakdata.com\/blog\/?attachment_id=1591\" class=\"wp-image-1591\" srcset=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971-1024x768.jpg 1024w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971-300x225.jpg 300w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971-768x576.jpg 768w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants2a-0971.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Time-lapse with raspberry pi<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650-1024x768.jpg\" alt=\"Time-lapse with raspberry pi\" data-id=\"1590\" data-full-url=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650.jpg\" data-link=\"https:\/\/teakdata.com\/blog\/?attachment_id=1590\" class=\"wp-image-1590\" srcset=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650-1024x768.jpg 1024w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650-300x225.jpg 300w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650-768x576.jpg 768w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1b-0650.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Time-lapse with raspberry pi<\/figcaption><\/figure><\/li><li class=\"blocks-gallery-item\"><figure><a href=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971-1024x768.jpg\" alt=\"Time-lapse with raspberry pi\" data-id=\"1589\" data-full-url=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971.jpg\" data-link=\"https:\/\/teakdata.com\/blog\/?attachment_id=1589\" class=\"wp-image-1589\" srcset=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971-1024x768.jpg 1024w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971-300x225.jpg 300w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971-768x576.jpg 768w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/plants1a-0971.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"blocks-gallery-item__caption\">Time-lapse with raspberry pi<\/figcaption><\/figure><\/li><\/ul><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Create the video<\/h2>\n\n\n\n<p>In <a href=\"https:\/\/www.raspberrypi.org\/documentation\/usage\/camera\/raspicam\/timelapse.md\">this tutorial<\/a> there are several options to create the video from the pictures.<\/p>\n\n\n\n<p>We have taken a different approach, using iMovie.<\/p>\n\n\n\n<p>In iMovie, import all pictures into project, drag it on the timeline, set the cropping to FIT, select all pictures in timeline and set duration 0.1<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/imovie-timelapse.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"629\" src=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/imovie-timelapse-1024x629.png\" alt=\"iMovie timelapse\" class=\"wp-image-1599\" srcset=\"https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/imovie-timelapse-1024x629.png 1024w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/imovie-timelapse-300x184.png 300w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/imovie-timelapse-768x472.png 768w, https:\/\/teakdata.com\/blog\/wp-content\/uploads\/2021\/02\/imovie-timelapse.png 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption>iMovie timelapse<\/figcaption><\/figure>\n\n\n\n<p> Videos from our experiment:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"Growing plants (sunflower) - part 1\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/bGZbM_MYof0?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><figcaption>Part 1<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"Growing plants (sunflower) - part 2\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/Hhjo7YbelF8?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><figcaption>Part 2<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"Growing plants (sunflower) - part 3\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/omQoZQdX14Q?feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><figcaption>Part 3<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>One science project we had for school was to observe the influence of light warmness over growth of plants. The scientific method has six basic steps: State the problem Gather information about the problem&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1592,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104,10],"tags":[108,107,106,105],"class_list":["post-1586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-photo","category-raspberrypi","tag-photo","tag-plants","tag-raspberri-pi","tag-time-lapse"],"_links":{"self":[{"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/posts\/1586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/comments?post=1586"}],"version-history":[{"count":8,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/posts\/1586\/revisions"}],"predecessor-version":[{"id":1604,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/posts\/1586\/revisions\/1604"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/media\/1592"}],"wp:attachment":[{"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/media?parent=1586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/categories?post=1586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/teakdata.com\/blog\/wp-json\/wp\/v2\/tags?post=1586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}