A while ago I reported on progress towards a Raspberry Pi based environmental logger.

Well, it has proved to be quite popular at work (several laboratories now use them to log temperature and humidity values for around £100 each device) so I wrote up pretty much all the instructions on how to build one (including the necessary software installation and case details).

Here is a diagram of the stripboard layout (and here is the Fritzing file for it). Note this is shown with the copper tracks uppermost whereas in reality they are underneath the board).

Enjoy!

Work on these loggers was mostly in my own time, but additional inspiration and funding came from the EMRP project ‘LUMINAR‘. The EMRP is jointly funded by the EMRP participating countries within EURAMET and the European Union.

This entry was posted by wpadmin on 3 December 2013 at 6:17 pm, and is filed under Uncategorized. Follow any responses to this post through RSS 2.0.You can skip to the end and leave a response. Pinging is currently not allowed.

You are welcome. I plan to improve the instructions in the coming months (they are a bit of a mess at the moment) and perhaps make the SD card image available online. Currently I am working on a PCB to replace the Veroboard, to improve reliability and reduce manufacturing time – there are 7 of these in use at work and I have a request for 10 more to be made!

But, I have a problem with the statement on page 24 of your guide:
When I write:
sudo /usr/share/cacti/site/scripts/new_temperatures.py
I do not get the answer:
T1:23.187 T2:23.187
but in stead of that the codes of my DS18B20 temperature sensors. So in my case the output is:
28-0314557369ff:23.187 28-0314558320ff:23.187

In the Data Input Methods of Cacti I adapted the Field[output] name by resp. 28-0314557369ff and 28-0314558320ff but left the friendly name as it was (resp. T1 and T2) but that was not the solution.

One last remark: in the Paths-tab of Cacti-settings in the so-called Spine PollerFile Path there is an error: FILE NOT FOUND.

Well this is a rather long story but I hope you can bring me somewhat further. Thanks for your attention.

OK, a quick response to Peter’s question about the Spine Poller –
“One last remark: in the Paths-tab of Cacti-settings in the so-called Spine PollerFile Path there is an error: FILE NOT FOUND.”

That is quite normal and should not be a problem – Spine is an add-on to Cacti used to help with handling large numbers of devices, but we do not need it and do not use it. I also have the same error message. So we can ignore it.

Regarding the failure of the new_temperatures.py script to format the output correctly, I have found that the instructions contain an old version of the script which I forgot to update – sorry!

In the last line of the script it says:
print(device_folder[0][20:]+’:’+str(temp[0])+’ ‘+device_folder[1][20:]+’:’+str(temp[1]))

Delete that and replace it with the following:
print(‘T1:’+str(temp[0])+’ T2:’+str(temp[1]))

Then the script should output the values correctly. Cacti is a bit fussy in how it expects data to be presented. It must be T1:value then a space then T2:value, i.e. T1:20.123 T2:12.345.

After making the above change you will need to go back into Cacti and re-create the Data Input Method.
Good luck!

I changed the script new_temperatures.py according to your recommendations and indeed now the output is oke.
But I still cannot make visible the temperature-graph (T1 + T2) in Cacti. I tried a lot of things, repeated reading and controlling your descriptions but without result.
I didn’t install LCD display software and hardware, also I didn’t install a moisture sensor.
One remark: on page 26 of the pdf-file you mention as input type: Script/Command, but in the overview picture is shown SNMP as data input method. But that might be irrelevant. I tried both.
Peter

An additional remark: I’m applying WIFI for my network connection. In the file /etc/hosts I find:
localhost 127.0.0.1 and
rasberrypi 127.0.1.1 and not 127.0.0.2!!!
Can that be a reason for malfunctioning?

You can skip the two E-mail I sent you today.
I started from start with setting up everthing and now the Temperatures graph is running!!
However a new problem came up: no data are shown. Every temperature is indicated as nan. Only graph axis are shown.
Any suggestion?

