Page 1 of 1

Noob Green House Automation

Posted: Sat Jan 30, 2016 4:22 am
by 52trea2
So i'm attempting to automate my green house but i'm not sure how. I'm fairly competent when it comes to programming but my issue is I don't know what hardware I will need for this project. I've searched quite a bit but just ended up more confused. To give you an idea of what I need here is a list of what I want it to do.
  • Function as a cycle timer 1min/4min for a 120v and .3 amp pump
  • Control the fans
  • Check temperature and humidity
  • Control a pump for misting and watering
  • Turn the lights on and off
So I'm thinking what i need is a contact of some sort for the lights pumps and fans. For the temperature will the DHT11 or DHT22 work?

Re: Noob Green House Automation

Posted: Sun Jan 31, 2016 2:58 am
by Goraxium
The DHT11 will work fine, as long as you can keep it somewhere where it won't be soaked in water (which may be a struggle if you plan on misting everything).

As for the rest of it, check out relay boards with opto-couplers, like this one: http://www.ebay.com/itm/8-Channel-5V-So ... 1989122045 (or you can go for electromagnetic relays). You should be able to bridge the active and neutral on everything, as long as the overall current draw isn't excessive.

Keeping in mind that you're going to be spraying water around this thing, your biggest concern is getting everything wet, so I'm going to suggest that you get yourself a nice waterproof enclosure, and some decent cable glands to keep water out of it. Depending on how hot everything gets inside an enclosure, it may also be a good idea to keep this outside of the green house, and in the shade.

Re: Noob Green House Automation

Posted: Sun Jan 31, 2016 4:04 am
by 52trea2
Goraxium wrote:The DHT11 will work fine, as long as you can keep it somewhere where it won't be soaked in water (which may be a struggle if you plan on misting everything).

As for the rest of it, check out relay boards with opto-couplers, like this one: http://www.ebay.com/itm/8-Channel-5V-So ... 1989122045 (or you can go for electromagnetic relays). You should be able to bridge the active and neutral on everything, as long as the overall current draw isn't excessive.

Keeping in mind that you're going to be spraying water around this thing, your biggest concern is getting everything wet, so I'm going to suggest that you get yourself a nice waterproof enclosure, and some decent cable glands to keep water out of it. Depending on how hot everything gets inside an enclosure, it may also be a good idea to keep this outside of the green house, and in the shade.

I have a water proof metal breaker box that i was going to install all the circuitry in. And http://www.amazon.com/JBtek-Channel-Rel ... 48DX08S1VT

Will that work instead? I think its the same-ish part.

Re: Noob Green House Automation

Posted: Mon Feb 01, 2016 12:00 am
by Goraxium
It's a little vague with the details... If it specified a minimum trigger voltage for the relays, I'd be happier with it. Here's an old forum post with a discussion on the boards, where one person got one that couldn't be triggered by the 3.3V outputs of the Pi:
viewtopic.php?t=30790

Re: Noob Green House Automation

Posted: Mon Feb 01, 2016 1:40 am
by 52trea2
Goraxium wrote:It's a little vague with the details... If it specified a minimum trigger voltage for the relays, I'd be happier with it. Here's an old forum post with a discussion on the boards, where one person got one that couldn't be triggered by the 3.3V outputs of the Pi:
viewtopic.php?t=30790


http://www.sainsmart.com/8-channel-dc-5 ... logic.html

https://docs.google.com/file/d/0B5-HND9 ... VyODA/edit
okay think i got it this time and thank you for all your help

Re: Noob Green House Automation

Posted: Wed Feb 03, 2016 9:33 pm
by emanuel1
that can be done on the cheap.
Can you give more details. When you day control of fans, do you mean speed control of a normal house fan, or just on off?
Temperature and humidity can be done through a DHT22 (which is a bit better than the DHT11) .

