Greenhouse project

Gday all, i am completely new to this kind of electronic work. I have a greenhouse that i grow chilli’s in. I would like to create a controller to regulate the humidity and measure the level in the water tank.

Im not sure wether to use a raspberrypi or arduino. The whole system runs from a 12v solar system with a storage capacity of 5000Ah.

I need the system to measure humidity and activate a water solenoid to raise humidity and turn it off again once at set humidity.

It also has to shut off the pump when the water level drops to low.

The pump is a 12v pressure activated type - similar to what you would find in a camper van. Always holds 80psi.

I have no idea where to start or what the best plan of attack would be.

Regards, Eric


Hi Eric,

Welcome to the forum :slightly_smiling_face:

What kind of system is already installed and what is it capable of doing? Do you already have a humidifier unit in place that you are looking to swap a new controller in to drive?

There are some popular units out there made by a group called Inkbird that are designed to be a simple plug-in humidity controller that can operate external mains controlled elements.

Core Electronics will have everything you need to build a system using either a Raspberry Pi or an Arduino but it may be more trouble than necessary if there is a turn-key solution that will get it working and avoid any issues with controlling mains devices via a home-made device.

1 Like

Unfortunately there is no mains power. And its not viable for me to run mains power to the greenhouse. For humidity it uses a spray misting system that runs from mains water, or in my case mains pressure tank water. Its just a hose with tiny brass sprayers.

1 Like

Hi Eric
5000Ahr ?? That ia a fair bit of storage and pretty much a full on solar system. The equivalent of 50 x 100Ahr batteries. Is that a typo or do you really have that capacity.

I ask this as a fair percentage of contributors on this (and probably other) forum initially tend to undercook their power requirements and run into trouble downstream. With this lot at your disposal you could run a few Arduino or other things and not even notice.

Keep it simple and you will reap dividends in the long run. It would appear to be all doable but Spookee has a valid request.
Provide an accurate description and a block diagram of what you have at the moment.
Provide an accurate description and a block diagram of what you are hoping to achieve.
Provide all the information you can, half a description is sometimes worse than none and I use the word “accurate” in all sincerity as this will prevent unnecessary guesswork down the track and result in a quicker and easier solution.
Cheers Bob

1 Like

No its not a typo. I own trucks, so when the batteries start to struggle to turn over an engine i put new ones in. Basically the batteries are fine for everything else just not a 16l truck engine. Ill try to draw i diagram. Again truck skills not computer skills.

So the pump is constant power (unless low water) it switches off at 130psi and holds pressure when the solenoid to the misting system is closed.

The humidity sensor needs to activate the solenoid at 60% and turn off at 80%

The tank sensor needs to turn off the pump if water level in the tank drops below 10%

It would be nice to have an lcd screen that i can flick through to see the tank level, humidity, and temperature.