Generally with cacti I found that you need to clear out the database files and let it recreate them when fixing some problems. I suggest you try that for now. Also turn on the debugging in cacti to a more detailed level and then look at the little for clues. You should see the poller process get the data and the something else parse it into the correct variables before it gets stored in the databases. A failure at any stage should show up and that gives further clues where to look, but needs a little detective work.

Just to add, I have updated the latest version of the instructions to detail the changes necessary to have the logger working on the new Raspberry Pi model 2. Essentially you need to update the OS, change some settings to enable some h/w modules (they way they are handled is different on the model 2) and install an updated copy of the python GPIO module (currently only available as a beta). I got this all working on a PCB version of the logger I am working on at work and it all is working fine and backwards compatible with the previous hardware. I think I noted down all the steps, apologies if I forgot something.

Not sure how I fixed it, but it occured for me on an install-from-scratch and I managed to fix it.
Full details of how to install software from scratch are now available in a new instructional Word document.

Thanks for sharing ;). I’ve followed your tutorial until page 32 and all works perfectly using a Raspberry Pi Model B. I found some considerations like time zone in php (I’m from Mexico), but it works fine :). Soon I’ll follow the next pages and I’ll test your procedure on a Raspberry Pi 2. I would bring the considerations I found. If you like I can send you information by email. Greetings!!

After install cacti it is convenient to check time zone in php and if it’s necessary change it according to your country. In my case I’ve modified date.timezone = America/Mexico_City in the files /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini (’cause I had a difference of 6 hours). I hope this be helpful to somebody.

On the other hand, do you have any information about how to install plugins of cacti on the raspberry pi, such as “thold” or “nectar”? It would be helpful able to send emails when a certain temperature is exceeded and also annexed graphs. I tried to install the plugin “thold”, but I failed. I have little knowledge of linux :(, but I’m very persistent.

I could not even test the procedure on a rasperry pi 2. I need some dupont cables. I hope to have the necessary material in a week. As I have tested you notice. Greetings!!!

I am a bit busy with work at the moment. When I get a chance I will either upload a working SD card image or follow the instructions from scratch to see where the problem lies. Thanks for your patience…

Not sure how I fixed it, but it occured for me on an install-from-scratch and I managed to fix it.
Full details of how to install software from scratch are now available in a new instructional Word document.

When you say that you see the graph but no data, do you mean the graph axes etc are there but no trend/data lines? Or are the graphs working fine but the the latest/max/min numbers below the graphs are missing?

Cacti is the most difficult bit of the whole thing. I will try to replicate.

Not sure how I fixed it, but it occured for me on an install-from-scratch and I managed to fix it.
Full details of how to install software from scratch are now available in a new instructional Word document.

Hi
I followed the great instructions from Andrew up to page 15 where I first ran into errors reading out the temp sensors DS18B20.

With the help of https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=107606 I edited /usr/local/lib/python2.7/dist-packages/rpiSht1x-1.2-py2.7.egg/sht1x/Sht1x.py by adding at line 105: GPIO.setmode(gpioMode) and modify line 103: def __sendCommand(self, command, gpioMode = GPIO_BOARD)
Now I get the correct raw data reading and the formatted output of the two DS18B20 by calling new_temperatures.py (page 25)

By calling the script for the SHT75 sensor new_humidity.py in get the following errors.

I am slightly confused. The Sht1x code library is used only by the SHT75 humidity sensor and not by the DS18B20 temperature sensors. The temperature sensors use the 1-wire package whereas the SHT75 uses the Sht1x libraries – fixing the Sht1x code (which is a good thing to do!) should not have enabled the DS18B20 sensors to work.

I think there are two issues happening in your code example – the ERROR:sht1x.Sht1x:nack2 suggests to me that the library is unable to communicate with the SHT75. The fact that there are 3 error messages probably relates to the 3 calls to code that read things from the sensor – each call is failing and giving an error message. The math domain error is probably then due to a divide by zero or similar error caused by failure to communicate with the device.

One quick check – is the SHT75 hot to touch? If so, it is connected the wrong way round!
I suspect, at this point, that the SHT75 is not correctly connected.