Recently my weatherstation gave up, I do miss knowing the wind direction.
The schematic shows how to interface commonly found Anemometer and Wind Vane.
Always interesting to doing some testing you get to find out how good things are lol.
These sensors use glass reed switches they work quite well with no problem of contact bounce.
The Anemometer has two magnets and hence the contact will close twice in one revolution.
The Wind Vane has eight reed switches each contact will close over 45 degrees as the magnet passes over,
although their are 16 possible values these mid positions are a waste the magnet has to be precisely between the
two reed switches for both contacts to close so only operate over 1 degree so its only worth bothering with the eight postions.
The schematic shows how to interface commonly found Anemometer and Wind Vane.
Always interesting to doing some testing you get to find out how good things are lol.
These sensors use glass reed switches they work quite well with no problem of contact bounce.
The Anemometer has two magnets and hence the contact will close twice in one revolution.
The Wind Vane has eight reed switches each contact will close over 45 degrees as the magnet passes over,
although their are 16 possible values these mid positions are a waste the magnet has to be precisely between the
two reed switches for both contacts to close so only operate over 1 degree so its only worth bothering with the eight postions.
Code:
#terminal 19200
SETFREQ M16
SYMBOL WindDirection = W2 'b4,b5
SYMBOL WindSpeed = W3 'b6,b7
SYMBOL Character1 = b8
SYMBOL Character2 = b9
SYMBOL Character3 = b10
SYMBOL Character4 = b11
SYMBOL Character5 = b12
' ohms ADCvalues ||ohms
EEPROM 10,("W ") ' 120 K 070
EEPROM 20,("NW") ' 64.9 K 123 Wnw 42.2 K 178
EEPROM 30,("N ") ' 33 K 217 Nnw 21.88 K 295
EEPROM 40,("SW") ' 16 K 365 Wsw 14.12 K 395
EEPROM 60,("NE") ' 8.2 K 532 Nne 6.57 K 588
EEPROM 80,("S ") ' 3.9 K 710 Ssw 3.14 K 755
EEPROM 90,("SE") ' 2.2 K 820 Sse 1.4 K 883
EEPROM 100,("E ") ' 1 K 918 Ene 891 929
' Ese 688 958
Main:
ReadADC10 C.0,WindDirection
WindDirection = WindDirection/100+1*10
READ WindDirection, Character1
INC WindDirection
READ WindDirection, Character2
COUNT C.1,24000, WindSpeed ' count pulses in 6secs (at 16MHz)
WindSpeed = WindSpeed *4 ' one pulse per second = 2.4km/h
'COUNT C.1,24000, WindSpeed ' count pulses in 6secs (at 16MHz)
'WindSpeed = WindSpeed *2**36409 '(*1.1111) one pulse per second = 0.66667m/s
'COUNT C.1,20000, WindSpeed ' count pulses in 5secs (at 16MHz)
'WindSpeed = WindSpeed *8**24445 '(*2.984) one pulse per second = 1.492mph
BinTOASCII WindSpeed,Character3,Character4,Character5
IF Character3 = "0" THEN : Character3 = " " : ENDIF ' leading zero blanking
Sertxd (13,10, "winds ",Character1,Character2,32,Character3,Character4,".",Character5," km/h") ' 0.4 resolution
GOTO main
Attachments
-
253.6 KB Views: 158