Jump to content



Onewire humidity+temp monitoring

onewire python raspberry pi

  • Please log in to reply
1 reply to this topic

#1 chelicerae


    Heating Up

  • Members
  • PipPip
  • 158 posts
  • Location:Sweden

Posted 06 July 2019 - 07:58 AM



As I've tried growing hot peppers indoors I've also slowly developed a couple of scripts for keeping an eye on two important growtent / greenhouse params: relative humidity and temperature.


It started as an arduino project but I had a devil of a time keeping the wifi connection stable and it was a bit too diy in terms of hardware so as I was offered a raspberry pi by my father I accepted. A colleague had been keeping track of his fuel pellets burner temperature apparatus at a couple of locations with so called "one wire" sensors so I looked into this.


Turns out onewire has been around for some time: https://en.wikipedia.org/wiki/1-Wire where each device comes with a unique identifier from the manufacturer. A Swedish web retailer sells sensors and USB adapters for onewire and I acquired a couple of combined humidity/temperature sensors and a usb adapter for connecting the net to my raspberry pi (and several meters of rj12 cabling) for my two indoor grow tents.


The Pi boots from the USB drive (have had an SD card fail prior) and looks good in its official casing:







Later on I bought a third of these combined sensors and rj12 telephone wire (6/6) from ebay and learnt a bit about rj11, 12 and 45 and how to physically connect the individual wires of the connectors and hooked my balcony greenhouse up to the network.









A python script is scheduled via systemd in Raspbian to run once per hour, get the humidity+temp values from the three sensors/places (technically the two indoor ones have an additional dedicated temperature sensor on their boards, the one for the balcony has only the default combined temperature and humidity one) and put these in a postgresql database table. (It also pulls the approximate local outdoor climate from weatherunderground and puts in the same database table as jsonb). I pulled up a database view for some time to see how things were doing but looking at a table is less intuitive than looking at a chart..so now:


The Raspberry Pi also employs an apache2 instance with mod_wsgi to serve a webpage with two c3.js charts, one for relative humidity and one for temperature as well a flask (python) rest-api for pulling these values from the database from x number of days back (dictated by the web page) as json, resulting in this simple page:



"Balkongväxthuset" == 'the balcony greenhouse', "Stora tältet" == 'the larger grow tent', "Lilla tältet" == 'the smaller grow tent'. "Relativ luftfuktighet" == 'relative humidity'



One can at a glance feel sorry for whatever hot pepper is trying to stay alive on my balcony (afternoon sun(or clouds), right now between approx 14:00 - 17.30). Last year had a very warm summer here..first a long and cold spring that felt like an extension of winter and then suddenly boom +25C. This year is more typical in comparison, so far.


The uneveness (relative, compared to the Great Outdoors : p ) of the relhum of the indoor tents is because they are in my bedroom and I have to open the door sometime, it gets real stuffy occasionally what with the humidifier and relative warmth.


Thanks for looking, this project tickled my geek gene, both for pretending that I was a bit handy with extremely thin connector copper cables and for getting better with my favourite language for lots of helpful things: Python. Systemd is neat to schedule things with even if cron has a simplicity that can't be matched and apache appears to work very well to serve python things via mod_wsgi.



Edit: technically this isn't irrigation or heating or lighting or housing or feeding but the forum header says "show off your inventions!" too and that's what I did : )

Edited by chelicerae, 06 July 2019 - 08:12 AM.

#2 Tybo


    Heating Up

  • Members
  • PipPip
  • 316 posts
  • Location:Virginia

Posted 09 August 2019 - 02:40 PM

I like this.  There is a guy from the UK on Youtube (Chillichump) that uses the arduino for monitoring his greenhouse.  

This is awesome.  Thanks for posting! 

Also tagged with one or more of these keywords: onewire, python, raspberry pi

0 user(s) are reading this topic

0 members, 0 guests