Friday, December 1, 2017

GrowLapse - Raspberry Pi Time Lapse Box

Email: yieldtekco@gmail.com

YouTube: youtube.com/channel/UCD5ncv9WJL54GHfxjNpeNNA

Live Stream: twitch.tv/hightekgrow

Github: github.com/YieldTek

Discord: discord.gg/xgmGyE6

Website: yieldtek.com

Facebook: facebook.com/yieldtek

Twitter: twitter.com/HighTekGrow

Reddit: reddit.com/r/hightek/

Support YieldTek: patreon.com/hightek

Donations: paypal.me/atarimaster

 

 

[ Materials ]

 

[ Preparing Your Pi ]


    The first thing w are going to need to do is go over to the Raspberry Pi website and download the latest version of the Raspbian operating system.  You can head over to the download page and download the latest Desktop version of Raspbian.  Once the download completes unzip it and you should have an 'img' file.
    Now we need to insert our Micro SD card into our PC and prepare to flash the Raspbian onto it.  For flashing the operating system we will use the program Etcher.  Etcher has installer for Linux, Mac and Windows and every version will low exactly like the images below.  Once we have etcher installed open it up and you should see the screen below.


    Click the select image button and navigate to the 'img' file we downloaded in the previous section of the instructions.  Make sure that you select the 'img' file and not the zip archive.  Once you have selected you image it will show the name under the little plus icon where the button was previously.  Ensure that the second section is showing the correct card that you would like to use for your Pi.  Etcher will wipe your drive so it is very important that you verify that the section shown in the image below is showing the specific Micro SD card you want to use for this project.


    Once you have verified you are wiping the proper card click the flash button.  It should turn orange telling you that the flashing has begun and show you its current progress as shown in the image below.  I have also attached a picture of Etcher after it has successfully written your operating system to the micro SD card.  When you see the bottom picture below you are ready to insert the card into your Pi, plug everything in and move onto the next section!




[ Setup Our Environment ]


    Now that we have our Raspberry Pi setup and running we need to do a few things to prepare our operating system for installing our time lapse software.  The first thing we want to do is connect our pi to our wireless or wired network in order to give it an internet connection allowing us to download everything we need to finish our setup.  You can either connected a LAN cable to your Pi or click the WiFi icon in the top right hand menu and connect to your wireless network.  Next we want to open up our terminal and run an update on aptitude in order to make sure all our repositories for aptitude are up to date.  To accomplish this run the command below.


    Once we have apt up to date we need to upgrade the version of node installed on our Pi to make sure Ember plays nice with our system.  We can accomplish this using the commands below.  The first command will move you into your home folder, the second removes the old version of node from our system.  Next we download the latest version of node for ARMv7 onto our pi.  We then unpack the node package and in our final lines we are creating symbolic links for our new node and npm into our path so we may use them without specifying the full path every time.  Note that your home folder and node download path pay be different.  If they are replace the paths in the commands below.




  Our final step in preparing our Raspbian operating system is installing tmux.  I love tmux and use it to run my programs.  On this note I do suggest using systemd and pm2 to run this in a more production like setting but for me tmux works great and it is super quick and easy to setup.  We will also install python-opencv as this is required for our Pi being able to access our webcam and snap pictures.  Run the command show below to install tmux an python-opencv on your Raspberry Pi.

[ Installing The Server ]


    Now that we have everything setup and ready to go its time to clone, setup and run our time lapse server.  The first thing we need to do is clone our source code from GitHub.  We can do this using the following command in our terminal.  The following commands will start a new tmux session, change us into our home directory, clone our source code and the enter the directory we just created with our Python code.

    Now that we have our code and we are inside of our server directory we need to run the command below to install all of our dependencies.

    Once the install finishes you can run the command below to copy over the template database and start the server.  Below that I have added an image of what the terminal should look like after starting the server.


    Now that we have the server running you can either hit Ctrl + b, then D in order to end the tmux session and go back to your main terminal.   This will keep the server running in the background and you can go back to your session at anytime using the command below.  You may also just open another terminal and run the client there is you would like.

[ Installing The Client ]


    In order to get our client up and running we need to clone the repo into our home directory.  We will then enter the directory and use npm to install our dependencies.  Once that is complete we run the command to tell the ember client to serve our site so we may access it.  The commands below will accomplish these tasks in the order explained.  I have added an image below of what you will see after the ember cli has started your server and your client is ready to go!


    Once you see this green text you are ready to go!  Fire up your web browser on your pie and navigate to http://localhost:4200/.  This will bring you to the page where you can create and manage your time lapses.  The play button also allows you to preview your time lapse at anytime, it will update it on the fly with the current images it has at the time you hit the button.  This means if you hit preview and then wait a few hours and hit it again you will get a longer preview the second time with more images.  The images below show you the main screen with and without any time lapses as well as the creation screen.






[ Demo Time Lapse ]

    Below I have added a demo GIF from the system.  Keep in mind as you peer below the quality is due to me using a really cheap webcam and not configuring it at all, not the system.  A good webcam will look great and in the case of an indoor grow tent I have noticed you need to adjust the white balance and gamma to make it look really nice.


No comments:

Post a Comment