DIY DIY Timelapse Camera : Pi-Lapse

Joined
May 15, 2013
Messages
288
Reputation
0
Reaction score
69
Points
0
Just starting out on my latest project, a timelapse system for shooting some stunning vids of my plants growing.
I did a little time-lapse last time round which was nice but I had some ideas on how to do it better next time ;
http://www.youtube.com/watch?v=ElwBn52pXSQ

Some of the issue was that beyond a week or so in, I switched to LED grow lighting and this saturated my poor little IP camera that was configured to take the shots. Also the res on that thing is quite poor.

Well, this time round Im going to build up a kit specifically for the job, and its something you might be able to reproduce at a reasonable cost and effort, so I'll blog it along the way. This one is a quick-turn btw, not like my grow controller project, so, we'll make use of standard modules and stick them together and configure it up.

By the end of it Im expecting HD images from up to 3 angles, one that pans out with the growing plant, another to close up on the top bud, don't know what for the third yet :)

Heres the kit I identified to do the job and arrived today ;

Raspberry Pi Model B (512MB) + Pi Camera Module £54.90
8GB SD Card with Raspian Wheezy OS Preloaded £6.80
Raspberry Pi Clear Enclosure £2.80
2 x SSR Relay Heatsinks £11
2 x FOTEK SSR-25 DA , 25A Solid State Relay £9.80

TOT £85.30

I should mention a few other bits are required but I have those to hand so no need to order. Power supply, a 2A micro USB power supply, Ethernet cables, HDMI cables, a spare USB hub and USB keyboard & mouse, and a HDMI monitor. Most of that stuff will be needed only for the setup and testing, later we will leave the R-Pi to run by itself without most of this stuff.

I think I could make use of a spare USB HD webcam maybe even two, and have this thing taking several timelapse vids from >1 angle. I'll focus first cam on the whole plant and another up close to the top bud.
OK so not bad on spend so far. For what it'll do I think its good anyway, not so long ago this would have required a spend of thousands im sure.

1.JPG2.JPG3.JPG

Im going to put together an easy to follow guide for this I think, bet you guys could do some amazing shots with something like this.
 
Do you have much experience with the Raspberry Pi? I have some Pi gear and I have a small electronics workshop in my basement where I also work on Arduino and automation stuff :stylez rasta smoke: If you ever want to put some heads together for knowledge; I'd be game! I love working on these little gadgets Hop digity . Maybe we could be the first ones to come up with a synced graphic equalizer that blinks your grow LED's to the beat of music playing. Hahahaha! :D:
 
just getting started with the Pi to be honest. But I have done some stuff before with ARM Linux on some embedded platforms as well as openwrt style router hacking in the past so I think this will be a similar challenge.
nice to know you got some background with that, Ill be sure to give you a tap if I need to confer, otherwise keep track and drop me ideas as we go!
also check out my other thread, bit of a longer journey but you might find interesting : https://www.autoflower.org/f28/diy-ec-meter-22746.html
 
actually vaporhaizer - do you have the camera module also, and a usb webcam?
If you like why not join in the fun, im sure it'll be useful having you on board.

The plan so far is this, get the package to get the native cam up and running, figure the shell cmds to grab the image and store to timestamped jpeg. same with the webcams.
then figure the output drive to the two SSR's to control white and LED lighting - the system will control the lighting to take the shots under white light for best effect, then switch back to the grow lighting.
Also I need an ON AIR lamp and a PAUSE button so I can stop it from putting us in the shot when tending to the plants!
wondering if "mencoder" can do a daily job of creating the video timelapse on-board, and if samba is possible so those pics / vids can be cleared out over the network ad hoc. This would make it more self contained, rather than just grabbing images and then needing other PC SW to turn it into the timelapse movie.
As your probably aware timelapse on the pi has been done before so there is some info out there already that I can tweak into exactly what's needed in this specific application.
Part of the fun will be the fact this should be able to capture start to finish in one continuous video, so once its set up to go, I don't want to fiddle with it really. So testing it well would be good.

I reckon some shell scripting and combination of some CRON jobs and we might be nearly there.

I'll check in with the progress later!
 
Ok things are getting up and running! the Raspberry Pi is a great little thing really.

I connected the board up, HDMI to my TV for the moment, LAN, USB hub with mouse and keyboard. I also attached the Pi's camera module on, inserted the SD card which is pre-loaded with the operating system "raspian wheezy".
Time to power up
icon_e_smile.gif


