Shop OBEX P1 Docs P2 Docs Learn Events
weather station — Parallax Forums

weather station

Earl FosterEarl Foster Posts: 185
edited 2009-01-09 21:05 in BASIC Stamp
I am using a basic reed switch anemometer connected to a BS2px.· Wind speed for this anemometer is 2.5 MPH for one rotation in one second.· http://www.inspeed.com/anemometers/Vortex_Wind_Sensor.asp.· It would seem pretty straight forward to program but I am most definitely doing something wrong.·
·
The anemometer is connected like an active low switch to Pin 2.
·
I am using the COUNT command to read the number of times the reed switch closes and opens.· Since I am using the PX version the duration range for COUNT is .000287 second and if I divide that number into 2 seconds I get 6968 for my timing.
·
· COUNT 2, 6968, Counts ' Count number of full rotations on pin 2 for 2 seconds
· Counts = Counts / 2···· ‘ Divide that by 2 to get number of counts per second
· ································· ···' Scale of vortex is 2.5 mph per revolution per second
·
· wSpeed = Counts * 25 / 10 ‘ Multiple counts by scale of 2.5
·
I have been trying to figure out why I am not getting the proper windspeed readout. ··The readings all over the place while testing at different speeds.
·
Perhaps someone can tell me what I am doing wrong.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
WWW.HAPB.NET

"Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman

Comments

  • $WMc%$WMc% Posts: 1,884
    edited 2009-01-06 23:59
    Mr. Foster

    I believe the problem is contact bounce. Try using a square wave frequency generator to test Your code, If it works ,then You'll need a debounce subroutine.

    Take a look at Experiment #14 in the StampWorks Manuel.

    ______________$WMc%________________

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Truth is out there·········································· E=$WMc%2

    Post Edited ($WMc%) : 1/7/2009 12:05:07 AM GMT
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-01-07 03:00
    In PBASIC Help we read,
    "If you use COUNT on slowly changing analog waveforms like sine waves, you may find that the value returned is higher than expected. This is because the waveform may pass through the BASIC Stamp’s 1.4-volt logic threshold slowly enough that noise causes false counts. You can fix this by passing the signal through a Schmitt Trigger, like one of the inverters of a 74HCT14. Or, you may use the BS2px’s built-in Schmitt-Trigger pin property; see·CONFIGPIN for details.”

    Now, you're not dealing with a sine wave, but you're not spinning that device like mad either and use of the Schmitt-trigger may prove advantageous.
  • Tex4uTex4u Posts: 30
    edited 2009-01-07 03:14
    Hey Earl,

    I'm looking forward to seeing your weather station in the Completed Projects Forum. I've been pushing my version of the WS project to the back burner for too long.

    Good luck with yours!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The more I look for common sense in the world...

    the more·I·find how un-common it is.
    ·
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-01-07 07:44
    I agree that it is usually an issue of contact bouce. You can try an RC debouncer something like this:
    OL2windRC1.gif
    That is part of an article on intefacing the Stamp to an anemometer.

    The conversion formula is
    mph = 2.5 * counts / seconds
    If you count for 2.5 seconds instead of 2 seconds, then the counts result will equal mph without any further math:
    COUNT 2, 8711, counts ' scaled for the BS2px
    mph = counts

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Earl FosterEarl Foster Posts: 185
    edited 2009-01-07 19:07
    Thanks for reply.· Last night I noticed the PX had the Schmitt trigger function built in and tried it this morning.· Switch bounce was the problem.· I tested it at speeds up to 70 MPH and it works great.· I did not bring enough electronics with me on my trip to the Death Valley so building circuits is limited but I will try Tracy's circuit to see if it is more accurate when I get home.· Now that it is working I can measure winds and direction on the mountain tops.

    Thanks again.

    Final code posted

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    WWW.HAPB.NET

    "Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
  • MikeSMikeS Posts: 131
    edited 2009-01-07 21:54
    Hi Earl,
    What type of weather vain do you have the compass module mounted on?

    Thanks,
    MikeS
  • Earl FosterEarl Foster Posts: 185
    edited 2009-01-08 03:49
    Currently I do not have the compass attached to a weather vain. Since I am in the desert right now it is a manual process of pointing the compass in the direction of a small flag I have attached to my truck. When I get home I will look to see what is out there but more then likely I will end up making my own.

    I am planning to attach the weather station to my balloon projects to measure winds speeds at 100,000+ feet. This will allow me to monitor actual wind speeds verses projected wind speeds and make tracking course correction during recovery operations.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    WWW.HAPB.NET

    "Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
  • FranklinFranklin Posts: 4,747
    edited 2009-01-08 05:35
    Just remember the baloon is also being pushed by the wind so you will only get gust values (to an extent)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Earl FosterEarl Foster Posts: 185
    edited 2009-01-08 19:09
    I will have two variables, one from the anemometer and one from a GPS. Between the two of them I will know how fast the balloon is travelling and be able to calculate the true wind speed at different altitudes throughout the flight.

    I am working on a new algorithm that will provide real-time update on predicted flight paths and landing sites based on information gathered before(which I currently use) and during the flight. These calculations will be performed by the Prop and sent back to my mobile tracking station during flight operations.

    Since my flights have been postponed due to winter winds in Texas I have decided to add an additional experiment to what I am already working on. I will have a complete write-up available on my website in the next couple of weeks if you are interested.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    WWW.HAPB.NET

    "Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
  • FranklinFranklin Posts: 4,747
    edited 2009-01-09 04:06
    To know the true wind speed you will also have to know it's direction and time the data was taken.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Earl FosterEarl Foster Posts: 185
    edited 2009-01-09 21:05
    I record GPS data every 4 seconds to a flash drive which include directions and timestamps. I will be able to calculate true wind speed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    WWW.HAPB.NET

    "Don't ask yourself what the world needs - ask yourself what makes you come alive, and then go do it." - H.T.Whitman
Sign In or Register to comment.