Hobby Boards 1 Wire Support

1,310 views
Skip to first unread message

Mark Cressey

unread,
Jun 30, 2013, 4:03:42 PM6/30/13
to weewx-de...@googlegroups.com

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.

Screen Shots

 

Solar radiation graphLightning Detector GraphUV Readings

Main Install

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.

Install dependencies

Owfs

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

Test the one wire system

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

sudo python onewireident.py u

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:

Main Adapter – DS9490 Solar
Sensor address – 26.FB67E1000000
UV Sensor address – EE.1F20CB020800
Unknown Sensor DS1420 – 81.36193A000000
Lightning Counter address – 1D.28F807000000

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.

 

Install and configure onewireweewx.

Copy/move onewireweewx.py to the weewx user directory bin/weewx/shares/user

weewx.conf

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

[Hobby_Boards]
#
# This section is used to configure the addresses required
# for the Hobby Board one wire sensors to be detected by weewx
# By default the values are set at “” which = no sensors installed
# An example of an address = “EE.1F20CB010800″
# Other one wire devices will have the same start address
# 26.xxxxxxxxxxx = Solar Sensor / EE.xxxxxxxxxxxx = UV sensor / 1D.xxxxxxxxxxx = Lightning counter
# Port type u = USB or /dev/ttyS0?
#
solar_sensor = “”
uv_sensor = “”
lightning_counter = “”
port_type = “u”
#
#number of counts to reach before the counts are recorded in the archive database
#avoids the odd spurious detection
#
counter_threshold = 1

Add onewireweewx.py to the service list in (user.onewireweewx.oneWireSensors) weewx.conf.

#
# This section configures the internal weewx engines.
# It is for advanced customization.
#
[Engines]
[[WxEngine]]
# The list of services the main weewx engine should run:
service_list = weewx.wxengine.StdConvert, weewx.wxengine.StdCalibrate, weewx.wxengine.StdQC,user.onewireweewx.oneWireSensors, weewx.wxengine.StdArchive, weewx.wxengine.StdTimeSynch, weewx.wxengine.StdPrint, weewx.wxengine.StdRESTful, weewx.wxengine.StdReport

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.

scheema.py (lightning Detector)

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

                        (‘outTempBatteryStatus’, ‘REAL’),
(‘lightningCount’,        ‘REAL’),
(‘inTempBatteryStatus’,  ‘REAL’)]

# 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.

Testing and debugging

Set debug in weewx.conf to 1

Monitor the log files using (Ubuntu 12.04)

sudo tail -f /var/log/syslog

Check that the service loaded correctly

Example Output:

Jun 22 11:44:41 pileus weewx[5700]: wxengine: Finished loading service user.onewireweewx.oneWireSensors

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:

Jun 22 11:36:16 pileus weewx[15412]: **** 1 wire Radiation 99.64
Jun 22 11:36:16 pileus weewx[15412]: **** 1 wire UV          0.6
Jun 22 11:36:17 pileus weewx[15412]: **** 1 wire Lightning Last Count 1284
Jun 22 11:36:17 pileus weewx[15412]: **** 1 wire Lightning current Count         1286
Jun 22 11:36:17 pileus weewx[15412]: **** 1 wire Lightning Count 2
Jun 22 11:36:17 pileus weewx[15412]: **** 1 wire sensors updated

*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.

onewireweewx data calculations

Solar sensor

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 measurementTheoretical measurement
938 W/m² @ 14:36833 W/m²
740 W/m² @ 11:44836 W/m²

*Date/Time/location/atmospheric conditions have been considered in the theoretical calculation

UV sensor

No further conversion is required. The data reported from the sensor is the UV value.

Lightning Detector

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.

 

Future enhancements.

  • Actual Solar radiation Vs. Calculated Solar radiation on graph
  • Storm warning for x lightning counts.



Eirik Skorstad

unread,
Oct 30, 2013, 4:12:30 AM10/30/13
to weewx-de...@googlegroups.com, tango...@gmail.com
Good work Mark, 

I think you will need owserver and owhttp for this to work right?  In my case i am running a bunch of cron-jobs using the mounted file system done by owfs. As far as i know there is a limitation in the computer system to limit access to only one client at the time. When both instances are trying to access the usb bus at the same time, owfs shuts down.. 


Eirik Skorstad

unread,
Oct 30, 2013, 6:14:18 AM10/30/13
to weewx-de...@googlegroups.com, tango...@gmail.com
Forgot to mention the message from syslog when this happens.. 

Oct 30 10:52:01 odin OWFS[14834]: DEFAULT: ow_reconnect.c:(70) Failed to reconnect DS9490 bus master!
Oct 30 10:52:01 odin OWFS[14834]: DEFAULT: ow_reconnect.c:(72) DS9490 bus master reconnected
Oct 30 10:52:01  OWFS[14834]: last message repeated 3 times
Oct 30 10:52:01 odin OWFS[14834]: DEFAULT: ow_reconnect.c:(70) Failed to reconnect DS9490 bus master!
Oct 30 10:52:06  OWFS[14834]: last message repeated 2 times
Oct 30 10:52:06 odin OWFS[14834]: DEFAULT: ow_reconnect.c:(72) DS9490 bus master reconnected
Oct 30 10:52:08 odin OWFS[14834]: DEFAULT: ow_reconnect.c:(70) Failed to reconnect DS9490 bus master!
Oct 30 10:52:49  OWFS[14834]: last message repeated 13 times
Oct 30 10:52:55 odin OWFS[14834]: DEFAULT: ow_reconnect.c:(70) Failed to reconnect DS9490 bus master!
Oct 30 10:53:01  OWFS[14834]: last message repeated 2 times

I have also tried to change from "/uncached/" to deviceId in onewireweewx.py to read from cache, still with the same result.. OWFS is working great and have been rock stable now for over two years. Seems like there is a communication problem between onewireweewx module and owserver, but i am not sure. All these error and reconnect messages are quite confusing.  
Message has been deleted

Andrew Creahan

unread,
Dec 16, 2013, 3:30:19 AM12/16/13
to weewx-de...@googlegroups.com, tango...@gmail.com
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.

mwall

unread,
Dec 21, 2013, 9:17:09 AM12/21/13
to weewx-de...@googlegroups.com, tango...@gmail.com
one-wire people,

mark's implementation is a weewx service - this is an excellent approach if you have a weather station as well as one-wire sensors and you want to combine the data.

here is a different approach that uses a weewx driver to collect data from one-wire devices:

https://sourceforge.net/p/weewx/wiki/owfs/

this approach might be more appropriate if everything is one-wire.

suggestions are welcome.

m
Reply all
Reply to author
Forward
0 new messages