The R-Pi boots up looking like a typical Linux startup, then you're hit with a menu about the install.

4.jpg 5.jpg

We need to make some setup here. Go to the internationalisation settings and correct the locale and timezone, keyboard layout if needed. I went with en-GB and London timezone, standard 105key layout.
Back in the main menu, use the enable R-Pi camera support option
Then expand FS to fill the card (option 1)
Also, enable boot to desktop.

Go to advanced options, change the hostname to "pilapse" and enable the SSH interface in case we need it later.

Fine so far then in the menu go to finish and select to reboot the Pi.

After the restart it will load the GUI and things look a bit prettier :

6.jpg

Great, time to test the camera module we've got plugged in. The software needed for it is already on the raspberry pi, so all we need is to see it work. Open the LXTerminal , we have to type some commands.
Also open the File Manager (icon near bottom left) and leave that around, it open in default at your home folder, we'll try to take some snapshots in a second, we'll see them appear here and be able to open and check.

In the LXterminal, issue this command ;

>raspistill -o test.jpg -w 2592 -h 1944

It does its thing and an image appears in the folder we've got open. The camera module is 5 mega pixel, so it has a pretty decent 2592 x 1944 resolution. So far so good.

8.jpg

Next up is to see that the Web cams I want to use in addition can do the same. I have two sat here, a SWEEX WC061 and a Microsoft LifeCam HD-5001. These are now plugged in.

7.jpg

In the LXTerminal issue this cmd and see if the devices are picked up OK ;

>ls -l /dev/video*

I can see
/dev/video0
/dev/video1

9b.jpg

these are the two webcams. time to install a software which can take the snapshots for us. we will use the fswebcam package, it is installed from the internet so make sure you are connected.
install the software ;

>sudo apt-get install fswebcam

now we can test taking some snaps :

>fswebcam -d /dev/video0 -r 640x480 testWC1.jpg
>fswebcam -d /dev/video1 -r 640x480 testWC2.jpg

10.jpg

We have a couple of snaps now from the webcams in the same folder, nice.

Now double checking the specs on my assortment of camera's

Raspberry Pi Camera Module : 5 megapixel : still res 2592 x 1944 : fixed focus
Sweex WC061 : 2 mega pixel : still res 1600 x 1200 : manual focus ring
Microsoft HD-5001 : still res 1280 x 960 : auto focus

All three have different qualities so might be good or bad depending on the type of sequence you want to take.
Time to test the webcams at their full spec ;

>fswebcam -d /dev/video0 -r 1600x1200 testWC1.jpg
>fswebcam -d /dev/video1 -r 1280x960 testWC2.jpg

Now we are able to collect the snapshots, the raspberry pi made that pretty simple. other webcams should work same way. Next is to get the SSR relays working from the Pi then these things automated
icon_e_smile.gif
 
Ok peeps next update, I have now connected the extra hardware that we need - the relays to control the lighting, an LED so we know when its "live" , and a switch to stop it being live (so we dont get caught in shot).
The relays we have are solid state, they are electronic versions of the relays you might think of. They can control large loads and don't have actual physical contact to switch, arc over and over with a regular timelapse and eventually fail. the other good thing about them is that they take a low voltage and current to switch them on, so in this case the IO of the R-Pi is directly driving them, no extra relay driver circuit needed for you. so connecting this stuff is mainly just cabling, nothing too severe.

To do it I connected to the Raspberry Pi's P1 interface, where there is some I/O pins we can use. I have connected like this ;

P1 - pin 4 , +5V VCC, in case we need it.
- pin 1 , +3.3V , we'll need this to run the switch off at least, since R-Pi does not tolerate 5V input.
- pin 18 - GPIO24 - this connects to a latching switch, push turns on, push again turns off etc. The other end of the switch connects to +3.3V. So the switch is between pin 1 and pin 18
- pin 22 - GPIO25 - this connects to anode (long leg) of an LED to show the "live" status. I used a blue LED and put a 47 ohm resistor in series.
-pin 24 - GPIO8 - this connects to the first SSR's + input on the low side.
-pin 26 - GPIO7 - this connects to the second SSR's + input on the low side.

-pin 20 - GPIO23 - connected it while I was there, maybe could be used to drive some power white or IR led's , perhaps during the darkness hours the timelapse can continue without disturbing the plants too much?

