{"id":86,"date":"2011-09-15T22:35:27","date_gmt":"2011-09-16T02:35:27","guid":{"rendered":"http:\/\/www.cloppermillweather.org\/blog\/?p=86"},"modified":"2011-09-18T01:24:00","modified_gmt":"2011-09-18T05:24:00","slug":"new-anemometer","status":"publish","type":"post","link":"https:\/\/www.cloppermillweather.org\/blog\/2011\/09\/15\/new-anemometer\/","title":{"rendered":"New Anemometer"},"content":{"rendered":"<p>Today the new ADS anemometer arrived from Hobby Boards.\u00a0 Here&#8217;s what was in the package<\/p>\n<div id=\"attachment_87\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0380.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-87\" class=\"size-medium wp-image-87\" title=\"ADS Anemometer\" src=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0380-300x225.jpg\" alt=\"\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0380-300x225.jpg 300w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0380-1024x768.jpg 1024w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0380-400x300.jpg 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-87\" class=\"wp-caption-text\">Anemometer Package Contents<\/p><\/div>\n<p>I started out following the instructions to assemble it.\u00a0 First put the pole together.<\/p>\n<div id=\"attachment_88\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0381.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-88\" class=\"size-medium wp-image-88\" title=\"Assembled Pole\" src=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0381-300x225.jpg\" alt=\"Assembled Pole\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0381-300x225.jpg 300w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0381-1024x768.jpg 1024w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0381-400x300.jpg 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-88\" class=\"wp-caption-text\">Assembled Pole<\/p><\/div>\n<p>Next I installed the mounting arm.<\/p>\n<div id=\"attachment_89\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0382.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-89\" class=\"size-medium wp-image-89\" title=\"Mounting Arm Installed\" src=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0382-300x225.jpg\" alt=\"Mounting Arm Installed\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0382-300x225.jpg 300w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0382-1024x768.jpg 1024w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0382-400x300.jpg 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-89\" class=\"wp-caption-text\">Mounting Arm Installed<\/p><\/div>\n<p>Then mount the anemometer and wind vane.<\/p>\n<div id=\"attachment_90\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0383.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-90\" class=\"size-medium wp-image-90\" title=\"Sensors Mounted\" src=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0383-300x225.jpg\" alt=\"Sensors Mounted\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0383-300x225.jpg 300w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0383-1024x768.jpg 1024w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0383-400x300.jpg 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-90\" class=\"wp-caption-text\">Sensors Mounted<\/p><\/div>\n<p>Then I added the controller board and connected the wires.\u00a0 Or so I thought.\u00a0 In my excitement I had stopped following the instructions.\u00a0 I paid for that later on when I started testing.<\/p>\n<div id=\"attachment_92\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0384.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-92\" class=\"size-medium wp-image-92\" title=\"Completed Anemometer\" src=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0384-300x225.jpg\" alt=\"Completed Anemometer\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0384-300x225.jpg 300w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0384-1024x768.jpg 1024w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0384-400x300.jpg 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-92\" class=\"wp-caption-text\">Completed Anemometer<\/p><\/div>\n<p>Next came time for some testing.\u00a0 I hooked the anemometer board to my 1-Wire network and fired up the 1-Wire viewer application.\u00a0 It showed the DS2423 and DS2438 chips from the anemometer board.\u00a0 I updated the information in my application configuration file and started up the application.\u00a0 Now the problems started.\u00a0 The sensors would appear and disappear intermittently.\u00a0 Sometimes the bus was shorted.\u00a0 The anemometer board was intermittent. \u00a0 Sensors would come and go.\u00a0 This problem occured with both my application and the 1-Wire viewer.<\/p>\n<p>I checked my power supply (this anemometer, my barometer, and the hub itself all require external power).\u00a0 My voltmeter read right around 15 volts, which would meet the power requirements.\u00a0 I removed all the other sensors and was able to isolate the problem as being with the anemometer board.\u00a0 I finally decided to open the case for the anemometer, and I immediately saw my mistake.<\/p>\n<p>If I had continued to follow the instructions I wouldn&#8217;t have had any problems, as they instructed me to open the case.\u00a0 That&#8217;s where the jack is for connecting the sensors to the anemometer board.\u00a0 I had connected the sensors directly to the 1-Wire bus.\u00a0 This next picture clearly shows the third connector for the anemometer that isn&#8217;t visible until you open the case.\u00a0 I want to stress that this was my mistake.\u00a0 The instructions were clear on how to connect things (provided you read and follow them).<\/p>\n<div id=\"attachment_93\" style=\"width: 310px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0386.jpg\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-93\" class=\"size-medium wp-image-93\" title=\"1-Wire Anemometer Board\" src=\"http:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0386-300x225.jpg\" alt=\"1-Wire Anemometer Board\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0386-300x225.jpg 300w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0386-1024x768.jpg 1024w, https:\/\/www.cloppermillweather.org\/blog\/wp-content\/uploads\/2011\/09\/IMG_0386-400x300.jpg 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-93\" class=\"wp-caption-text\">1-Wire Anemometer Board<\/p><\/div>\n<p>Now that I had everything wired up correctly, the board worked fine\u00a0 My software updates to read the new sensors worked just as they should.\u00a0 My only comment is that the wind direction sensor isn&#8217;t linear.\u00a0 Directions such as NNE or ESE don&#8217;t cover as many degrees of rotation as the others.\u00a0 In all fairness, the sensor only claims to have a resolution of 22.5 degrees.\u00a0 And it probably does meet that specification.\u00a0 For people who need greater accuracy than that Hobby Boards carries a higher quality sensor with a higher price tag to match.\u00a0 This one will suit my needs.\u00a0 Another plus is that this sensor doesn&#8217;t appear to have positions that are between directions and return an error like my old AAG anemometer would do.<\/p>\n<p>Here&#8217;s some code for how to read the anemometer board and the ADS sensors.\u00a0 A lot of this is specific to my application, but the basic logic should still make sense.\u00a0 The formatting got messed up in moving the code to the Web.<\/p>\n<p>Here&#8217;s code for the wind direction:<\/p>\n<pre>import com.dalsemi.onewire.OneWireException;\r\nimport com.dalsemi.onewire.adapter.DSPortAdapter;\r\nimport com.dalsemi.onewire.container.OneWireContainer26;\r\n\r\npublic class ADSWindDirectionSensor\r\n{\r\n\u00a0\u00a0\u00a0 private static final int maxRetryCount = 3;\r\n\u00a0\u00a0\u00a0 private static final double WIND_DIR_ADJUST = 1.000;\r\n\u00a0\u00a0\u00a0 private OneWireContainer26 windDirectionDevice = null;\r\n\r\n\u00a0\u00a0\u00a0 public ADSWindDirectionSensor(DSPortAdapter adapter,\r\n         SensorConfiguration config)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0    \u00a0 \u00a0super(adapter, config);\r\n\r\n\u00a0\u00a0 \u00a0    windDirectionDevice =\r\n            new OneWireContainer26(adapter, config.getID());\r\n\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0 public int getWindDirection()\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0    int windDir = WIND_DIRECTION_ERROR;\r\n\u00a0\u00a0 \u00a0    boolean bOK = false;\r\n\u00a0\u00a0 \u00a0    int retryCount = 0;\r\n\r\n\u00a0\u00a0 \u00a0    if (windDirectionDevice != null &amp;&amp; isEnabled())\r\n\u00a0\u00a0 \u00a0    {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     while(!bOK &amp;&amp; retryCount &lt; maxRetryCount)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      try\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     if (this.isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      ErrorLog.logError(\"Wind Dir: Device = \" +\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0    windDirectionDevice.getName() + \"\u00a0 ID = \" +\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0    windDirectionDevice.getAddressAsString());\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     this.getPath().open();\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     \/\/ read 1-wire device's state\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     byte[] state = windDirectionDevice.readDevice();\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     \/\/ Read sensor's output voltage\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     windDirectionDevice.doADConvert(\r\n                    OneWireContainer26.CHANNEL_VAD, state);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     double Vad = windDirectionDevice.getADVoltage(\r\n                    OneWireContainer26.CHANNEL_VAD, state);\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     \/\/ Read the sensor's power supply voltage -\r\n                \/\/    mostly for debugging\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     windDirectionDevice.doADConvert(\r\n                           OneWireContainer26.CHANNEL_VDD, state);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     double Vdd = windDirectionDevice.getADVoltage(\r\n                           OneWireContainer26.CHANNEL_VDD, state);\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     \/\/ compensate for supply variations\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     Vad = Vad * WIND_DIR_ADJUST;\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     \/\/ convert the A to D voltage to a wind direction\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     windDir = lookupWindDir(Vad);\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     if (this.isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      ErrorLog.logError(\"Wind Dir A to D = \" + Vad +\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0    \" Wind Dir Supply = \" + Vdd +\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0    \" Wind Direction\u00a0 = \" + windDir);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     if (windDir == WIND_DIRECTION_ERROR)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      if (isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     ErrorLog.logError(\"Wind dir: ERROR - Vad: \" +\r\n                       Vad + \" Vdd; \" + Vdd);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      retryCount++;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     }\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     else\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      bOK = true; \u00a0\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      if (isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     ErrorLog.logError(\"Wind dir: - Vad: \" +\r\n                      Vad + \" Vdd; \" + Vdd);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0      }\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 this.getPath().close();\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0}\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0catch (OneWireException e)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0{\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (this.isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ErrorLog.logError(\"Error Reading Wind Direction: \" + e);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 retryCount++;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0}\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (retryCount &gt;= maxRetryCount)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ErrorLog.logError(\"Wind Direction: Retry count exceeded\");\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0}\r\n\r\n\u00a0\u00a0 \u00a0return windDir;\r\n\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0 \/\/ convert wind direction A to D results to direction value\r\n\u00a0\u00a0\u00a0 private int lookupWindDir(double volts) \/\/ ADS\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 int direction = WIND_DIRECTION_ERROR;\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 for (int i = 0; i &lt; 16; i++)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0 if((volts &lt;= lookupTable[i] + 0.04) &amp;&amp;\r\n                   (volts &gt;= lookupTable[i] - 0.04))\r\n\u00a0\u00a0 \u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 direction = i;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 break;\r\n\u00a0\u00a0 \u00a0\u00a0 }\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return direction;\r\n\r\n\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0 static final double lookupTable[] =\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a02.69, \/\/ N\r\n\u00a0\u00a0 \u00a06.52, \/\/ NNE 1\r\n\u00a0\u00a0 \u00a05.99, \/\/ NE\u00a0 2\r\n\u00a0\u00a0 \u00a09.38, \/\/ ENE 3\r\n\u00a0\u00a0 \u00a09.30, \/\/ E\u00a0\u00a0 4\r\n\u00a0\u00a0 \u00a09.53, \/\/ ESE 5\r\n\u00a0\u00a0 \u00a08.51, \/\/ SE\u00a0 6\r\n\u00a0\u00a0 \u00a09.01, \/\/ SSE 7\r\n\u00a0\u00a0 \u00a07.60, \/\/ S\u00a0\u00a0 8\r\n\u00a0\u00a0 \u00a07.98, \/\/ SSW 9\r\n\u00a0\u00a0 \u00a04.31, \/\/ SW\u00a0 10\r\n\u00a0\u00a0 \u00a04.62, \/\/ WSW 11\r\n\u00a0\u00a0 \u00a00.92, \/\/ W\u00a0\u00a0 12\r\n\u00a0\u00a0 \u00a02.23, \/\/ WNW 13\r\n\u00a0\u00a0 \u00a01.57, \/\/ NW\u00a0 14\r\n\u00a0\u00a0 \u00a03.57, \/\/ NNW 15\r\n\u00a0\u00a0\u00a0 };\r\n\r\n}<\/pre>\n<p>Here&#8217;s the wind speed code:<\/p>\n<pre>import com.dalsemi.onewire.OneWireException;\r\nimport com.dalsemi.onewire.adapter.DSPortAdapter;\r\nimport com.dalsemi.onewire.container.OneWireContainer1D;\r\n\r\npublic class ADSWindSpeedSensor\r\n{\r\n\u00a0\u00a0\u00a0 private OneWireContainer1D windSpeedDevice = null;\r\n\u00a0\u00a0\u00a0 private static final int maxRetryCount = 3;\r\n\u00a0\u00a0\u00a0 private long lastCount = 0;\r\n\u00a0\u00a0\u00a0 private long lastTicks = 0;\r\n\r\n\u00a0\u00a0\u00a0 \/**\r\n\u00a0\u00a0\u00a0\u00a0 *\r\n\u00a0\u00a0\u00a0\u00a0 * Constructor that will instantiate the wind speed sensor\r\n     * of the specified\r\n\u00a0\u00a0\u00a0\u00a0 * ID on the specified adapter.\r\n\u00a0\u00a0\u00a0\u00a0 *\r\n\u00a0\u00a0\u00a0\u00a0 * @param adapter\r\n\u00a0\u00a0\u00a0\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The 1-Wire adapter this sensor is connected to.\r\n\u00a0\u00a0\u00a0\u00a0 * @param config\r\n\u00a0\u00a0\u00a0\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The SensorConfiguration that specifies all the\r\n\u00a0\u00a0\u00a0\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 parameters for this sensor.\r\n\u00a0\u00a0\u00a0\u00a0 *\r\n\u00a0\u00a0\u00a0\u00a0 *\/\r\n\u00a0\u00a0\u00a0 public ADSWindSpeedSensor(DSPortAdapter adapter,\r\n            SensorConfiguration config)\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0super(adapter, config);\r\n\r\n\u00a0\u00a0 \u00a0windSpeedDevice = new OneWireContainer1D(adapter, config.getID());\r\n\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0\u00a0 \/**\r\n\u00a0\u00a0\u00a0\u00a0 * Method to read the wind speed sensor and return the speed in \r\n\u00a0\u00a0\u00a0\u00a0 * miles per hour.\r\n\u00a0\u00a0\u00a0\u00a0 *\r\n\u00a0\u00a0\u00a0\u00a0 * @return The wind speed in miles per hour. If there was not a \r\n\u00a0\u00a0\u00a0\u00a0 *\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 valid reading, return Float.MIN_VALUE.\r\n\u00a0\u00a0\u00a0\u00a0 *\r\n\u00a0\u00a0\u00a0\u00a0 *\/\r\n\u00a0\u00a0\u00a0 public float getWindSpeed()\r\n\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0float windSpeed = Float.MIN_VALUE;\r\n\u00a0\u00a0 \u00a0boolean bOK = false;\r\n\u00a0\u00a0 \u00a0int retryCount = 0;\r\n\r\n\u00a0\u00a0 \u00a0if (windSpeedDevice != null &amp;&amp; isEnabled())\r\n\u00a0\u00a0 \u00a0{\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 while (!bOK &amp;&amp; retryCount &lt; maxRetryCount)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0try\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0{\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 this.getPath().open();\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (this.isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ErrorLog.logError(\"ADS Wind Speed: Device = \" +\r\n                      windSpeedDevice.getName() +\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 \" ID = \" + windSpeedDevice.getAddressAsString());\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 \/\/ read wind counter &amp; system time\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 long currentCount = windSpeedDevice.readCounter(15);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 long currentTicks = System.currentTimeMillis();\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (lastTicks != 0)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\/\/ calculate the wind speed in MPH based on\r\n            \/\/  the revolutions per second\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0windSpeed = (float) ((1.25 *(currentCount-lastCount)) \/\r\n                 ((currentTicks-lastTicks) \/ 1000f));\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (this.isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ErrorLog.logError(\"Count = \" + (currentCount-lastCount)\r\n                    + \" during \" +\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0(currentTicks-lastTicks) + \"ms calcs to \" + windSpeed);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 \/\/ remember count &amp; time\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 lastCount = currentCount;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 lastTicks = currentTicks;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 bOK = true;\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 this.getPath().close();\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0}\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0catch (OneWireException e)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0{\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (this.isDebugFlag())\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ErrorLog.logError(\"Error Reading Wind Speed: \" + e);\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 retryCount++;\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0}\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 if (retryCount &gt;= maxRetryCount)\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 {\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0ErrorLog.logError(\"Wind Speed: Retry count exceeded\");\r\n\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0 }\r\n\u00a0\u00a0 \u00a0}\r\n\r\n\u00a0\u00a0 \u00a0return windSpeed;\r\n\u00a0\u00a0\u00a0 }\r\n\r\n}<\/pre>\n<p>Time for some more testing, and create a way to attach this anemometer to the rest of the weather station.\u00a0 I also received a new photocell and a new lightning sensor to play with.\u00a0 I need to replace my humidity sensor chip and build the new radiation shield.\u00a0 Lot&#8217;s more fun to come.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today the new ADS anemometer arrived from Hobby Boards.\u00a0 Here&#8217;s what was in the package I started out following the instructions to assemble it.\u00a0 First put the pole together. Next I installed the mounting arm. Then mount the anemometer and &hellip; <a href=\"https:\/\/www.cloppermillweather.org\/blog\/2011\/09\/15\/new-anemometer\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-weather"],"_links":{"self":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":0,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cloppermillweather.org\/blog\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}