Added sensors to weewx and Pi

1,980 views
Skip to first unread message

Neville Davis

unread,
Apr 7, 2016, 9:06:25 PM4/7/16
to weewx-user
I am breadboarding with a pi and weewx my own weather station. I have a WMR200a with weewx and it has been running for a couple of years. I have noticed that there have been other queries about adding sensors to weewx but no follow up if they were successful.

I am providing here what I have working incase others may be interested. The sensors in use so far are the BMP280 and SHT31, as well as OWFS rain sensor. I am in the process of adding a davis wind vane and direction.

The screen shots show how the 2 temp sensors track and you can see the effect when I turned on the aircon for a test.

Run simplest to get data from the BMP280 (enable the debug data), and the sensordata script is the main script to create the csv file for weewx.

Because there is a lot of writing to the SD card I have created and use a RAM disk.

Hope this maybe useful

Neville 
BMP280.py
sht31.py
simpletest.py
sensordata.py
Screen Shot 2016-04-08 at 10.36.14 AM.png
Screen Shot 2016-04-08 at 10.36.23 AM.png
Screen Shot 2016-04-08 at 10.36.37 AM.png

Glenn McKechnie

unread,
Apr 8, 2016, 5:12:50 AM4/8/16
to weewx-user
A good post.
I'm always interested in what others are doing with their weather set-ups - sensors, skins, code, you name it.
I've stuck with the 1-wire sensors - principally from hobby-boards (who are, sadly, now going out of business) or e-bay for the temperature sensors - but there seems to be a wealth of knowledge and projects out there for the likes of Arduino, which then seem to find their way over to the pi. Alternatives are always good!

