https://www.lineameteo.it/viewtopic.php?f=2&t=12889&p=374054#p374054
-----------------------------------
As_Needed
Gio 22 Ott, 2015 16:30

Re: Stazione Meteo Base (FAI DA TE)
-----------------------------------
Ragazzi! Ecco altri aggiornamenti sul progetto: INNANZITUTTO SONO RIUSCITO CON VARI AIUTI A RILEVARE GIA' LA VELOCITA' DEL VENTO E LA DIREZIONE tramite il tx20 collegato ad arduino, qui sotto metto il programma che ho utilizzato:
Ovviamente il programma per ora rileva solo quei valori, poi se vorrò mettere pure il wind chill devo studiarci un po' e aggiungerlo, ancora così viene scritto solo sul seriale ovvero non viene mandato sul display. Da confermare che la velocità del vento sia effettiva, ovvero ci vuole un campione di anemometro che gli si manda la stessa raffica del vento tipo con un phon, e confrontarlo poi con il tx20, però non so dove trovarlo...

[code]
//void setup();
//void loop();
//int collectdata(void);
//void showdatasimple();

int dataPin = 4;
int bitLength = -1;
int data[45];
int gooddata = 1;
int timeout;
int loops = 0;
int spd[8];
int i = 0;
int j = 0;
char windDirection[16][4] = {
  "N","NNE","NE", "ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"};

void setup() {
  Serial.begin(9600);
  Serial.print("\n\nInitializing...\n");
  //  Serial.print("Data Pin: ");
  //  Serial.println(digitalRead(dataPin));
    pinMode(dataPin, INPUT);
}

//void delay2(unsigned long ms){
//	unsigned long start = micros();
//	while (micros() - start <= ms);
//}

void loop() {
  Serial.println("Start");
  gooddata = 1;
  collectData();
  if (gooddata == 1) {
    rawdump();
    outputResults();
    TheData();
  }
  else {
    Serial.println ("READ ERROR");
  }
  Serial.println(++loops);
  Serial.println();
  delay(1500);
}

int collectData(void) {
   if (bitLength <0){
     bitLength = 1220;//getbitlenght2();

  }
 
 pinMode(dataPin, OUTPUT);

 digitalWrite(dataPin, HIGH);
 delay(100);
 digitalWrite(dataPin, LOW );
 delay(500);
 pinMode(dataPin, INPUT);


 while(digitalRead(dataPin) == LOW){
 }  
 //wait slave start signal
 while(digitalRead(dataPin) == HIGH){
 }
 while(digitalRead(dataPin) == LOW){
 }
 


 
  for (int i=0 ; i<42 ; i++) {
    data[i] = (digitalRead(dataPin) == LOW)? 0:1; // read and save either a 0 or 1
    delayMicroseconds(bitLength);
  }
}

int TheData() {
  Serial.println("TheData");
  int i, idx = 0, idy = 0;
 // for (i=8; i>4; i--) {  dato originale
    for (i=6; i>2; i--) { // dato modificato
    idx = idx *2 + data[i];
  }

  //  Serial.print("idx: ");
  //  Serial.println(idx, DEC);
  Serial.print("Wind: ");
  Serial.println(windDirection[idx] );

 // for (i=17; i>8; i--) {  dato originale per velocità
    for (i=15; i>6; i--) {   // dato modificato
    idy = idy * 2 + data[i];
  }

  Serial.print("Speed: ");
  Serial.print(idy, DEC);
  Serial.println (" m/s read");

  float idz = idy/10.0;
  Serial.print("Speed: ");
  Serial.print(idz);
  Serial.println (" m/s real");

  float KMH = idz * 3.6;
  Serial.print("Speed: ");
  Serial.print(KMH);
  Serial.println (" kmh");

  float MPH = KMH * 0.621371192;
  Serial.print("Speed: ");
  Serial.print(MPH);
  Serial.println (" mph");
  /*
float wc, dp;
   wc = windchill((float) temperature / 100, (float) Wind * 0.36);
   dp = dewpoint((float)temperature / 100, (float) humidity);
   */
}


