Jump to content

Raspberry Pi Growroom Camera using Motioneye


Flamedodger

Recommended Posts

Lockdown Project

So I've been playing around with Raspberry Pi computers for a while now, building various tech gadgets for around the house. I have a 'pihole' which filters adverts from my household internet, great when looking at local news sites often overwhelmed with ads, also I connected an amp Hat to a pi and connected some ceiling speakers in my kitchen to create an airplay music server, which means you can use your iPhone to play music over the speakers.

After setting up my grow tent and having an LED light, which are excellent for taking photos under and having a few redundant pis, I decided to make a cam to either view or take photos to put together for a time lapse. 

I won't call this a 'tutorial', more how I achieved it, if you're interested read on.

 

large.5eed0d7f1ae9b_Annotation2020-06-19194519.png

 

Equipment and costs.

Raspberry Pi Zero W £10 (pihut.com)

Camera Module for Raspberry Pi £24 (pihut.com)

Power supply plug £8 (pihut.com) Any old phone charger will do for this provided it has micro USB port that will plug into the pi.

Micro SD card £10.50 64Gb (amazon)

Pi case from the pi hut, look for one for your model that is designed for a pi cam

Micro USB to USB converter (only if using RP Zero)

Extras not included in build;
A PC/laptop/mac
A monitor or TV
A PC keyboard
An internet connection
SD card reader if your PC/laptop doesn't have one

 

Starting off

First we have to format the SD card and install the Raspian operating system. Thankfully this as simple as downloading the Raspberry Pi Imaging software 
https://www.raspberrypi.org/downloads/

Choose the version for the computer you are using Windows, Mac etc.
Insert your micro SD card into a card reader on your computer. Open Raspberry Pi Imager and create your bootable operating system. When finished it will tell you to remove your sd card.

Note: 
For my build I used raspian lite, this has no graphical user interface, I would recommend using this for any Pi other than a Pi 4, due to hardware limitations.

