Original Dallas Semiconductor 8 reed switch wind vane with DS2407 and DS2401 1-wire chips

89 views
Skip to first unread message

Bret Craytor

unread,
Mar 23, 2020, 12:55:52 PM3/23/20
to weewx-user
Hey!

Which sensor type should I use in my OWFS WEEWX conf file?  I have the addresses of the DS2401's on the PCB layout:


     D     E     F 
     C            G
     B     A     H
            II
            II  -mount side (viewed from top of PCB 


A:  01.B5374A040000
B:  01.B2374A040000
C:  01.BA374A040000
D:  01.B7374A040000
E:  01.C6374A040000
F:  01.C3374A040000
G:  01.BD374A040000
H:  01.AE374A040000

As you can see, the first two digits after the dot are the only values that change.  Surely someone out there has already made a sensor type file for this, and can help with my weewx.conf file setup.

I had some earlier posts and recieved great help, but have had to keep putting the project down to do other tasks, but with the COVID-19 instructions for staying home, here I am!  Thanks for your help WEEWX community!

Bret Craytor

Bret Craytor

unread,
Mar 23, 2020, 9:54:35 PM3/23/20
to weewx-user
I have searched high and low on this group to look for old threads, seems everyone has the voltage Wind Direction using OWFS.
Can someone just point me in the right direction or to the right forum?  Looked at OWW too.  Thanks for any and all input.

Bret Craytor

Glenn McKechnie

unread,
Mar 24, 2020, 12:34:26 AM3/24/20
to weewx...@googlegroups.com
I don't have one of these, so what follows is only building on what
you've reported.

As you say, the weewx-owfs driver appears to be focused on voltage
sensing/conversion.
As I recall the AAG windvane (at least the one I had and can't find)
used reed switches so its logic started from simple switching and that
worked with the OWW software. The very early AAG windvane was a direct
copy of the original Dallas windvane so perhaps there is code in OWW
for it?

Viewing the src/weather.c from OWW it mentions a DS2407 in association
with 8 DS2401's and while that references Dallas's original Win32
software there is another reference. Later in the file it suggests OWW
does a search for a DS2407 Vane switch and is happy if it finds one...

line number 3281 of weather.c

ReadWindDirection ( /*uchar SwitchID[8] */ int vane)
{
int dira = -1, dirb = -1, i, found = 0;
uchar DirSN[MAX_DEVS_SEARCH][8];
int p ;
p = devices_portnum(vane) ;

memset ((void *) DirSN, 0, MAX_DEVS_SEARCH * 8 * sizeof (uchar));

/* Access the Vane Switch - Vane IDs are behind this */

if (!devices_access (vane))
{
werr (WERR_AUTOCLOSE, _("Could not access Vane Switch"));
return -1;
}

/* connect channel B of DS2407 */
/* There shouldn't be any trouble here, but may as well
* use the robust function */
if (!set_switch_robust (vane, SWITCH_AOFF_BON, SWITCH_TRIES))
{
werr (WERR_DEBUG0, "Connect channel B of DS2407 failed");
return -1;
}

/* delay to allow presence pulse to proceed */
msDelay (10);

/* record all of DS2401's found */

In short, it appears to have some relevant code. (Assuming I'm reading
it correctly)

Also, looking back in the weewx-user archive I note that you detected
2 DS2406s using OWFS.py The DS2407 is the next gen version of that
semi.

Have you tried running this using OWW?
https://sourceforge.net/projects/oww/

If that works, well ... ?

As a final note, I just found the following that was linked from a
2015 weewx-user post
https://groups.google.com/forum/#!topic/weewx-user/Nn0P0xzxTaY
and that points to a very informative document
https://web.archive.org/web/20061018205111/http://archives.sensorsmag.com/articles/0698/wir0698/
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/f7f62c61-c80f-46a3-b06e-47fa18978dc1%40googlegroups.com.
>


--


Cheers
Glenn

rorpi - read only raspberry pi & various weewx addons
https://github.com/glennmckechnie

Glenn McKechnie

unread,
Mar 24, 2020, 4:22:07 AM3/24/20
to weewx...@googlegroups.com
Further to this, and referencing the following article...
https://www.element14.com/community/groups/internet-of-things/blog/2015/01/07/old-meets-new-the-1-wire-weather-station-on-the-spark-core-part-5

You have reed switches that are normally open (off).
They are connected to identifiable locations (unique DS2401 id code
corresponding to a compass direction.)
Depending on the position of the wind vane, the magnet will close the
reed switch and power up the DS2401 when the DS2407 is turned on.

So, If the DS2407 is queried , by turning it on (and immediately
afterwards it must be turned off ) then the ID of the DS2401 can be
read by the bus, that value can then be passed to the software where
its cardinal value can be returned. It can easily return 8 points,
with a little more interpretation it can return up to 16 points (if it
reads 2 DS2401 ids).

Seems reasonably simple. :-) Don't think I missed any show stoppers!

It would be within the scope of owfs.py, once a mechanism of cleanly
querying the DS2407 is worked out.
owfs.py can certainly read an id, and the comparison function might be
a little unwieldy but its not a unique problem. (The example above
already has the getValues() {[...]} code which translates to a series
of python elif 's)

If the unit still works (testing the unit as per my previous post with
OWW) then it would be worth pursuing (nothing worse than a dead unit
when writing code! Been there done that.)

Bret Craytor

unread,
Mar 30, 2020, 6:07:53 PM3/30/20
to weewx-user
) pop up (two addresses if in between two reed switches they both close).
  
so, in my data,

if A is north 01.B5374A040000 returns as the address, if North by NE then both 01.B5374A040000 and 01.B2374A040000 return as addresses.  I guess I can really try to fumble thru writing code, I was just sure that as long as weewx has been out there, that someone else had already got this to work and I wouldn't be recreating the wheel.  The unit is in near new condition, with only some dust on it and a very little warp of the wind vane feather which does not alter function.  Really would like to get it out on a pole on the top of my castle, LOL.  I certainly appreciate all your input, and I had found those articles as well, just couldn't find any code for the reed switch wind vane..  Am I right that OWW is written in C and WEEWX in python?

Thanks!

Bret Craytor

On Monday, March 23, 2020 at 11:55:52 AM UTC-5, Bret Craytor wrote:

Glenn McKechnie

unread,
Mar 30, 2020, 7:46:02 PM3/30/20
to weewx...@googlegroups.com
On 31/03/2020, Bret Craytor <bretc...@gmail.com> wrote:
> ) pop up (two addresses if in between two reed switches they both close).

Is there something missing before that text?

> so, in my data,

What data is this? The diagram with DS2401 id's or output of owfs.py or...?

> if A is north 01.B5374A040000 returns as the address, if North by NE then
> both 01.B5374A040000 and 01.B2374A040000 return as addresses.

This is encouraging, especially if it's owfs.py returning them on a
sensor query.

> I guess I can really try to fumble thru writing code,

I'm willing to help, I have a reasonable understanding of owfs.py
having tweaked it for my own purposes.
I've ordered some DS2406's and DS2401's but I imagine they'll take a
month to arrive, if ever given the current situation.

> I was just sure that as long as
> weewx has been out there, that someone else had already got this to work
> and I wouldn't be recreating the wheel.

Not much 1-wire stuff around any more, sadly it's been left behind. It
was probably embraced by the electronics buffs / hacker space more
than those who actually wanted a weather station. Thankfully weewx
arrived and mwall & co put together the owfs.py driver.

> The unit is in near new condition,
> with only some dust on it and a very little warp of the wind vane feather
> which does not alter function. Really would like to get it out on a pole
> on the top of my castle, LOL. I certainly appreciate all your input, and I
> had found those articles as well, just couldn't find any code for the reed
> switch wind vane.. Am I right that OWW is written in C and WEEWX in
> python?

Mint condition! Definitely worth doing.
Correct , OWW is in C, WeeWX is in python.

Until the chips arrive here, and in the absence of help from other
quarters we should be able to do something in python.
If the results that you have already are from your own coding
endeavours then we're well advanced.
If they aren't and you're happy to expose the weather station to shell
access. eg:- Connect it to a firewalled Pi and punch a hole for ssh
access then we can tackle it that way.

If either of those options suit, contact me off list. If (when) we get
something we can post the result back to the list and add it to
owfs.py... for all the other original Dallas weather station owners
:-))
> --
> You received this message because you are subscribed to the Google Groups
> "weewx-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to weewx-user+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/b07ebb88-c544-43d8-936f-3cb8a8c569cc%40googlegroups.com.

