Jump to content

Raspberry Pi automation


Mr blue

Recommended Posts

I have been playing around with a raspberry pi to try and control/monitor temperature and humidity in a greenhouse, but the same kit and principles could be used in a growroom

 

Kit I have used so far:

 

Raspberry pi zero w £12

large.IMG_20180426_145350720_LL.jpg

 

Dht11 temp and humidity sensor £3

large.IMG_20180426_145426429_LL.jpg

 

5v 4 channel relay board £3

large.IMG_20180426_145405468_LL.jpg

 

Soil moisture sensor £2

large.IMG_20180426_145437312.jpg

 

Cables for connecting everything

large.IMG_20180426_145335821_LL.jpg

 

I am no programmer, but with a bit of googling I found python scripts I could adapt to use the sensors to control gpio pins and thus the relays ( which will then operate fans or pumps) so it is now set up so that relay 1 switches when humidity is over 70%, relay 2 switches when temperature goes over 28°c , and relay 3 switches when the soil moisture sensor indicates dry. Relay 4 is spare( for a growroom it could switch the lights)

I have also installed Cayenne, which means I can control everything and see temperatures etc on my phone from anywhere.

I have had it sitting on my desk for a few days now clicking away, and it seems to be doing what it should, so now I just need to source some suitable fans and get it installed in the greenhouse.

If anyone wants any more info just ask

Has anyone else done anything similar?

 

  • Like 19
Link to comment
Share on other sites

Looked into this years ago and noticed that the Arduino was the preffered hardware. I'm pleased to see folks making progress with the RPi.

  • Like 1
Link to comment
Share on other sites

Hi, I've been trying to avoid going this deep down the rabbit hole as I know almost nothing about electronics.  I don't even know what a capacitor or transistor do!  I used to start sweating over something as simple as rewiring a plug but thanks to the patience and knowledge of @scraglor @Davey Jones et al I'm now having fun making multi variac fan controls and lighting contactors (and none of them have caught fire.... yet!) 

 

I've taken a tentative step using the Sonoff ESP8266 based WiFi switches but the limitations of the eWeLink service that controls them means there's allot they simply cannot do.  They also make me reliant on a cloud based service that's not 100% dependable.  So after trying literally everything else it's finally come down to microcontrollers.  Whoever told me this was the way to go here several years ago and whose advice I ignored, mea culpa.  

 

So with the aid of Google and YouTube I did a little research and finally chose the ESP8266 chip that my Sonoff switches use, but whereas they work almost right out of the box, the ESP8266 based development boards do not.  I've downloaded and installed the Arduino IDE, 8266 libraries and examples and have managed to get the WeMos D1 R1 development board that arrived yesterday to scan for local WiFi networks and connect to my own but I'm still waiting for all my breadboards, cables, LEDs, and whatnot to arrive from China so I'm limited as to what I can do right now.  

large.IMG_1928_01.JPG.d7f859d88ee1110a3f

I'm also going to attempt to flash the firmware of one of the spare basic Sonoff switches to the Tasmota firmware using a serial adaptor but that's another thread.

 

My focus this time is to try and overcome the woeful inadequacies of the Sonoff 4CH, four channel WiFi enabled switches that only allow a total of 8 timing operations per switch using the eWeLink service.  OFF is one, ON is another, which practically means using timeings you can only get them to turn each of the four channels on and off once every 24 hours.    I thought my dreams in that regard had been answered when I spotted a 16-Relay board on eBay for £8 if I could get it to work with a £4 WeMos D1 R1 ESP8266 board I'd be laughing!   I only actually need 9 sockets to control all my lamps but the choice of boards available was either 8-relays or 16-relays so I opted for the latter as it can't hurt to have the option of controlling all my equipment from both the growroom and nursery on a single board! 

 

Coding was obviously going to be a huge headache for me as I've zero experience but I discovered Blynk and although it may cost a me a couple of quid buying widgets and controls developing my own smartphone app it does look to do most of the heavy lifting for you coding wise, plus later swapping from using their cloud based service to your own local Blynk server appears to be relatively simple and could negate the need for all the Home Assistant, MQTT Broker stuff for now.  Which is good because it literally melted my brain the last time I tried to get my head around all that.

 

I did happen to notice my first mistake when the WeMos ESP8266 board arrived, there weren't going to be enough GPIO pins for the 16-relay board.  The WeMos has just 11 I think so I've also ordered a PCF8574 expansion board that uses I2C to give me 8 more.  Now just waiting for parts.

 

If I get off the ground with this the next project I'd like to try is a pH regulator using a pH sensor and peristaltic pump.  I'm trying to think of a way to do it with a EC probe and nutrients too but so far I haven't managed to think of a way to keep the stock nutrient solutions stirred, you simply cannot beat giving the container a good shake.

 

You can expect my cries for help and mutterings of impending doom imminently.   Well as soon as the postman brings the whatchamathingumybobs.

  • Like 7
Link to comment
Share on other sites

Thanks for dropping in @Laphroaig I only went for the pi as I had bought one out of curiosity. I am finding the fact that they are designed as an educational device really handy from the point of view of tutorials etc.

I had not come across blynk before, looks like it could be handy

  • Like 1
Link to comment
Share on other sites