void rawdump() {
  Serial.print("Raw: ");
  for (int i=0 ; i<41 ; i++) {
    Serial.print (data[i]);
    if (i == 4) {
      Serial.print (" ");
    }
    if (i == 8) {
      Serial.print (" ");
    }
    if (i == 17) {
      Serial.print (" ");
    }
    if (i == 20) {
      Serial.print (" ");
    }
    if (i == 24) {
      Serial.print (" ");
    }
    if (i == 28) {
      Serial.print (" ");
    }
    if (i == 37) {
      Serial.print (" ");
    }
  }
}

void outputResults() {
  Serial.println();

  int idx =0;
  for (int i=8 ; i> 4 ; i--) 
  //for (int i=6 ; i> 2 ; i--) // dato modificato
  {
    idx = idx *2 + data[i];  // data[i] == 0/1.. see prev post.  //
  }

  Serial.print("idx: ");
  Serial.println(idx, DEC);
  Serial.print("Wind: ");
  Serial.println(windDirection[idx] );
  //  Serial.println();

  Serial.print("Swapped: ");

  //HEAD
  for (int i =0 ; i< 5 ; i++)
  {
    Serial.print(data[i]);  // it contains 0 or 1
  }

  Serial.print(" ");

  //WINDDIR
  for (int i =8 ; i> 4 ; i--)
  {
    Serial.print(data[i]);
  }
  Serial.print(" ");

  //WIND SPEED
  for (int i =17 ; i> 8 ; i--)
  {
    Serial.print(data[i]);
  }

  Serial.print(" ");

  //WIND SPEED+3
  for (int i =20 ; i> 17 ; i--)
  {
    Serial.print(data[i]);
  }

  Serial.print(" ");

  /*
  // Checksum
   for (iCounter=0;iCounter<4;iCounter++)
   {
   checksum |= (TX23_DATA_GET_BIT << iCounter);
   delayTargetuSec += bitLength;
   TX23_DoDelay;
   }

   //Calculate Checksum
   unsigned int checksumCalc = 0;
   checksumCalc += (winddir & 15);
   checksumCalc += ((windspeed >> 8) & 15);
   checksumCalc += ((windspeed >> 4) & 15);
   checksumCalc += (windspeed & 15);
   */

  // Checksum
  for (int i =24 ; i> 20 ; i--)
  {
    Serial.print(data[i]);
  }

  Serial.print(" ");

  //WIND DIR NEGATEIVE
  for (int i =28 ; i> 24 ; i--)
  {
    Serial.print(data[i]);
  }

  Serial.print(" ");

  //WIND SPEED NEGATED
  for (int i =37 ; i> 28 ; i--){
    Serial.print(data[i]);
  }

  Serial.print(" ");

  //WIND SPEED NEGATED +3
  for (int i =40 ; i> 37 ; i--){
    Serial.print(data[i]);
  }
  Serial.println();
  //  Serial.println();
  //  Serial.println();
}
[/code]

Ho stampato pure il circuito e forato ed è venuto così:
Devo ancora limarlo bene ecco perché i lati sono fatti in quel modo...
Basetta finita, piste top copper 
[img]http://www.lineameteo.it/files/images/1789/img_0472.jpg[/img]  

Piste botton copper
[img]http://www.lineameteo.it/files/images/1789/img_0473.jpg[/img] 

Qui la carta lucida con cui ho stampato il circuito. (la carta lucida si ricava stampando il pcb, ovvero lo schema di cui sopra negli altri messaggi)
[img]http://www.lineameteo.it/files/images/1789/img_0474.jpg[/img]  [img]http://www.lineameteo.it/files/images/1789/img_0475.jpg[/img] 

Serigrafia componenti e lista componenti:
[img]http://www.lineameteo.it/files/images/1789/img_0476.jpg[/img]  [img]http://www.lineameteo.it/files/images/1789/img_0477.jpg[/img]

P.S. Ho messo il code non sapevo come si faceva la scrool bar  :D