Hi Eric
The solenoid ans pump switching system does not have to be very complicated. A simple Mosfet low side switch would be fine. What has to be known however is the DC current requirement of the solenoid and the pump. This can be ascertained by measuring the resistance across the solenoid and pump motor which should be worst case (which has to be considered.
The logic would also be fairly simple.

Water below 10% turn pump off.
Water above 20% (???) turn pump on. 20% is only an arbitrary figure here but some hysteresis is needed to prevent “hunting” around the switching level, could be 15% but must be some figure above the low point allowing for some water movement within the tank. You will probably need 2 level switches. or some other means to obtain the difference in levels.
While this is going on the misting solenoid can do what it likes.

Humidity < 60% turn solenoid on.
Humidity > 80% turn solenoid off.
If the current requirement is only moderate Core have a handy freetrhonics board here

which is handy as all the small components required are on the board and you are only left with 3 connections. This can be driven directly from Arduino. It is rated at 20A but I would hesitate to use at at that level without a heat sink. Your application should not be anyway near that. The only external component required would be a schottky diode across any inductance like the solenoid coil and the pump motor.

The Arduino would have to sense the water level switch status and provide an output accordingly. If this is switches this can be digital inputs and fairly simple. any other form of detection is another story and I would have to leave that one to others more experienced in decoding different sensors.

The humidity sensors are another story. I have no experience with handling the decoding etc of these things but I would think that getting Arduino to compare this output against 2 presets (representing 60% and 80%) then providing an output HIGH or LOW to drive a Mosfet would not be too hard.

Display screen. I think Arduino could do that too. Once again I will have to leave this to those more conversant with this.

It is a bit late now but to-morrow I will post a small circuit of what I would do to operate the solenoid and pump.
Cheers Bob
PS. If you can try to stick with 5V logic level. I think for your application it would be better than 3.3V logic. Particularly with switching something like that Mosfet board. I am not convinced it would turn fully on at 3.3V and overheating at higher current levels may be a problem.


Thank you for your reply. The pump is a non controlled part. Its wired directly to the 12v input. With an always on solenoid. So the only thing the arduino needs to do is power the solenoid off. I suppose a buzzer would help alert me its turned off? The water valve is a DN15 12v @ 100mA


Hi Eric
Pump or solenoid. makes little difference. Same logic applies just operate the solenoid so the water flow does what you want.
Cheers Bob


Hey Robert & forum,
I am also new to this type of automation & am using a R-Pi 4
I have a similar need to trigger watering pretty close to that which you have quoted. I have the MOSFET card and just can’t see how to use it.
I got a 4 port relay working to open solenoid valves ( Solenoid Water Valve - Core Electronics Forum ( ) and now heading down receiving information from environmental sensors like Humidity & temperature, but tripped over a cavass of do I need ( or not ) a MCP3008 - 8-Channel 10-Bit ADC With SPI Interface to get the analogue readings back from the sensor ( Gravity: Analog SHT30 Temperature & Humidity Sensor | DFRobot DFR0588 | Core Electronics Australia ( ) in my case.
Guidance would be great.

1 Like

Hi Eric,

Thanks for the clarification on your power supply situation and more details on the existing equipment you want to integrate into your controller. This forum does get a few questions about similar projects where it’s not clear if someone wants to build a controller and code it up themself, or just wants to be told what turn-key product to buy that they can unbox and use straight away.

@Robert93820 has covered all the digital inputs and outputs with better clarity than I could hope to if I tried but I may be able to offer some suggestions on the humidity sensing options.
Since we have locked in Arduino as the controller of choice (a good choice as you can power it from 12V and a single board computer is total overkill for this task anyway).
I’d recommend using a sensor like the SHT31 Weather-proof Temperature & Humidity Sensor

Core Electronics have a huge range of sensors that can measure 0 to 100% RH according to the specs of the embedded sensor, however, most of those designs have just slapped the sensor on a bare circuit board so may not last long when exposed to condensation.
The SHT31 in the water-proof housing still isn’t designed to be dunked for long periods of time underwater but should have much greater longevity than a bare board in a moist greenhouse with overhead sprays as you have described.
The sensor can connect directly to an Arduino board as two analogue inputs and can be used with the sample code found on the manufacturer’s product wiki page.

1 Like

Hi Andre,

There is a tutorial with diagrams for the MOSFET module you can read here which explains why you’d need it, how to connect it and some other important considerations for it’s use like freewheeling diodes for inductive loads.
It sounds like you have achieved a similar outcome using your relay modules, which perform a similar role in most circuits to a MOSFET switch, there are some differences when it comes to isolation but generally, both are used to allow a low-voltage/low-power circuit to activate a higher-voltage/high-power circuit.

You’re using a Raspberry Pi 4 Single Board Computer as your controller, these are a lot more powerful in terms of advanced processing and having WiFi built in, but the Pi 4s don’t have analogue inputs, so they will need an Analogue to Digital Converter (ADC) if you want to be able to read the analogue output of the sensor you have linked.

My previous point about the chance of condensation being something to consider for sensors that are just ICs on a circuit board is relevant to the SHT30 sensor board you have linked.


Yes new to this technology and looking at my issue in hind-sight whilst acknowledging I have a lot to learn. Thanks fir the guidance and the reading material.
Keep up the good work and spot-on advice.

1 Like

This 8s helping alot. Im forming more of an idea about how it all works

Thanks Spookee,
The tutorial is helpful and I probably wasted money on buying it in hind-sight.
About the need to an analogue interface, is answered perfectly, back to the shop then.

Sorry, I missed the context of this short hand. Can you elaborate.

Is* sorry hit the wrong key. Would i need a dc to dc stepdown to run the arduino

Hi Eric,

It depends on the Arduino, some boards like the Uno have a 2.1mm DC barrel jack connector and an onboard voltage regulator. The Uno can be supplied between 7V and 12V via the DC jack which avoids using an external regulator.

Hi Eri.
As promised here is a circuit I would use to switch a solenoid or pump. Very simple and it will work. The Diode across the solenoid is very ipportant and should be a schottky type as this is a lot faster than a power diode and will catch the high reverse voltage spike when the solenoid or pump turns off. This will be much higher that the 12V originally applied. The number under the Freetronics driver board is the CoreElectronics part number.

Here is another circuit if you don’t want to operate the pump solenoid (or pump) with Arduino. This circuit depends on the level sensing devices providing a closed switch contact (such as a float switch) when the level is above sensor position.

With S1 and S2 both closed the solenoid is on. When the level drops below 20% and S1 opens, the solenoid remains on as the relay is latched via S2.
When the level drops below 10% S2 opens removing the latch and switching the solenoid off.
When the level rises above 10% the solenoid remains off until the level reaches 20% when S1 closes which operates the relay and switches the solenoid on.
The whole process can then repeat.
Note. Once the relay is unlatched by the opening of S2 the relay and thus the solenoid will not operate until the level reaches 20% (called hysteresis)
Can’t get much simpler than this to do your job>
Cheers Bob
EDIT. The diode shown across the relay is sometimes part of the relay assembly and built in. In this case the relay coil is polarity sensitive.


Thanks Eric,
I am on a knife edge & can go either way, but need to make an informed decision ( based on nothing ) as to my need for this and then can I make it work. The value returned is pivotal and thus super important as the R-Pi4 uses that ( & other ) inputs to maintain a stable environment.
U may well be right for the R-Pi4 too.