Wind Vane

Hi Guys,

I am trying to get wind direction from a Wind Vane from the Rainwise MK-III Weather Station in Arduino Uno. The wind vane is based on reed switch.

After figuring what all the 8 pin does what I got the following:

  • Pin 7 and 8 - Anenometer

  • Pin 1 to 7 - Wind Vane

Rotating the Wind Vane and doing continuity test using my multi meter I got the following Data (Also see image for table):

Pin 6 Pin 7 Pin 1 Pin 2 Pin 3 Pin 4 Direction
0 1 1 0 0 0 N
0 1 0 1 0 0 NNE
0 1 0 0 1 0 NE
0 1 0 0 0 1 ENE
1 0 1 0 0 0 E
1 0 0 1 0 0 ESE
1 0 0 0 1 0 SE
1 0 0 0 0 1 SSE
1 1 1 0 0 0 S
1 1 0 1 0 0 SSW
1 1 0 0 1 0 SW
1 1 0 0 0 1 WSW
1 1 1 1 0 0 W
1 1 0 1 1 0 WNW
1 1 0 0 1 1 NW
1 1 1 0 0 1 NNW

For getting N,NNE,NE and ENE i figured that I had to make Pin 5 LOW and Pin 6 HIGH and scan on pin 1,2,3 and 4 to see which is gives HIGH. And same for E to SSE. However I am very confused and apprently stuck when both Pin 6 and Pin 7 are HIGH.

I am only able to get 8 directions so far. Can you please help me figure out how I can solve this or an example code similar to my problem.

I am new with arduino, however here is what i have written so far:

#define pin1 10  //O
#define pin2 9 //OW
#define pin3 11 //BNW
#define pin4 12 //B
#define pin6 6 //BLW
#define pin7 7 //G

void setup() {
  Serial.begin(9600);
  pinMode(pin1, INPUT); 
  pinMode(pin2, INPUT);
  pinMode(pin3, INPUT);
  pinMode(pin4, INPUT);
  pinMode(pin5, INPUT); // reserve pin 
  pinMode(pin6, OUTPUT);
  pinMode(pin7, OUTPUT);
   
}

void loop() 
 {
digitalWrite(pin6, HIGH);
digitalWrite(pin7, LOW); 
 
if ((digitalRead(pin1)== HIGH)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("1");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== HIGH)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("2");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== HIGH)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("3");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== HIGH))
  {
    Serial.println("4");
  }
  
digitalWrite(pin6, LOW);
digitalWrite(pin7, HIGH); 
  
if ((digitalRead(pin1)== HIGH)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("5");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== HIGH)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("6");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== HIGH)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("7");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== HIGH))
  {
    Serial.println("8");
  }

digitalWrite(pin6, HIGH);
digitalWrite(pin7, HIGH); 

if ((digitalRead(pin1)== HIGH)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("9");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== HIGH)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("10");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== HIGH)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("11");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== HIGH))
  {
    Serial.println("12");
  }
else if ((digitalRead(pin1)== HIGH)&&(digitalRead(pin2)== HIGH)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("13");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== HIGH)&&(digitalRead(pin3)== HIGH)&&(digitalRead(pin4)== LOW))
  {
    Serial.println("14");
  }
else if ((digitalRead(pin1)== LOW)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== HIGH)&&(digitalRead(pin4)== HIGH))
  {
    Serial.println("15");
  }
else if ((digitalRead(pin1)== HIGH)&&(digitalRead(pin2)== LOW)&&(digitalRead(pin3)== LOW)&&(digitalRead(pin4)== HIGH))
  {
    Serial.println("15");
  }
delay(1000);
  
}

Thank you for your time and help.

Kind Regards
Vishal.

Capture.JPG

Are these reed switches part of the original MK-III assembly or did you add them?

V1shal: Rotating the Wind Vane and doing continuity test using my multi meter I got the following Data (Also see image for table):

Do the 1's in your table mean "these two/three/four wires are connected together" and the 0's mean Not Connected? Did you check for continuity in both directions? There might be diodes in the circuit.