Code for Peet Bros. Anemometer/Wind vane
Archiver
Posts: 46,084
Greetings,
Has anyone interfaced the "Peet Brothers" Wind Vane / Anemometer to a
BASIC Stamp? I am looking for samples of code you used successfully and
are willing to share with me.
The device description is available here:
www.peetbros.com/HTML_Pages/part2.htm#windsensor
"The ULTIMETER wind sensor is a patented, uniquely all-digital design
containing two magnetic switches. Each switch opens and closes once each
time the cups go around. Wind speed is calculated by measuring the time
between consecutive pulses from one switch. Wind direction is determined
by measuring the relative timing between pulses from the two switches.
North is indicated when the two sets of pulses exactly coincide. South is
indicated when pulses from one switch occur exactly midway between
consecutive pulses from the other switch."
Sounds like wind speed will be easy enough. But wind direction looks a
bit trickier to code. Any suggestions, code samples, or pointers to
online resources covering Stamp code for this sensor?
Thanks!
--- Jay Nugent
"Those that sacrifice essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." -- Ben Franklin (1759)
+
+
| Jay Nugent jjn@n... (734)484-5105 (734)544-4326/Fax |
| Nugent Telecommunications [noparse][[/noparse]www.nuge.com] (734)649-0850/Cell |
| Internet Consulting/Linux SysAdmin/Engineering & Design/ISP Reseller |
| ISP Monitoring [noparse][[/noparse]www.ispmonitor.net] ISP & Modem Performance Monitoring |
| Web-Pegasus [noparse][[/noparse]www.webpegasus.com] Web Hosting/DNS Hosting/Shell Accts|
| LinuxNIC, Inc. [noparse][[/noparse]www.linuxnic.net] Registrar of the .linux TLD |
+
+
5:01am up 23 days, 20:48, 4 users, load average: 0.32, 0.08, 0.04
Has anyone interfaced the "Peet Brothers" Wind Vane / Anemometer to a
BASIC Stamp? I am looking for samples of code you used successfully and
are willing to share with me.
The device description is available here:
www.peetbros.com/HTML_Pages/part2.htm#windsensor
"The ULTIMETER wind sensor is a patented, uniquely all-digital design
containing two magnetic switches. Each switch opens and closes once each
time the cups go around. Wind speed is calculated by measuring the time
between consecutive pulses from one switch. Wind direction is determined
by measuring the relative timing between pulses from the two switches.
North is indicated when the two sets of pulses exactly coincide. South is
indicated when pulses from one switch occur exactly midway between
consecutive pulses from the other switch."
Sounds like wind speed will be easy enough. But wind direction looks a
bit trickier to code. Any suggestions, code samples, or pointers to
online resources covering Stamp code for this sensor?
Thanks!
--- Jay Nugent
"Those that sacrifice essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." -- Ben Franklin (1759)
+
+
| Jay Nugent jjn@n... (734)484-5105 (734)544-4326/Fax |
| Nugent Telecommunications [noparse][[/noparse]www.nuge.com] (734)649-0850/Cell |
| Internet Consulting/Linux SysAdmin/Engineering & Design/ISP Reseller |
| ISP Monitoring [noparse][[/noparse]www.ispmonitor.net] ISP & Modem Performance Monitoring |
| Web-Pegasus [noparse][[/noparse]www.webpegasus.com] Web Hosting/DNS Hosting/Shell Accts|
| LinuxNIC, Inc. [noparse][[/noparse]www.linuxnic.net] Registrar of the .linux TLD |
+
+
5:01am up 23 days, 20:48, 4 users, load average: 0.32, 0.08, 0.04
Comments
are it will be longer than what the Stamp's internal timing routines
(PULSIN, RCTIME) will accommodate. You may need to us an external RTC:
reset the hundreds and seconds registers on the first pulse input, then
read it on the second. If you know what the angle versus time forumula
is it will be easy to go from there.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Jay Nugent [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=7RSARZapRmxXA1gjkKLM6NxmsgLuPbsVr-SDZb2QMBeqPUEgxu3B6w4MVb6aDFI_XlCd]jjn@n...[/url
Sent: Saturday, October 11, 2003 4:29 AM
To: basicstamps@yahoogroups.com
Cc: Jay Nugent
Subject: [noparse][[/noparse]basicstamps] Code for Peet Bros. Anemometer/Wind vane
Greetings,
Has anyone interfaced the "Peet Brothers" Wind Vane / Anemometer to a
BASIC Stamp? I am looking for samples of code you used successfully and
are willing to share with me.
The device description is available here:
www.peetbros.com/HTML_Pages/part2.htm#windsensor
"The ULTIMETER wind sensor is a patented, uniquely all-digital design
containing two magnetic switches. Each switch opens and closes once each
time the cups go around. Wind speed is calculated by measuring the time
between consecutive pulses from one switch. Wind direction is determined
by measuring the relative timing between pulses from the two switches.
North is indicated when the two sets of pulses exactly coincide. South
is indicated when pulses from one switch occur exactly midway between
consecutive pulses from the other switch."
Sounds like wind speed will be easy enough. But wind direction looks
a bit trickier to code. Any suggestions, code samples, or pointers to
online resources covering Stamp code for this sensor?
Thanks!
--- Jay Nugent
"Those that sacrifice essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -- Ben Franklin (1759)
+
-+
| Jay Nugent jjn@n... (734)484-5105 (734)544-4326/Fax
|
| Nugent Telecommunications [noparse][[/noparse]www.nuge.com] (734)649-0850/Cell
|
| Internet Consulting/Linux SysAdmin/Engineering & Design/ISP Reseller
| | ISP Monitoring [noparse][[/noparse]www.ispmonitor.net] ISP & Modem Performance
Monitoring |
| Web-Pegasus [noparse][[/noparse]www.webpegasus.com] Web Hosting/DNS Hosting/Shell
Accts|
| LinuxNIC, Inc. [noparse][[/noparse]www.linuxnic.net] Registrar of the .linux TLD
|
+
-+
5:01am up 23 days, 20:48, 4 users, load average: 0.32, 0.08, 0.04
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
On a Stamp or an SX chip, I think I'd take a state machine approach:
DO
start two timers at zero after the 1-->0 xition of the speed switch
increment the direction timer, wdt, only up to the 1-->0 xition of
the direction switch
increment the speed timer, wst, up until the next 1--> xition of
the speed switch
capture the value of both timers at the 1-->0 xition of the speed switch
then speed = k/wst units per second
and direction = 360 * wdt/wst degrees
LOOP
state var nib
wsx var bit
ws0 var bit
wdx var bit
wd0 var bit
wdc var bit
wst var word
wdt var word
' needs initialization sync here
DO
state=inA ' speed on in0, direction on in1 with pullups
wsx=state.bit0 ^ ws0 & ws0 ' wsx=1 on 1-->0 xition of speed switch
wdx=state.bit1 ^ wd0 & wd0 ' wdx=1 on 1-->0 xition of direction switch
ws0=state.bit0 ' update past states
wd0=state.bit1
wdc=wdc + wdx max 1 &(wsx-1) ' latch on wdx=1, reset on wsx=1
IF wsx THEN
debug dec wst,tab,dec wdt,cr ' results to output buffer,
first time thru is error
ENDIF
wst=wst + 1 &(wsx-1) ' increment speed counter, reset on wsx=1
wdt=wdt + (1-wdc) &(wsx-1) ' increment direction counter, until
wdc=1, reset on wsx=1
LOOP
Also may need an escape clause if the program ever has to do anything
else. Anemometers have a way of stopping dead for days at a time!
Can't claim that it was used successfully, but you'se get what you pay for!!
-- Tracy
>Greetings,
> Has anyone interfaced the "Peet Brothers" Wind Vane / Anemometer to a
>BASIC Stamp? I am looking for samples of code you used successfully and
>are willing to share with me.
>
> The device description is available here:
>
> www.peetbros.com/HTML_Pages/part2.htm#windsensor
>
>"The ULTIMETER wind sensor is a patented, uniquely all-digital design
>containing two magnetic switches. Each switch opens and closes once each
>time the cups go around. Wind speed is calculated by measuring the time
>between consecutive pulses from one switch. Wind direction is determined
>by measuring the relative timing between pulses from the two switches.
>North is indicated when the two sets of pulses exactly coincide. South is
>indicated when pulses from one switch occur exactly midway between
>consecutive pulses from the other switch."
>
>
> Sounds like wind speed will be easy enough. But wind direction looks a
>bit trickier to code. Any suggestions, code samples, or pointers to
>online resources covering Stamp code for this sensor?
>
> Thanks!
>
> --- Jay Nugent
>
>"Those that sacrifice essential liberty to obtain a little temporary safety
> deserve neither liberty nor safety." -- Ben Franklin (1759)
>+
+
>| Jay Nugent jjn@n... (734)484-5105 (734)544-4326/Fax |
>| Nugent Telecommunications [noparse][[/noparse]www.nuge.com] (734)649-0850/Cell |
>| Internet Consulting/Linux SysAdmin/Engineering & Design/ISP Reseller |
>| ISP Monitoring [noparse][[/noparse]www.ispmonitor.net] ISP & Modem Performance Monitoring |
>| Web-Pegasus [noparse][[/noparse]www.webpegasus.com] Web Hosting/DNS Hosting/Shell Accts|
>| LinuxNIC, Inc. [noparse][[/noparse]www.linuxnic.net] Registrar of the .linux TLD |
>+
+