Bret Craytor

unread,
Mar 31, 2020, 4:19:21 PM3/31/20
to weewx-user
Glenn,

Indeed something got cut off on the beginning.  Not sure how that happened but it was a little background on me and my minimal programing experience with an Ames breadboard computer back in '79 when I was in college and it was for Electronics for Scientists class.  I was not the best of programmers, but I love tinkering with this stuff.  and the addresses you see are from my PYTHONPATH=  blah blah --Sensors read as well as from OWFS Localhost:2121, I can surely send you the data on what each sensor returns.  I set the thing up in front of a fan to watch the wind speed!  LOL.  2.5 to 3 mph....I still have not calibrated the tiping-bucket rain guage (the original DS round one).  I can set up a window with VNC for you if you can help, or an SSH.    I don't know how to privately message you other than thru e-mail.  I will post an excel file with all the addresses of the chips I have and what I have them for.  my first message on this thread has the layout of the PCB reed switches in that stick figure with the addresses listed below for the windvane.

Bret Craytor



On Monday, March 23, 2020 at 11:55:52 AM UTC-5, Bret Craytor wrote:

Bret Craytor

unread,
Mar 31, 2020, 4:22:42 PM3/31/20
to weewx-user
BTW,  Trying to get OWW to work and keep getting hung up with the GTK+, ugh.  I can't get past the ./configure.



On Monday, March 23, 2020 at 11:55:52 AM UTC-5, Bret Craytor wrote:

Glenn McKechnie

unread,
Mar 31, 2020, 5:26:15 PM3/31/20
to weewx...@googlegroups.com
Hi Bret

On 01/04/2020, Bret Craytor <bretc...@gmail.com> wrote:
> BTW, Trying to get OWW to work and keep getting hung up with the GTK+,
> ugh. I can't get past the ./configure.

From your previous mail it sounds like you're getting some useful
responses from the unit, we'll take that as an indicator that it's all
good. Soon find out otherwise.
I've got some working code for the direction sensing, just need to be
able to get the DS2401s responding via owfs.py.
I'll contact you off list regarding the ssh connection and setup.

Glenn McKechnie

unread,
May 21, 2020, 11:24:24 PM5/21/20
to weewx...@googlegroups.com
On the off chance that there are any more original 1-wire Dallas
weather stations that are ready to be dusted off and redeployed, then
there is a modified driver available at...

https://github.com/glennmckechnie/weewx-owfs

It's based on mwalls original owfs.py driver but for the time being it
has been renamed as owfs-dallas.py. It should be a drop in replacement
for owfs.py but there are a couple of additional changes.
It has been running with weewx4.0.0b18, the only issue appears to be a
hardware one. A second data point would be handy to have, but we
won't hold our breath.

weewx.conf will be modified to point to the new file.
[OWFS]
driver = user.owfs-dallas
Reply all
Reply to author
Forward
0 new messages