You mention the owfs rain sensor - is this a rain guage with a counter module? If so, and it's a hobby-boards counter, then connect the +5v line up and save yourself some potential heart ache. I had absurd values cascade in during wet, or humid weather and I finally tracked it down to the reed switch side of the counter floating (voltage wise) it would drop to a level where the logic couldn't decide it's state and so the counter kept having a bet each way; 3 metres of rain in an hour was one of the clues that something wasn't working correctly. (we aren't tropical here :)
The wire run is about 30 metres - with 8 sensors of varying types and the USB adaptor apparently don't allow much current draw so maintaining voltage at DQ is critical. Exterior grade Cat 5e for the cable run also helps preserve any losses.

Anyway - off to research some of your sensors now.

Neville Davis

unread,
Apr 8, 2016, 6:07:49 AM4/8/16
to weewx-user
I did get the hobby boards rain wise unit. It currently sits on the floor next to the PI, so no great problems. Very interesting about your problems I will keep them in mind as I build the hardware and do the installation. The run from my roof to the pi position will not be that long, but I was already looking at type of cabling etc. My i2C boards (some will be some distance away I have on order several P82B715 to extend the i2C bus. 

My main motivator to do this apart from it being  interesting and a challenge, was that my wmr200a on occasion gives spurious rain values into weewx, and my pressure sensor sudden drops to some cyclonic pressure level on bright sunny days.....

My sensors are on the adafruit breakout boards.

Neville

Neville Davis

unread,
Apr 16, 2016, 8:21:10 PM4/16/16
to weewx-user
Just an update.
I have now bread boarded the following sensors, and reading data in weewx. SHT31 (temp humidity), BMP280 (pressure temp), Davis 6410 via opto isolator to GPIO and wind direction via 16 bit ADC ADS1115, TSL2591 (solar radiation), SI1145 (UV index). Rain via OWFS and wind now installed and active, the rest I have to design and build enclosures etc...so the fun begins. The i2c extenders have arrived so can no longer procrastinate.
One thing I have really noticed with weewx and the Pi ( one of my old model B's) is how the Pi is now handling all that I throw at it. In one of my earlier installs I had issues with running cmon forecast my skin default skin etc, cmon had gaps in data and it was taking a about 90 secs to update everything, now 45 secs and cmon perfect.
When I finally get it all together I will put details of the construction on WXforum, and how it all turns out on weewx here.

Nev

mwall

unread,
Apr 16, 2016, 9:17:28 PM4/16/16
to weewx-user

nice work neville!  thank you for publishing what you have done.  performance details are always welcome.

once you have everything tidied up, could you create a 'final report' on the weewx wiki?

then you can link to that from this forum and/or wxforum.

forums wonderful for discussing and tracking issues, but they are really poor as the destination for "go here for instructions" or "go here to download x".  after a few months of churn it is hard to find specific artifacts.  the wiki (or even a separate repository) is better suited for that.

m

Neville Davis

unread,
Apr 16, 2016, 10:03:08 PM4/16/16
to weewx-user
Ok I had not thought of the wiki, I had put my RTC config for Jessie on there. 

Speaking of months it will be awhile before the project is completed, but when done so I will put up the details.

As to the specs (accuracy of data) my only real comparison locally is my wmr200a and other local PWS with data on WU.

I am on the wrong side of 70 years, so another reason for this is to keep my mind active.

Nev

Andy

unread,
May 10, 2016, 10:34:15 PM5/10/16
to weewx-user
Funny, I modified the same Nick McColl script for my system also.  Code is here, definitely a work in progress.  The script creates a file which the Weewx file parse driver reads.  Currently the outside temperature,  outside humidity, and anemometer are being read by the script, but this is my first real try at Python so there may be some issues.  Also my math to convert revolutions and convert the output of the A to D converter may have issues.  The Davis Anemometer (pinout here) is working with a ADS1115-ADC for wind direction.  Temp and humidity is a AM2320.  I ordered a BMP180 but it appears to be lost in the mail so just ordered BMP280.

But it seems that a RaspberryPi would use too much power to be ran on a small solar panel and battery and also not sure if the Pi will survive the Sacramento Valley summer temperatures.  I have a couple C.H.I.P. boards coming next month so that may work.

It is inside so there is no wind unless the fan is on, but the temperature and humidity is here and cmon.

Neville Davis

unread,
Jun 14, 2016, 8:42:57 PM6/14/16
to weewx-user
An update. I have now installed and made operational all except my UV and solar sensors (yet to decide on mounting). For those that might be interested in the i2C bus as a means of attaching sensors, I can assure you they work perfectly with range extenders installed. My current config has 2 runs, one with pressure/temp at the end (25 meters), 7 meters from the end ( of the 25 meter run) I drop to another temp/ humidity sensor). The second run goes out to my FARS ( my adaption of one found on the web) with temperature and humidity, this run is 17 meters. This run will have a drop to the UV and solar sensors.
My FARS has its fan controlled by the Pi and I monitor its rotation at the Pi.
It is early days of comparison between the data from my wmr200a and this system, but already I see significant difference in the temp at max and min. The wmr indicates hotter and colder, but tracks almost perfectly at other times. Unfortunately we are in the middle of winter and daytime temps are only getting to about 23 deg c and nights about 10 deg c. So no extremes to really test.
I have started to compile my construction manual, with some pics and will post them to wiki when finished. This might take awhile :).

I have some ideas about the UV and solar install but if anybody has an example of a working sensor install I would appreciate it.

Neville

David Hathaway

unread,
Jun 15, 2016, 8:44:28 AM6/15/16
to weewx-user
Interesting that you mention the WMR200a having issues at temperature extremes.  During the hot hours here, my WMR200a is 5-15F hotter than surrounding stations.  I always thought it was because it is stationed above a metal roof in full sunlight... but the roof is flat white and oxidized and not reflective, and the WMR200a is at least 10' above all but the peak.  I wonder now if the WMR200a is just generally failing at the ends of the temperature range?  (We hit 95F/35C yesterday)

I thought about adding a solar aspiration fan (like this one), but it is failing in so many respects that I am now saving my pennies for a Davis system.

Andrew Milner

unread,
Jun 15, 2016, 9:01:50 AM6/15/16
to weewx-user
You may find this interesting (or not as the case may be!!)

I have my temp and humidity sensor for my FineOffset mounted inside a screen housing made from plant drip trays with spacers between the trays.  Seems to work quite well.
weatherstation.jpg

Horacio

unread,
Jun 15, 2016, 9:14:40 AM6/15/16
to weewx-user
Hello Neville:

About the UV sensor, you can use a Reyax UVI-01. It's quite cheap on ebay o Aliexpress. It's an analog sensor so you will need an ADC like an ADS1015 or MCP3008 or an arduino connected to the Pi through the uart.

The output voltage is very low so It would be better to use the ADC amplifier or a very low voltage reference to do the math. I've calculated the equation acording to the datasheet. (I hope not to be wrong, It's winter here and I couldn't test it as it should)

I attached the UV service program, a second one that grabs data from internet (web scraping) and the reyax datasheet.

I hope this helps you!
uv.py
uvIndex.py
UVI-01 Ultraviolet Rays Detector - Reyax.pdf

Neville Davis

unread,
Jun 15, 2016, 5:03:43 PM6/15/16
to weewx-user
When I have enough data I will graph and post here. I was quite surprised with the initial readings.

Neville

Neville Davis

unread,
Jun 15, 2016, 5:14:03 PM6/15/16
to weewx-user
Yes I had already read this info and several other sites about siting and shields. I was convinced this was the way to go ( a screen of some kind), then I read about several people building these fan assisted systems so decided to give it a go. I was really convinced when I read the technical data Davis supplied about their own.

Neville

Neville Davis

unread,
Jun 15, 2016, 5:21:24 PM6/15/16
to weewx-user
Thanks very much for the info, I will look into it.

I need to know the best way to physically install the sensors, for example the material to use for the window of the container they are in. There seems to be different requirements for UV and solar radiation....

Neville

Neville Davis

unread,
Jun 15, 2016, 9:58:47 PM6/15/16
to weewx-user
attached you can see the last 24 Hrs graphed from an xl spreadsheet. The red is the FARS and the blue is the temperature from the WMR200a. This is data from my db so is not degC it is degF. The point to note is that this morning we have had an extended period of sunshine with a short period of heavy cloud and you can see how the graph for the WMR ramps far higher than the FARS readings.
The FARS and WMR sensors are within 5 meters of each other, the FARS is mounted on my pool fence and is drawing air over a grassy area and is about 2 meters of the ground. The wmr200a sensors are on a pole mounted on a screening fence and is about 3.5 meters of the ground.

Neville

On Friday, April 8, 2016 at 11:06:25 AM UTC+10, Neville Davis wrote:
24 hrs data.jpg
FARS.jpg
WMR200a sensors rain gauge Davis wind gear.jpg

Ruben Navarro Huedo

unread,
Jan 19, 2017, 4:18:29 PM1/19/17
to weewx-user
A lot of thank's for this great post.
I will install only a bmp280.
Can i use your scripts with it? (i will not use sht31)

Thank's a lot.

Neville Davis

unread,
Jan 20, 2017, 7:25:33 AM1/20/17
to weewx-user
I have recently updated the weewx wiki with some mods to scripts. I am now using a 180 instead of the 280...it failed on me and I had a 180 lying around. I also now have UV operational and working on a responsive skin.
The wiki has a link to my station
Use any scripts as needed.

Neville

Ruben Navarro Huedo

unread,
Jan 20, 2017, 4:49:54 PM1/20/17
to weewx...@googlegroups.com
a lot of thanks 
I will do !

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/SO8dGWtBaxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Craig Thom

unread,
Mar 30, 2017, 5:52:25 PM3/30/17
to weewx-user
Forgive me for being stupid, but this is all new to me.

It's the last step, getting the data to weewx, that I'm fuzzy on.  Do you import the csv file with wee_import?

I am going to play with reading my Acurite (and other) wireless sensors using SDR, which means I can eliminate their display system, but that means I lose the pressure sensor.

(My RTC is sitting on top of the i2c pins, so I think I'm going to try using SPI, but that's a different issue, and I'm going to try and fail before asking for help with that.)

My main question is how to get the data to weewx so it then gets archived with all the other data.

Craig Thom

unread,
Mar 30, 2017, 8:25:35 PM3/30/17
to weewx-user
Never mind.  I've got it.  If I'm going to be using the SDR driver for everything but this one sensor, I should create a service that runs in the data_services period that binds to weewx.NEW_ARCHIVE_RECORD .  That way I don't have to write anything to disk .

Now I just need to learn Python.  That should be fun.

  
Reply all
Reply to author
Forward
0 new messages