Heres how it looks now at the Raspberry Pi end ;

11.jpg

the cable used was some 8 core alarm cable. This is the other end wired into the relays, LED and switch ;

14.jpg

You can see the LED is ON and so are the Relays, since I took the shot after testing. There is nothing plugged in their high side yet, but the LED's on the SSR's shows the status.

Next to interact with that stuff. I will rely on the Kernel driver for the GPIO, it means we can do it with the similar commands in LXTerminal like before.

To setup those pins we used for use, we need to configure them and set their direction as so

>sudo su (get root permission otherwise next commands will fail)

>echo "7" > /sys/class/gpio/export
>echo "8" > /sys/class/gpio/export
>echo "25" > /sys/class/gpio/export
>echo "24" > /sys/class/gpio/export

>echo "out" > /sys/class/gpio/gpio7/direction
>echo "out" > /sys/class/gpio/gpio8/direction
>echo "out" > /sys/class/gpio/gpio25/direction
>echo "in" > /sys/class/gpio/gpio24/direction

Now we are ready to use those IO. First lets try read the switch ;

>cat /sys/class/gpio/gpio24/value

toggle the switch and re-run and confirm the returns value changes.

Finally lets switch on the SSR's and the indication LED to verify all is working OK ;

echo "1" > /sys/class/gpio/gpio7/value
echo "1" > /sys/class/gpio/gpio8/value
echo "1" > /sys/class/gpio/gpio25/value

Heres what it should look like ;

15.jpg


Gonna have to call it a night there but that's not a bad place to leave it. Most of the immediate HW challenge is done I think, next some software config will get us taking the timelapses , and other cool stuff. Looking pretty good so far.
Glad I finally found a reason to get acquainted with the raspberry pi, im growing to like this little gem very quickly :)
 
Dude. Loving it. LOVE IT. The details, the pictures, I feel like I could step by step recreate this based on your instructions here. Reading all this and looking at your pictures makes me just want to geek OUT :High 5:

I dont' have the camera module; it's been sitting in my Ebay cart for about 6 months now. I've been waiting to pull the trigger on that order for awhile but I just put in a huge seed order and then spend a pretty dime on growing medium and long story short; I have this periodic episodes where I black out in front of my computer with my credit card in my hand and days later, cool stuff mysteriously shows up at my doorstep. :X's Evil Laugh x: If that showed up at the door though; I'd be sleeping on the couch for a week :No:

I started scrapping together what I have to recreate this; I found out my damn cats decided to bat around bunch of sensors and resistors and it took me forever to find my parts! One of my cats had advanced gum disease and every tooth in his mouth fell out; so he likes to gum the sleeves on the wires I have spread everywhere (or that he spread everywhere, rather.)

While I dont' have the pi cam; I do have an old Intel web came (from the 90's, pretty sure max resolution is 640x480.) I also have a Microsoft Life Cinema Cam 720p; but it looks a little iffy on the Raspberry Pi compatiblity list. Are the non-pi USB web cams being powered directly by the Pi, or do you have them plugged into a powered USB hub? I don't have the solid state relay, but I do have an 8 channel mechanical relay so I think for intents and purposes I could make it work.

Have you considered a pan/tilt servo to move the camera's around? This is where the Arduino stuff gets pretty neat; they make a board call IOIO (pronounced "yo-yo") that allows you to interface with Android devices and control electronics from your phone or Android tablet. Actually, now that I type that out, that sounds like that could be a security issue with a grow tent. :Stones slap: Well... it's cool I guess if you're not using it to have "eyes" on your plants hahaha! BUT, I digress... You could install blue tooth, X-Bee modules (802.15.X wireless 2.4 ghz modules, or you can get special 802.11.b/g/n modules to interface with your home wireless network,) or RF modules and built a control board with like a set of potentiometers on them. I'm not super familiar with SSH; does that allow you to remote into the Pi from a PC and pull the image files? If that's the case; you could view the images and control the cameras without ever being in the tent.

I'm going to try getting some of this going tomorrow and I'll try to get some pics up to see if I can recreate it. Excellent idea and excellent guide to do it. I read your DIY EC Meter; I laughed as I read it because of this:
https://www.autoflower.org/f5/vapor...mated-robotic-growing-aarg-journal-20983.html

"You may say I'm a dreamer, but I'm not the only one."

:slap: Slap hands!
 
Back
Top