Awesome stuff. Will be keeping an eye on this. A few years ago when first looking into growing, I was thinking of building all my own stuff. But realised it was a lot to learn. Stuff I still havnt learned to this day!

 

Look forward to see how you guys progress.

Link to comment
Share on other sites

Hi

 

I am in the process of making a controller using Arduino mega to measure and report soil moisture and temperature.

I have ditched the soil moisture sensor that you have there as it resistive and puts a small voltage out.

This causes the sensor plates to become coated and then the readings are vastly different to a new shiny sensor.

I left mine in water for a few days taking measurements.

I have since purchased capacitive sensors from Ali baba which seem to be giving consistent readings after being immersed in water for a few days.

 

Hope that information helps.

 

Cheers

  • Like 5
Link to comment
Share on other sites

Like a few others I’ve pulled up a chair for this one.

i have a raspberry pi that’s been sat in a drawer for 3 years and I keep having waves of bong enduced desire to do something with it and at least create a monitor to keep an eye on what’s going on out there, but like you have no clue when it comes to coding. There may be a few questions coming your way when it finally makes it way out of the drawer lol

  • Like 2
Link to comment
Share on other sites

@Micky3651 the best bits of advice I can give for getting started with the pi are:

 

Connect it up to your TV, and connect a USB mouse and keyboard to get it set up. Do not try and set it  up headless first go.

 

Start small, work through tutorials to do really simple stuff like light an led first

 

Learn to use GitHub

 

Modmypi has a lot of excellent tutorials with example code

  • Like 4
Link to comment
Share on other sites

  • 3 weeks later...

Some people use a pi for data logging and display while the arduino does the 'heavy lifting' controlling hardware and reading sensors, it also has analogue inputs, unlike the pi, so if you need those the combo might be something you should consider.

 

I agree with @Mr blue, start using it like a little PC, with keyboard, mouse, and TV. Start small. Join GitHub.

 

Another site with some useful info (you can join if you need to ask questions but I find all the questions I think of already answered I can think of) is stackoverflow.com. It can be a little confusing at the start as it has so many sections (raspberry pi, python, other programming, even role playing games and random questions) but I find it keeps popping up as the top result when I search for answers to do with python. There is a lot of good knowledge in there.

  • Like 2
Link to comment
Share on other sites

So glad someone is doing a journal for this! Such a good idea! I'm planning on doing something very similar once my current and first grow is completed. The dream is to include a webcam in there and hook it all up to an app so I can see a live feed with all the measurements and the ability to control all the bits!

 

Looking forward to this :yep:

  • Like 1
Link to comment
Share on other sites

On 03/06/2018 at 10:51 AM, Biggles92 said:

So glad someone is doing a journal for this! Such a good idea! I'm planning on doing something very similar once my current and first grow is completed. The dream is to include a webcam in there and hook it all up to an app so I can see a live feed with all the measurements and the ability to control all the bits!

 

Looking forward to this :yep:

 

This is also my dream project! Being able to hook up everything to my Pi, watch my plants through a webcam and monitoring the data, all from my phone, would be perfect!

 

Can't wait for an update on this thread :D 

Link to comment
Share on other sites

Not much to report I am afraid! The pi project has been put on one side until I happen across a super cheap (ie free) old android phone to use as a mobile wifi hotspot

I am currently using an Arduino nano to run a solar powered flood and drain. One very important thing I have discovered is that if you don't use a flyback diode on the pump it will kill the Arduino if it is connected to the same power source ( it took me 3 Arduino to discover this, I am a bit of a slow learner)

Link to comment
Share on other sites

On 09/05/2018 at 7:11 PM, Mr blue said:

@Micky3651 the best bits of advice I can give for getting started with the pi are:

 

Connect it up to your TV, and connect a USB mouse and keyboard to get it set up. Do not try and set it  up headless first go.

 

Start small, work through tutorials to do really simple stuff like light an led first

 

Learn to use GitHub

 

Modmypi has a lot of excellent tutorials with example code

 

 

You'd struggle to use a graphical interface on a Pi Zero, they're not really built for that (I've got about 5 of them)

 

I spend most of my days glaring at a terminal, and have used linux for +18 years (ten years free of windows at home, too). If anyone gets really stuck, I may be able to help with specifics with the bash and linux bit. :)

 

 

Love seeing these used here. More of this kind of thing!

Edited by j.o.i.n.t
  • Like 1
Link to comment
Share on other sites

I use an elitech MTC 6040 to control heater, auxilliary extract and intake, and I did have it controlling a humidifier, but that packed up and I haven't bothered replacing. It does a similar sort of job, but it has its limitations. I suspect a raspberry pi solution would be much more versatile. Nice to see it being done!

Link to comment
Share on other sites

16 hours ago, Mr blue said:

Not much to report I am afraid! The pi project has been put on one side until I happen across a super cheap (ie free) old android phone to use as a mobile wifi hotspot

I am currently using an Arduino nano to run a solar powered flood and drain. One very important thing I have discovered is that if you don't use a flyback diode on the pump it will kill the Arduino if it is connected to the same power source ( it took me 3 Arduino to discover this, I am a bit of a slow learner)

 

I've got an old xperia z1 compact. Screen is broken (touch screen doesn't work, not cracked), but you can plug a mouse in and cast it to a bigger screen to make it a bit easier. Up for grabs, message me if you think it'll do the job :)

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