Hi All
I have finally made the move from Weather Display to weewx but before I did I wanted to make sure I had Hobby Boards 1 wire support for my
Solar,UV and Lightning detector sensors.
I have been lurking on the forums for some time and have been waiting to see if anyone would write a custom service before I could get time to do it.
As with most posters here I have only dabbled in Programming so metaphorically speaking I took the Bull by the horns and had a go myself.
So this is first time I have shared any code with anyone so please be kind :-) I hope to become more of a participant in these forums in the future
rather than I lurker as time permits.
Below is a copy of my blog post at http://www.wxblog.co.uk/onewireweewx/
onewireweewx is a custom service (plug-in) for the open source weather station software program weewx which reads data from the popular one wire weather sensors from Hobby Boards.
The retrieved data is stored in the weewx archive and stats database’s, which can then be be used in graphs and custom templates.
The sensors supported are
To find out more information about the Hobby Board one wire sensors please visit their website.
onewireweewx has only been tested on Ubuntu 12.04 but should work on most OS’s supported by weewx as long as the dependencies are satisfied.
![]() | ![]() | ![]() |
Download onewireweewx-1.0.1.tar.gz from sourceforge which contains the following files:
onewireweex.py – custom service file
Onewireident.py – a test utility to retrieve 1 wire sensor addresses
onewireweewx.html – this blog post as a document
weewx.conf.example - example weewx.conf file
skins.conf.example – example skins file
index.tmpl.example - example template file
schema.py.example – updated for lightning counter
While carrying out any of the following install and configuration it is highly recommended that weewx is not running.
The install described below was on Ubuntu 12.04 but should be similar to any Linux OS.
Make sure file back ups are made of any file that is modified.
For Ubuntu /Linux from the terminal
sudo apt-get install owfs
sudo apt-get install ow-shell
For further info follow this guide at http://www.owfs.org
A quick test to make sure that owfs is installed and working correctly is to run the included onewireident.py. The program must be run with admin privileges i.e
The ‘u’ switch assumes in most cases that the 1 wire system is connected by usb if not substitute ‘u’ with the path of your serial port.
Example Output:
It may be worth while at this point to note down the addresses of the sensors detected.
Obviously make sure at the minimum a 1 wire master adapter is plugged in for the test.
Copy/move onewireweewx.py to the weewx user directory bin/weewx/shares/user
Modifications to the weewx.conf are required. Please make a backup of the existing file before proceeding.
Open weewx.conf in a text editor of your choice
Add the following additional configuration data in weewx.conf
Add onewireweewx.py to the service list in (user.onewireweewx.oneWireSensors) weewx.conf.
An example weewx.conf file is included in the zip file.
Add the sensor addresses noted down earlier (see Test one wire system) to the configuration as required.
The One wire Solar and UV sensors use the existing database fields ‘uv’ and ‘radiation’ to update the archive and stats database.
The next part can be skipped if a lightning detector is not required or used.
Open schema.py in a text editor of your choice add the following to the schema
# The default types for which statistics will be kept.
stats_types = ['barometer', 'inTemp', 'outTemp', 'inHumidity','outHumidity','rainRate', 'rain', 'dewpoint', 'windchill',
'heatindex', 'ET','radiation', 'UV', 'extraTemp1', 'rxCheckPercent', 'wind','lightningCount']
An example schema is included in the download.
At this point please refer to the official weewx documentation on updating the database schema for the two types of database supported.
This now completes the main install / configuration of onewireweewx.
Restart weewx.
Set debug in weewx.conf to 1
Monitor the log files using (Ubuntu 12.04)
Check that the service loaded correctly
Example Output:
The service should load regardless of any sensor errors. It is only checked as a valid weewx service with no errors.
If an error occurs here then check the Hobby Boards Configuration / Engine section in the weewx.conf file
Check that the one wire sensors are reporting correctly.
Example Output:
*all sensors have been configured in this example.
Errors occur here if
* sensors unplugged
* Incorrect addresses
Most known critical errors are trapped and reported which should not stop weewx from continuing to run.
Please report all errors/bugs to ad...@wxblog.co.uk.
Accessing the archive database directly will also confirm that the data is being collected.
Out of all the sensors this has proven to be the most difficult to work/find out. Although at time of writing I have not contacted Hobby Boards directly.
The sensor reports current in microamps which is obviously proportional to light. However solar radiation is measured in W/m² so a conversion is required.
The formula used is one which was found on this website http://cocoontech.com/forums/topic/6452-solar-sensor-2/.
Initial testing compared to the theoretical value has proved favourable but to do this the sky has to be clear and the sun shining bright which does not happen often
here in the UK
so further testing and work on calibration is required.
For example some max day random selections.
| Station measurement | Theoretical measurement |
| 938 W/m² @ 14:36 | 833 W/m² |
| 740 W/m² @ 11:44 | 836 W/m² |
*Date/Time/location/atmospheric conditions have been considered in the theoretical calculation
No further conversion is required. The data reported from the sensor is the UV value.
The detector counts lightning strikes per archive interval. A basic threshold variable has been added to account for any minor noise.
counter_threshold = 2
The value can be set to anything that is required. In this example any detections of more than 2 are counted
anything less than equal 2 is set to 0.
Hi,I've been contemplating using weewx with my Hobby Boards anemometer (Inspeed), rain gauge and solar sensor currently processed via owfs - combined with outdoor temp, pool temp humidity and barometric pressure currently processed via an Arduino and logged in an sql database alaong with the Hobby Boards data,My first thought was to write a driver using the simulator as a guide based on variables for the latest readings passed from the current owfs and arduino.I then wondered, on seeing your script (great work BTW) if I could expand it to include the HB anemometer, rain gauge etc?Third option - Given the current readings are already in an sql database, using some php coding I put together - Is it possible to have an sql query based driver? Though this is unlikely to be an efficient way to set things up.Appreciate any advice on what might work or not work before I head much further into the planning.