4

I want to prepare a homemade thermostat for my greenhouse project. I have enough knowledge about electronics and linux based embedded systems but I'm not skilled enough in programming, so let me introduce my project and thoughts.

  • I can control triacs and optocouplers or solid state relays with GPIO on RPi. I already done this before on Linksys WRT54gL router with OpenWrt for my garage door. In this project I choose to control AC with solid state relays because I want to keep it simple and system will be used more frequently.
  • I want to control ambient temperature with a hot air blower and temperature sensor data will be fed back to RPi. So, for example, ambient temperature reaches 25°C air blower will be shutdown.
  • For irrigation I want to use water pumps to work on humidity same as air blower. When the humidity drops, pumps will feed the soil.
  • All this systems will controlled by a user interface (web or some LCD with buttons). and I want to set temperature and humidity values to work and log all data. I want to use Apache or lighttpd with cron timing programs.

Here is the hard part for me I have no information on Python, PHP, HTML or any programming languages. I already searched google to find any similar projects but I couldn't find one. Here I'm sharing my flowgraph for the project below.

Flowgraph

2
  • Start small... I prefer coding in Perl and C myself, but I do write a lot of Python code at my job (unrelated to the Pi). Google has a really good intro-style "Python class". I would start by learning the Python basics, then start searching for basic techniques related to the Pi (eg: "how to turn a GPIO pin on python" for example). Essentially, that's all you'll be doing. Once you know how to read/write the GPIO, the rest will fall into place as you progress.
    – stevieb
    Jun 29, 2017 at 13:52
  • ...and don't worry about a UI at first. Get things to work on the command line as you learn, then when you've got all that down, then consider how to put a UI on it (or start the whole project from scratch with the UI at the forefront).
    – stevieb
    Jun 29, 2017 at 13:53

2 Answers 2

1

I have a couple of monitoring systems, one on a boat and one in my shed, that use a BMP180 temperature/pressure sensor and a webcam for a couple of quid each.

Both remote Pis report home periodically to another Pi that acts as a web server:

http://agurney.myftp.org/aisling/ [*yes, I know it's currently down, but it's 150 miles away*]
http://agurney.myftp.org/shed/

All the Pis are MKI versions, but are plenty powerful enough to do what's asked of them. The shed Pi is powered by a solar panel and the boat pi from a wind generator, so that's something else you can add into your mix.

The approach I've taken is:

  • I have a python program that is launched periodically from crontab that takes stores the current temperature and pressure and takes a photo, and saves that information locally [For convenience, the photo is .jpg with a filename that is the date+time+temp+pressure, so need to match data with photo later]. the following modules are used

    import Adafruit_BMP.BMP085 as BMP085
    import pygame.camera
    import pygame.image
    import subprocess
    import time
    
  • another cron task launches periodically and does an rsync of the remote data directory on the server pi.

    5,35 * * * * sudo -u myusername rsync -av -e ssh /home/pi/mydatadirectory/ myusername@mydomain:target  > /dev/null 2>&1
    
  • a PHP file on the server Pi generates the web page from the rsynced data. The graph is produced by piping the data through gnuplot.

  • a cron task on both machines purges data daily so that files older than a week or so are deleted

    10   0 * * * find /home/pi/mydatadirectory/* -mtime +4 -exec rm {} \; > /dev/null 2>&1
    

If your greenhouse is nearby you can run everything over your WLAN; if not, then remote options are available - I use an intermittently available public wifi so use a service like weaved.com so I can tunnel to the Pi when I don't know what its public IP will be. Using rsync means that if the network is down or congested the data will be transmitted whenever the connections available.

0

This sounds like a great project, perfect for the rpi. As you point out without any programming skills its going to be a steep learning curve to create the gui frontend to your project from scratch. Having said that, what you are trying to achieve is actually relatively simple.

What might make things easier is to consider using other sensors and switches, for example the sonoff th range of wifi switches and sensors are very cost effective. These $10 switches have built in wlan network connectivity, an esp8266 chip which can be reflashed with custom firmware and have built in temp and humidity sensors.

The flashed switches and sensors are supported by freely available open source home automation systems such as FHEM and domoticz which will run on the rpi and provide the automation you require - sensor reading, switching based on temp, humidity etc and provide you with a customisable gui frontend.

I am doing exactly this with an rpi and flashed sonoff th 16 with temperature sensor which monitors the temperature of our garden swimming pool water!

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.