Hi Matt -

If you decide to explore using Python for this project, consider that you can setup a dictionary (Python's hash table) with the key being a tuple of the A, B, C, D values for very easy lookup of the direction. Something like this:

direction = {
    (2, 4, 4, 4) : 'N',
    (2, 4, 4, 0) : 'NNW',
    (4, 4, 4, 0) : 'NW',
    (4, 4, 0, 0) : 'NWW',
    (4, 4, 0, 4) : 'W',
    (4, 0, 0, 4) : 'SWW',
    (4, 0, 4, 4) : 'SW',
    (0, 0, 4, 4) : 'SSW',
    (0, 4, 4, 4) : 'S',
    (0, 4, 4, 2) : 'SSE',
    (4, 4, 4, 2) : 'SE',
    (4, 4, 3, 3) : 'SEE',
    (4, 4, 2, 4) : 'E',
    (4, 3, 3, 4) : 'NEE',
    (4, 2, 4, 4) : 'NE',
    (3, 3, 4, 4) : 'NNE',
}

Then, a simple lookup would give you the direction for a given set of values:

    print direction[ ( int(A), int(B), int(C), int(D) ) ]

The reason that I used the integer values instead of the floats as originally specified is because I'm not sure about any tolerance for the float values that are read and that the tuple from integer values results in a series of unique keys. Note that any tuple that's not found would result in an KeyError exception raised. If you want to avoid this, then:

    print directions.get( ( int(A), int(B), int(C), int(D) ), 'Unknown')

will print the direction or Unknown.

Also if you do go the Python route for your code, take a look at http://www.equi4.com/metakit/python.html. MetaKit provides an embedded database that's very easy to use but provides access to set arithmetic against the data without the need of SQL...

- Peter


On 6/4/05, Matt <[EMAIL PROTECTED]> wrote:
I took more time and now see that there are 16 positions.

        A               B               C               D
N       2.35566 4.61546 4.61241 4.61116
NNW     2.33621 4.55952 4.56218 0.0659385
NW      4.59905 4.5828  4.58609 0.0642197
NWW     4.54929 4.54452 0.0621103       0.0647666
W       4.59999 4.58179 0.065626         4.58976
SWW     4.56851 0.0666416       0.0652354       4.54296
SW      4.59796 0.0608603       4.58374 4.58234
SSW     0.0680479       0.0581259       4.54874 4.54304
S       0.0635947       4.58179 4.58851 4.59101
SSE     0.0628135       4.56007 4.58554 2.33363
SE      4.60796 4.60702 4.60499 2.36136
SEE     4.59937 4.60163 3.16349 3.17145
E       4.62007 4.61171 2.35808 4.60921
NEE     4.61226 3.16583 3.16388 4.59976
NE      4.61484 2.35636 4.60866 4.61655
NNE     3.17927 3.16395 4.59999 4.6039

Which seems to be supported by this I found...
http://www.sensorsmag.com/articles/0501/34/main.shtml

Any clever way to convert values to directions ?
Or do I just kludge it with many IFs and ANDs ?



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto: [EMAIL PROTECTED]] On Behalf Of Paul
Alfille
Sent: Saturday, 4 June 2005 12:14 PM
To: owfs-developers@lists.sourceforge.net
Subject: Re: [Owfs-developers] 1wire weather station v3

The second set of voltages is just the first set at half intensity. As I
recall, the voltage range is either 0-5 or 0-2.5 and the Volts2 is the same
readings interpreted over the smaller range. No additional information.

On Friday 03 June 2005 07:40 pm, Matt wrote:
> There appears to be 8 reed switches, and two rotating magnets arranged
> adjacently.
> Perhaps one is not a magnet, and just a counter weight.
>
> I marked one of these magnets and then rotated the vane shaft 45% and
> took a reading, and repeated until the marked magnet was back to the
> original position. (previous table)
>
> I've just checked though and there are other valuse combinations, and
> also a second set of four volt values.
> So perhaps there are more than eight recordable positions.
>
> volt.ALL       0.0658604, 0.0600009, 4.55241, 4.5428
> volt.A        0.0644541
> volt.B        0.0661729
> volt.C        4.54171
> volt.D        4.54741
> volt2.ALL     0.0352349 , 0.0302348, 0, 0
> volt2.A       0.0351568
> volt2.B       0.0298442
> volt2.C       0
> volt2.D       0
>
> More research needed...
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] ] On Behalf Of
> Alfille, Paul H.,M.D.
> Sent: Saturday, 4 June 2005 2:50 AM
> To: owfs-developers@lists.sourceforge.net
> Subject: RE: [Owfs-developers] 1wire weather station v3
>
> Vey interesting. I'm surprised directions 5-8 don't have two channels
> with non-saturated values. (A between position.)
>
> Paul
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] ]On Behalf Of Matt
> Sent: Friday, June 03, 2005 8:47 AM
> To: owfs-developers@lists.sourceforge.net
> Subject: RE: [Owfs-developers] 1wire weather station v3
>
>
>
> Well, I opened it up and had a look, the 8 directions each with 4 volt
> readings, translates to the following table.
>
>       1       2       3       4       5       6       7       8
> A     *0      4.5     4.5     4.5     *2.3    4.5     4.5     4.5
> B     4.5     *0      4.5     4.5     4.5     *2.3    4.5     4.5
> C     4.5     4.5     *0      4.5     4.5     4.5     *2.3    4.5
> D     4.5     4.5     4.5     *0      4.5     4.5     4.5     *2.3
>
> I notice much talk of RRD, and it does look interesting, but I was
> thinking I would keep my data for many years and writing the graph
> code is part of the challenge for me.
>
> Mysql would be my db of choice, but the interpolation features of RRD
> look intriguing.
>
> I think I may use this project as an opportunity to play with python,
> I hear nothing but praise for this language.
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit
> http://developer.yahoo.net/?fr=fad-ysdn-ostg-q22005
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you
> shotput a projector? How fast can you ride your desk chair down the
> office luge track? If you want to score the big prize, get to know the
little guy.
> Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you
shotput a projector? How fast can you ride your desk chair down the office
luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to