Insert the sd card into the card slot on the pi, at this stage I leave the pi out of the case. Attach the camera to the pi (there's a link at the pi hut for this),the keyboard to the usb port, hdmi lead into your monitor and plug the power lead into the pi. Turn on the electric supply.
You should see lots of stuff scrolling on your screen, this is normal.
When the Pi has finished booting you will get to a login screen, the username is pi and the password is raspberry (raspi default).
Log in.
Type the following in the 'terminal';
sudo raspi-config


Using arrow keys enable the following;
camera
ssh
rename your pi, I called mine growcam
choose you network country GB
add you wifi i.e, SKY12345
and add your password for your wifi
Complete the configs and press finish.
Type sudo reboot to restart your pi.


Login with your new credentials.

Test your cam
In the terminal type sudo raspistill -k
This should create a photo in your home folder
Type in terminal; ls (this will list your home folder)
You should see test.jpg listed, your camera is working.

If you see the message;
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Your camera ribbons are not connected properly, or they're fucked! 
If cam is working, we should update the system. In terminal type;
sudo apt update
Let it do its stuff, then;
sudo apt upgrade
Roll a doob, make coffee, this will take some time.

 

MotionEye 

We need to install some software for our camera, the software we'll use is called MotionEye. We are using a linux OS, so installing software is not like windows and does require some configuring. We shall be using terminal commands and install this remotely from your laptop/PC, this is what we enabled ssh for earlier. If you are using windows, you will need software for ssh, for this I recommend BitVice.
I am going to assume you have changed your pis network name to something else, as I said before you can call yours something else, just don't use spaces. If using Windows type in bitvice terminal;
ssh pi@"yourpiname".local
If this doesn't work, go to your pi and type in terminal;
ifconfig
Look for an ip address, normally staring 192.168.0.*** or 192.168.1.*** 
Go back to the terminal on you PC/Laptop and type;
ssh pi@whateveryouripis
Replacing whateveryouripis with the ip gleaned from ifconfig.
This should prompt you for a password, use the password we changed with raspi-config.
Hopefully you will have logged in to your pi remotely.


Follow this guide to install MotionEye on a raspberry pi;
https://github.com/ccrisan/motioneye/wiki/Install-On-Raspbian
This installation worked great for me and is packed full of features.
I would recommend having a good ganders before getting stuck in.
I would say doing sudo -i is a benefit, you can simply highlight the text on the install wiki and paste it straight into the terminal, started through ssh remotely.

 

Pros are;
Motion controlled video recording - Ideal if your want surveillance.
Android and iPhone apps available.
Timelapse feature
Multiple camera control from one user interface.
FTP to network locations (A great feature, my Timelapse uploads straight to my network storage device, the sd card can fill up quickly)


Cons are;
Not straight forward to install for those not used to linux commands

Streaming over wifi is a bit limited
As yet I've not been able to view over the internet, I'm trying to achieve this using dynamic dns.

 

 

Future plans

I would like to take this on a stage now and get some sensors working sending info to the pi and presented on a web ui. I've got my eye on a temperature and humidity sensor that can do this and maybe looking at an EC and PH sensor for my nft system. This would be handy tech if you're growing in a loft.

I'll keep you posted.........if you made it this far without phasing out. Cheers :smokin:

All software used is free to use under GNU licences thingomy law stuff.

  • Like 15
Link to comment
Share on other sites

well done bro and an excellent run through

great quality pic for a £24 camera much clearer than I expected :yep:

  • Like 2
Link to comment
Share on other sites

45 minutes ago, Intense Nutrients Matt said:

well done bro and an excellent run through

great quality pic for a £24 camera much clearer than I expected :yep:

You can use higher res settings but the pi zero w only has a wifi connection and sending over it is asking a bit much. A pi3 or 4 has Ethernet, that would be ideal.

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Further research done. Motioneye is available as an addon for Home Assistant software, so if you're looking at automation you can fully in corporate surveilance into it :yep:

I'm looking at environment sensors for the next stage. I'll update when successful.

 

 

  • Like 1
Link to comment
Share on other sites

Please do. Together we will save a bunch of work. 

 

I can get to my lockdown stuff from this Monday and so I'll be adding from then. :)

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Looking to do something like this myself but more to keep monitoring tent/res temps humidity etc. Anyone know any good quality (and accurate) sensors?

Link to comment
Share on other sites

4 hours ago, JPE1234 said:

Looking to do something like this myself but more to keep monitoring tent/res temps humidity etc. Anyone know any good quality (and accurate) sensors?

I think the Trolmaster system offered by @diyleduk might do what your after?

https://diyleduk.com/collections/trolmaster-controllers

 

Check with @Diyleduk Craig or Adam, they'll be able to tell you.

 

Best of luck getting what you're after :yep:

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Update

I’ve been researching and testing temperature and humidity sensors and made a bit of a breakthrough. Things are still ongoing, but I’ll try and explain how I achieved it. You’ll need to have a basic understanding of GitHub for Home Assistant, but the sensors work great from your phone, so no PC required.

Devices

Xiaomi Temperature and Humidity Sensor

Xiaomi Hub £18 off cheapo Chinese website.

Meross Temperature and Humidity Sensor and hub £36

Merross Wireless Plug x 2 £14


Target

Since I started this thread, I’ve added a 60x60x120cm Clone/mother plant tent with a cfl in. Joined to the grow tent via some ducting, I upgraded my fan to an ac infinity for this.

Mums/clones sit on a heat mat, which warms the space when lights are off and keeps roots warm. 

In my grow tent I have a 500mm tube heater 180 watts. 

What I wanted to achieve at first, was data to check and make changes afterwards, but things spiralled lol and I went after getting control of temps, especially suffering from budrot in the last hydro grow.

 

Research

Basically bought a cheap Xiaomi temp and humidity sensor from Chinese website and tested.

Changed brand to slightly less cheap Chinese brand Meross (only available on the big river site) tested then bought plugs and tested them.

 

Results

Xiaomi T/H sensor and hub;

Had to learn Cantonese to install this, it only logs in if you use the Chinese shop, If you can get through the install it works excellently and is pretty accurate. Unfortunately they don’t make UK plugs. So this will be as far as I go with this and will just monitor my shed. The app is good and integration into Home Assistant was straight forward.

The Meross is more expensive and I would have thought the build quality would be better, but at the mo I have 3, 1 works ok, 1 is fucked and one a bit intermittent. A little concerning but sticking with it.

What I do like about the Meross stuff is the plugs are independent of the hub and sensor, so you can use them as timers. The set up was easy all done from your phone. 

large.6A40B2CB-D3FB-4EAA-A3BE-3B9EE90BC4A9.png

 

Simple to set up an automation;

large.3FA7EE2E-4B9D-472C-A550-0D6B638BAA34.jpeg
 

large.6737FB8D-D792-4EC5-864F-8A0AEB6DE39C.jpeg

 

 

HomeAssistant

large.A35BA9EC-9C1F-4DCC-910C-178B3B06A3EB.jpeg

 

All devices have been integrated into Home Assistant and automations can be done from there. I may do a run through of HomeAssistant, but unless you’re a geek stoner like me it’s probably not relevant. I’ve got this altogether for another run in the NFT, so it’ll all be a good test of reliability and continuity. I’ll do a conclusion at the end of the grow and hopefully put up some stats :yep:

  • Like 3
Link to comment
Share on other sites

Just a small update. If you use HomeAssistant, you can tie in hardware sensors to work with other wireless plugs etc. I have my Xiaomi sensor working a Meross plug, that’s usually impossible with the proprietary software and apps :yep:

Link to comment
Share on other sites

On 19/06/2020 at 7:40 PM, Flamedodger said:

If you are using windows, you will need software for ssh, for this I recommend BitVice.

 

SSH is native in powershell these days, no need to install anything - unless, of course, the windows user wants to :)

 

 

 

On 19/06/2020 at 7:40 PM, Flamedodger said:

As yet I've not been able to view over the internet, I'm trying to achieve this using dynamic dns.

 

ngrok might be useful here, as an alternative. Worth knowing about anyway :)

 

https://ngrok.com/

 

 

 

 

Cool thread :) Just some thoughts that popped up in my head, thought I'd share.

Link to comment
Share on other sites

Well I think I have taken this as far as I can for a while, if anyone wants to take it on a notch, keep me posted.

Here's a quick breakdown of my Home Assistant dash board;

large_HAS.png

 

Added the video feed from the pi camera. You can see the 2 humidity sensors in the screenshot, I have them together as I am calibratiing the Meross with the Xiaomi as it is more accurate, the data can be seen in the Grow Tent card. You can see the dodgey sensor in the Mother Tent card, I will be sending that one back  soon. 

If you rigged your pi up with a touch screen, each card when touched would give you more data, graphs of temp humidity etc even the weather for all the GG's out there :) The pi music server is amazing our kitchen is definitely the party room in this house. 

I've noticed our smart energy meters are zigbee compatible, when they can fix the bloody things I might try putting that on there. Oh and the living room lamp goes on when the sun sets, not the same time every day :D

Well thats all folks, if I can help anyone else out tag me in your post :yep:

 

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use