The HomeLab-pH board is just a measuring block. It has to be assisted by an external CPU-board and corresponding software to perform the calculations. The software package, which can be downloaded here, is intended to work with Raspberry Pi or compatible computer as server. (For Arduino boards read this page.) It visualizes the measured data, as well as presents to the user an interface to log the pH and calibrate the device. Visualization is done by a browser residing on a smartphone, laptop, tablet, etc. that connects to a LAN-address where the server is installed.
Additionally, interested users can access the measured data at the Raspbian/Ubuntu console or get it remotely via an http request.
There is a button bar and three areas where digital values are displayed. Just below the button bar the pH value is displayed. The other two displays show the voltage and the temperature values. A tiny display bottom right shows the difference between the current temperature and the one measured during the calibration.
Measured data can also be accessed at the shell by:
For json-formated output use "-json" or "-j" option:
If error or warning messages are present they are shown as "errorStrings" - a comma-separated list of strings. This case is illustrated at the lower part of the picture above, where a missing temperature sensor is reported. Some members may get the value of "skipped" (or boolean "false" in json-formated response).
It is possible to read HomeLab-pH data also using Python. The script has to execute the above shell command.see how
import os, json
# execute the shell command and assign the result
data = os.popen('/var/www/homelab/cgi-bin/get_pH.sh -json').read()
# just to see the result
# convert the json string
d = json.loads(data)
# see the pH value
# see the temperature
To see the json-formated output above, type at the browser address field the following address:
replacing accordingly the <rpi-ip-address>.
Of course, to see the http response you may also simply invoke cURL at the console.
Data accumulated from periodic unassisted measurements (PUM) is periodically send to the cloud and at user demand its plot is retrieved from there. Currently the ThingSpeak cloud service is used for the purpose. There are two prerequisites before seeing your data plotted: register a data channel at thingspeak.com (they offer a free account, which is suitable for this usage) and enter the channel's connection attributes in a configuration file.
So, the first step is to register an account at ThingSpeak. It would not take more than a couple of minutes. Go to thingspeak.com and do it. An email box has to be available for the account verification.
Second - create a data channel. In the freshly created account go to Channels > My Channels and click the New Channel button. Give a name to the channel and activate the first 3 fields of the channel. These will be accessed by our software to write the pH, temperature and voltage values respectively, in this order. See the picture.
Save the channel.
In the new screen go to API keys and look for 3 items: the Channel ID, the Write API Key and the Read API Key. See the picture.
Write down or copy their values for later use. Click around the channel menu to see you can do other useful things here like clearing your data or making the channel private.
The third step is to edit a configuration file of the installed HomeLab software. The simplest way is to start the nano editor at the shell:
and replace there the values of the channel_id, the write_api_key and the read_api_key with the ones from the ThingSpeak channel. See the picture.
Now - time for a test. Check the Pi has internet access. Load/reload the program in your browser to read the newly configured channel. Just for the testing - set a PUM-task with the shortest sampling time interval of 5 min and wait till some data is communicated. Try to plot it. See the user interface section for guidance.
The package installation is performed under Raspbian or Ubuntu Mate operating systems. They should be downloaded at the Raspberry Pi web site. Raspbian is in fact a Debian GNU-Linux. Supported are 7.8, 8.0 and all later Debian versions. Ubuntu supported version is "Ubuntu Mate for the RPi 2 & RPi 3", ver.16.04.
The operating system should have Apache web-server installed to send the module readings to the browser. If it is not found the installation script will try to install the Apache package. Other modules and packages to be installed if not present are: i2c_bcm2708, i2c_dev, i2c-tools, w1-gpio, w1-therm and bc.
An active internet connection has to be available during the installation.
Be sure the RPi, which the HomeLab-pH board is mounted on, is connected to the LAN and powered. Plug in the temperature sensor and a pH-electrode in their sockets on the board. Start a web-browser on a whatever device (laptop, tablet, smartphone) connected to the same LAN and point it to the device's IP-address. You will see the HomeLab-pH page main screen with the meter readings.
What if you do not know the local IP-address of the RPi? Well, you may try the address printed at the end of the installation procedure. If you have just installed the software there is a good chance for the IP-address to not being changed by the router. Otherwise you have to use a LAN-scanner to find the address.
If the RPi is configured to use a dynamic IP-address, when restarted it may be assigned a different one by the router. So, if you are forced to do address searching frequently when measuring pH, it is better to assign a static (not changing) IP-address to the RPi computer.
If you have found a bug or have a proposal for improving the user experience, please share it with us at the contact form.
There are currently two versions available to download. The newer one, 181126B BETA, has the feature of unassisted measurements. Namely - the meter takes measurement at a user selectable time interval ranging from 5 min to 24 hours. When required the data can be viewed through the user interface. The software may also optionally plot the data using a connection to a thingspeak.com user account. The connection attributes has to be entered by the user in a configuration file.
The version is in its testing phase, so any feedback will be highly appreciated.
The changes to the previuos 180730B_BETA version include the
mounting of a small 1MB RAM disk on boot to store temporary data,
dropped support for versions of Raspbian OS earlier than Dec 31st, 2014 and
fix for a bug that prevented storing of data to send later to reconnected Thingspeak account.
Log of the versions' changes.