Arduino + PID Library + DHT sensors + SSR - General conceptual questions (UK)

Hi everyone

I have a small greenhouse which I would like to keep at constant temperature. I have looked at several projects trying to achieve similar.

I plan to have an Arduino with PID library installed - http://playground.arduino.cc/Code/PIDLibrary

I will use a DHT sensor in the greenhouse to measure temperature.

I will plan to use a 135W tubular heater - 135w 3ft Energy Saving Tubular Heater - IP55

I will use a solid state relay to turn the heater on/off

I have a number of high level questions:

  1. How do I figure out what voltage SSR I need?

  2. The tubular heater has a dial. Can I remove the dial and connect the heater straight to the SSR?

I will later try to use a raspi to set the desired temperature (a day temp of x, a night temp of x - 10*C). I assume the raspi can simply “push” the desired temp to the arduino. Am I right in this assumption? I will look deeper into this later, but just want to know if I should be researching another method.

Thank you very much.

donrondadon:
I plan to have an Arduino with PID library installed - http://playground.arduino.cc/Code/PIDLibrary

A simple hysteresis will do the trick, you don't need a PID controller. You can't really control the power of the heater anyway (unless you have a SSR with zero-crossing detection or a phase angle controller/dimmer, but I doubt that'll work with the heater).

donrondadon:
I will use a DHT sensor in the greenhouse to measure temperature.

I will plan to use a 135W tubular heater - 135w 3ft Energy Saving Tubular Heater - IP55

I will use a solid state relay to turn the heater on/off

Should work.

donrondadon:

  1. How do I figure out what voltage SSR I need?

Usually an SSR is electrically decoupled using an optocoupler with current limiting, so they can handle any input voltage between 3V and 30V. You'll need a 250V 200W SSR or more (i.e. roughly 1A or more).

donrondadon:
2. The tubular heater has a dial. Can I remove the dial and connect the heater straight to the SSR?

Depends. Does it control the power, or is it just a thermostat?

donrondadon:
I will later try to use a raspi to set the desired temperature (a day temp of x, a night temp of x - 10*C). I assume the raspi can simply "push" the desired temp to the arduino. Am I right in this assumption? I will look deeper into this later, but just want to know if I should be researching another method.

No need to use a RPi, just use an ESP8266 to begin with, it has WiFi and has I/O pins like an Arduino. You can just program it like a regular Arduino as well. They're ~$3 on Ebay, but make sure you get headers and a decent 3.3v power supply as well, maybe a 3.3V (!) USB-to-Serial converter. Or just get a devboard, like this one.

Hope this helps!

Pieter

+1 for the ESP8266. You can get the core here to allow programming the ESP with the Arduino IDE.

Thank you Pieter. I will read about hysteresis tonight - anything that can simplify the project would be great.

PieterP:
No need to use a RPi, just use an ESP8266 to begin with

I have already been looking into ESP8266. Perhaps you could help with two more questions:

  1. Do you recommend the ESP8266 chip by itself, or the arduino board that includes it? This one - Arduino UNO Wifi Development Board: http://uk.rs-online.com/web/p/products/1113737/?intcmp=UK-WEB--BP-PB2--Jan-17-_-arduino

  2. Temperature is one of the things I would like to control. Following this project, I would like to also control a light timer (I found a nice project with remote controlled plugs that I can use), a water pump (later connected to a heater and also maybe nutrient tanks), and a camera (to take photos at set intervals).
    The reason I thought I should use a raspi is because I would like to have a web server that pulls recorded data from one or more arduinos and displays it online in a graph format. I would also later build in the ability to manually do things like “turn on water pump”, so I thought it would make sense to have the raspi as the controller where I input what temp I want, what the watering schedule and light schedule should be.

donrondadon:

  1. Do you recommend the ESP8266 chip by itself, or the arduino board that includes it? This one - Arduino UNO Wifi Development Board: http://uk.rs-online.com/web/p/products/1113737/?intcmp=UK-WEB--BP-PB2--Jan-17-_-arduino

The ESP8266 by itself. Connecting an extra microcontroller (e.g. Arduino Uno) is completely unnecessary. The ESP8266 runs at 80MHz or 160MHz, that's 5 or 10 times faster than the Uno, it's 32 bit (faster long int operations etc.) compared to 8 bit (Uno), It has 4MB flash, compared to only 32KB on the Uno, 64+96KB RAM (Instruction RAM and Data RAM resp.) compared to only 2KiB on the Uno ...
The only disadvantage could be that there's less I/O (+ no hardware SPI/I²C), and that you have to share CPU time with the WiFi driver, but that's taken care of by the Arduino Core anyway, so you won't notice anything.
The Serial connection between an Uno and the ESP8266 would be a bottleneck as well, it's way slower that WiFi.
It's best to think of it as a very fast Arduino board, that can do pretty much everything a normal Arduino Uno can, but with fewer pins; with a WiFi radio, so that it can send and receive data to and from the network or Internet.

donrondadon:
2. Temperature is one of the things I would like to control. Following this project, I would like to also control a light timer (I found a nice project with remote controlled plugs that I can use), a water pump (later connected to a heater and also maybe nutrient tanks), and a camera (to take photos at set intervals).
The reason I thought I should use a raspi is because I would like to have a web server that pulls recorded data from one or more arduinos and displays it online in a graph format. I would also later build in the ability to manually do things like "turn on water pump", so I thought it would make sense to have the raspi as the controller where I input what temp I want, what the watering schedule and light schedule should be.

Apart from taking pictures, the ESP8266 can handle all of that really easily. You can set up a working server in 10 lines of code, so you can host webpages and send the data to your phone, receive commands from your phone, etc ...
Creating a fancy interface with graphs is also no problem, since you only have to send some HTML, CSS, JavaScript and data to the browser. (You have 3MB of flash available, which is plenty for just plain text files, and you could even add an SD card.) The JavaScript in the browser will create the graphs etc, the ESP8266 just has to send the right data.

Pieter

Cannot help with the wifi aspect of your project, but can offer some practical info regarding heating and controlling the greenhouse, here in the uk.

First, you make no mention of the size of greenhouse, if its glass, single or double layer plastic glazing and what minimum temperature you are trying to achieve.

I’ve run various temps for thing like orchids, 15c min or as now just keeping it frost free.

Afraid your 135w heater will have little effect other than a few plant placed just above it.

You need a fan heater probably 1000w, though not on all the time !

As already said PID is certainly not needed and while a SSR is good for a 1000W heater you will need to go for a 10A 250v type, which , are expensive over a simple relay.
Beware the ebay cheap SSRs which as said to only be half their listed output current.

The DHT11 will give you results but for better accuracy and a more robust sensor look at the popluar DS18B20s which come prewired and house in a metal seath, still use the DTH11 for humidity info, because any changes humidity changes you make, ie a spray, are short lived

No mention of any control for propagators, often worthwhile with the always on types as the winter sun can often make them way too hot for the seedlings etc.

hth

Edit - forgot to mention these little soil moisture sensors for auto watering, just trying one out this week, so far seems quiet good.

000160.jpg

Pieter, you are a legend my friend. I’ve been reading about the esp8266 and this is exactly what I need. I still have to look up and compare specs when I have time, but I may go for the esp8266-12e as someone has recommend it over the esp8266. Still investigating.

Ricky, it’s not a “greenhouse”, more like a “greenbox”. Should have explained better. It is a 1.2m x 06.m x 1.8m (h) heavy duty shelf I have added panels to. The total volume is 1.296m^3, not too massive.

The box has some serious lighting in it - Dimlux Dual 315W CMH. I expect I’ll need to get rid of heat before I worry about increasing temps, but I can already control the latter with the fan I have. If it gets too cold, that’s when I have a problem. I may get a larger tube heater (I will measure temps before committing to anything to figure out what I need), but the tubular shape is easier to fit.

Also, this is in a shed. The shed gets hot in summer and cool in winter. My plan is to independently measure and control the temp of the shed with a more powerful heater / fan system, acting as a buffer for air temp/humidity before it reaches the box.

Most of my stuff is hydroponics, using an airpot (with coco coir) sat in a tubtrug. I did look at those moisture sensors, they may work. I read however that someone took continuous measurements with one and it lead to deterioration of the anode or cathode. That was in soil, I expect hydroponics solution will do that faster because of all the salts.

Not sure if you know how the “top fed drain to waste” hydroponics works, but basically you water the coco coir slowly and wait for about 10% of the volume of the pot (mine are 30L, so 3L) to come out of the bottom. Then you measure the EC/pH of that 10% and chuck it.

What I was hoping to do is have a button I press to start the water process (pump in a nearby water tank) and record the time I did it (so that I can just program it in later). Each time I press the button, water should pump until I get 10% run off, which I was going to measure with a ultrasonic sensor. When I press the button, the sensor should do a measure (which will be the base of the tubtrug), take this as “0”, and then at intervals remeasure until it measure a preset difference in height (when water level rises). Then it should open a valve, which drains into another tank to be used later (tank is on a lower level, so just need gravity).

Maybe what I should do (to fully automate it) is use that moisture sensor to take a measure every 30mins. If the medium is dry, it starts the process above (pump and ultrasonic sensor), then doesn’t take a measure for at least 3 hours.

I am still trying to figure out the most effective way of automatically checking EC/pH at 2 or more points (from the nutrient tank, and of the run off). They suffer the same problem of salt build up I understand.

Like the look of those humidity/temp sensors, thanks for the tip!

Seems like you have a lot more areas to cover than you thought !

Regarding heating, while the tubular heater may well balance out, its downfall is in its slow response to a sudden evening dip in temps, it may be too slow to keep up with the outside temp drop.

Do you keep the lighting (heat source) on all the time ? and if the temp does go low, how does it affect your plants, do they just slow their growth or could it damage them ?

Don't know if you are wanting to heat the shed anyway, but sounds a bit expensive, think you will find a 1" or greater layer of polystrene sheet (big sheets from wickes or bq have packs of small sheets) made up as an all round outer cover of your greenbox will more than insulate it .

Your earlier point about humidity sensor, think it will be important in your small set up as it will possibly get quiet humid and fungus /damping off could happen
An air circulating fan is a must to prevent things like that, plus plants do grow stronger if there receive movement from the 'wind'

Thats probably where a fan heater would be best, using its fan and heater on separate lines.

PH, beware the cheap meters, even well known brands like Hanna, have used several types and they can be way off compared to good quality ones.
You can buy ready made meters, or just the probes connected to the Arduino but via an amplifier board.

Not sure why you want to measure the waste output if its being discarded ?

That why I wonder how affective hydro is for just a few plants, vs the traditional watering methods,
I expect hydro is going to give optimal growth rate, but bet manual or semi automatic watering will not be that far behind.

Been using that soil moisture sensor on a house plant and I just power it from an Uno port for 1 second ever few minutes, seems to be quiet regular and near dry at a reading of 800 (out of 1024) and reacts very quickly to a watering.
It even has a simple digital output so you can connect it direct to a relay/pump without the Uno , if you want.

You might find the small float switches easier than ultrasonic sensor .