├── README.md ├── WindSensor └── WindSensor.ino └── Wind_Sensor_C4_Fritzing.fzpz /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | •*,_.-*º°•*,_.-*º°•*,_.-*º 6 | --- Wind Sensor Rev. C --- 7 | -*º°•*,_.-*º°•*,_.-*º°•*,_. 8 | 9 | 10 | Documents and Arduino Code for using the Modern Device Wind Sensor C4 11 | Try the Arduino Code for the hardware setup. 12 | 13 | See more at moderndevice.com 14 | -------------------------------------------------------------------------------- /WindSensor/WindSensor.ino: -------------------------------------------------------------------------------- 1 | /* Modern Device Wind Sensor Sketch for Rev C Wind Sensor 2 | This sketch is only valid if the wind sensor if powered from 3 | a regulated 5 volt supply. An Arduino or Modern Device BBB, RBBB 4 | powered from an external power supply should work fine. Powering from 5 | USB will also work but will be slightly less accurate in our experience. 6 | 7 | When using an Arduino to power the sensor, an external power supply is better. Most Arduinos have a 8 | polyfuse which protects the USB line. This fuse has enough resistance to reduce the voltage 9 | available to around 4.7 to 4.85 volts, depending on the current draw. 10 | 11 | The sketch uses the on-chip temperature sensing thermistor to compensate the sensor 12 | for changes in ambient temperature. Because the thermistor is just configured as a 13 | voltage divider, the voltage will change with supply voltage. This is why the 14 | sketch depends upon a regulated five volt supply. 15 | 16 | Other calibrations could be developed for different sensor supply voltages, but would require 17 | gathering data for those alternate voltages, or compensating the ratio. 18 | 19 | Hardware Setup: 20 | Wind Sensor Signals Arduino 21 | GND GND 22 | +V 5V 23 | RV A1 // modify the definitions below to use other pins 24 | TMP A0 // modify the definitions below to use other pins 25 | 26 | 27 | Paul Badger 2014 28 | 29 | Hardware setup: 30 | Wind Sensor is powered from a regulated five volt source. 31 | RV pin and TMP pin are connected to analog innputs. 32 | 33 | */ 34 | 35 | 36 | #define analogPinForRV 1 // change to pins you the analog pins are using 37 | #define analogPinForTMP 0 38 | 39 | // to calibrate your sensor, put a glass over it, but the sensor should not be 40 | // touching the desktop surface however. 41 | // adjust the zeroWindAdjustment until your sensor reads about zero with the glass over it. 42 | 43 | const float zeroWindAdjustment = .2; // negative numbers yield smaller wind speeds and vice versa. 44 | 45 | int TMP_Therm_ADunits; //temp termistor value from wind sensor 46 | float RV_Wind_ADunits; //RV output from wind sensor 47 | float RV_Wind_Volts; 48 | unsigned long lastMillis; 49 | int TempCtimes100; 50 | float zeroWind_ADunits; 51 | float zeroWind_volts; 52 | float WindSpeed_MPH; 53 | 54 | void setup() { 55 | 56 | Serial.begin(57600); // faster printing to get a bit better throughput on extended info 57 | // remember to change your serial monitor 58 | 59 | Serial.println("start"); 60 | // put your setup code here, to run once: 61 | 62 | // Uncomment the three lines below to reset the analog pins A2 & A3 63 | // This is code from the Modern Device temp sensor (not required) 64 | pinMode(A2, INPUT); // GND pin 65 | pinMode(A3, INPUT); // VCC pin 66 | digitalWrite(A3, LOW); // turn off pullups 67 | 68 | } 69 | 70 | void loop() { 71 | 72 | 73 | if (millis() - lastMillis > 200){ // read every 200 ms - printing slows this down further 74 | 75 | TMP_Therm_ADunits = analogRead(analogPinForTMP); 76 | RV_Wind_ADunits = analogRead(analogPinForRV); 77 | RV_Wind_Volts = (RV_Wind_ADunits * 0.0048828125); 78 | 79 | // these are all derived from regressions from raw data as such they depend on a lot of experimental factors 80 | // such as accuracy of temp sensors, and voltage at the actual wind sensor, (wire losses) which were unaccouted for. 81 | TempCtimes100 = (0.005 *((float)TMP_Therm_ADunits * (float)TMP_Therm_ADunits)) - (16.862 * (float)TMP_Therm_ADunits) + 9075.4; 82 | 83 | zeroWind_ADunits = -0.0006*((float)TMP_Therm_ADunits * (float)TMP_Therm_ADunits) + 1.0727 * (float)TMP_Therm_ADunits + 47.172; // 13.0C 553 482.39 84 | 85 | zeroWind_volts = (zeroWind_ADunits * 0.0048828125) - zeroWindAdjustment; 86 | 87 | // This from a regression from data in the form of 88 | // Vraw = V0 + b * WindSpeed ^ c 89 | // V0 is zero wind at a particular temperature 90 | // The constants b and c were determined by some Excel wrangling with the solver. 91 | 92 | WindSpeed_MPH = pow(((RV_Wind_Volts - zeroWind_volts) /.2300) , 2.7265); 93 | 94 | Serial.print(" TMP volts "); 95 | Serial.print(TMP_Therm_ADunits * 0.0048828125); 96 | 97 | Serial.print(" RV volts "); 98 | Serial.print((float)RV_Wind_Volts); 99 | 100 | Serial.print("\t TempC*100 "); 101 | Serial.print(TempCtimes100 ); 102 | 103 | Serial.print(" ZeroWind volts "); 104 | Serial.print(zeroWind_volts); 105 | 106 | Serial.print(" WindSpeed MPH "); 107 | Serial.println((float)WindSpeed_MPH); 108 | lastMillis = millis(); 109 | } 110 | 111 | } 112 | 113 | 114 | -------------------------------------------------------------------------------- /Wind_Sensor_C4_Fritzing.fzpz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moderndevice/Wind_Sensor/ae3d9666f7d0fbd2e6dcbd9a4c3dab8d36f2f3f5/Wind_Sensor_C4_Fritzing.fzpz --------------------------------------------------------------------------------