Basically you would need to control a relay. Opto-couplers are a safe way to go, but I think that's a bit of overkill :))
If you are interested I can make you a drawing of what you would have to connect. If you can make a PCB than that's dirty cheap and basically with a relay you can turn anything on/off up to a few kW/relay.
A relay is basically switch which isolates the control part from the load (similar to your light switch). for a normally off relay. a current magnetizes a coil and turns on the relay. When the current is turned off the field in the coil drops and the contact in the relay is released. The normally on relay is exactly the opposite. You can also find toggle relays, where a short impulse on one coil moves the contact to on, and a different short pulse on another coil turns it off. This has the advantage that you don't use energy to keep the relay in one position, but it requires 2 control lines or some extra circuitry.
Except for the relay, you will need a transistor for the relay, as generally relays require up to 100mA to work and the Pi will not source more than a few mA. This will be cheap and easy to hook up. You will need in parallel with the relay a cheap diode for back EMF (not going into details, but a relay which is an inductive load always needs a free-wheeling diode next to it to protect the circuit when you de-energize of the coil).
You will also need a power supply. Generally 12V as most relays are 12V. Even if you get 5V relays you should not use the same power supply as spikes can appear when the relay gets de-energized (turned off).
Let me know if you need more help.

Here: http://hamsterworks.co.nz/mediawiki/ind ... nterfacing you will find a schematic (driving higher power section) of the circuit I mentioned above.
That's about it, you can also buy them on ebay. I prefer to build them as I can get much better relays which I know for sure that they work as they should and they won't fail on me. The opto-couple is not needed as you already have the isolation in the relay.

Re: Noob Green House Automation

Posted: Thu Feb 04, 2016 1:29 am
by 52trea2
So I know what i'm doing is over kill. i have always preferred building something bulkery and with more options than i need right now. and yeah i wish to just turn the fan on and off it doesn't have a variable speed motor well it does but the low speed winedings are toast. I have some relays (no clue what type they are) but i honestly wanted something easy to wire up. But i'm not afraid of soldering and i have a friend who has everything to make pcbs. So if you wish draw something up if i don't use it now i'll probably use it when we expand the green house (Planning on quadrupling the size)

Thanks all the help

Re: Noob Green House Automation

Posted: Thu Feb 04, 2016 6:17 pm
by asandford
i use a 433Mhz transmitter (few quid from DX/Ebay) and these to control the mains appliances in my greenhouse (4 'buttons' x 4 'channels' = 16 devices). The downside is that there is no feedback (but an LDR could be glued to the LED I suppose). The upside is that there is an airgap between the mains and the Pi (both for electrical safety and convenience of placement / housing of gear).

Re: Noob Green House Automation

Posted: Sat Feb 06, 2016 2:36 pm
by emanuel1
Ok. If you just want to turn on/off the fan, then there is no point drawing as everything is dead simple. If you can turn on a led you know how to control the fan through a relay.
For the DHT11 or DHT22 there should be plenty of tutorials around.

Again, if you know that 220V can kill you, or fry your electronics and use common sense you don't need to overkill isolation. for example now I have 10 kV insulation with 3cm clearance. And this is at normal conditions (not clean room).
Look at your fan and check to see what the voltage and power rating it has. A fan will draw some more current at turn on, as it is a motor and the bastards do that if they are single phased. If it draws 50% of the rating of the chinese relay I would think you're ok. If it goes above that, go buy yourself a proper relay from a good company. I really don't believe the relays that are dirty cheap from china are rated for what they say. This doesn't mean that you will get electrocuted. It means that even though they say 10A rating, they might only handle 7A, and if you run them at 10A you will fry them in a very short time. And then you will have a downtime until you replace the relay (the contact inside will get destroyed).
So for as long as you keep the Raspberry Pi and the 230V separate, with at least 1 cm in between you will be safe :))). 1 cm is probably overkill. This is also why I don't understand why people go for even more complicated things. Your friend, should be able to build you a kick ass custom shield. If he has any questions, you can ask here, but above you have the circuit for driving a relay with any micro-controller.