MySensors weather station
-
Can I make a suggestion? Reverse the placement of the nuts to the top part, and the little machine screws to the bottom part of the housing. That way it will be easier to keep the water out as it will not creep in to the gap between the ABS and the screw. That capillary action will also work upside down, but good old gravity counters that to a great degree.
-
@Yveaux I have been working on the rain gauge that I will use with this. I will probably start posting the pics for the rain gauge in this thread from now on and just link the other thread to this one.
One other part that I haven't mentioned that I want to incorporate is a vented radiation shield like this to hold some of the sensors like temp, humidity, barometric pressure, etc.. I could possibly fit the MySensors board in this.

Just did a quick google image search on "home weather station" and found a few that I could possibly use as models for the design since the wind sensor parts are similar to mine:


@dbemowsk I have exactly the same weather station as the first one (Alecto DKW-2012 in my case).
I would very much like to have all sensors integrated into a single unit, not having single units (wind, rain, temp) interconnected with some bars.
This would also have a much higher WAF :nail_care: IMHO
Maybe I'd better sit down and drawn something to get the creativity flowing ;-)What material did you use to print it BTW?
-
@dbemowsk I have exactly the same weather station as the first one (Alecto DKW-2012 in my case).
I would very much like to have all sensors integrated into a single unit, not having single units (wind, rain, temp) interconnected with some bars.
This would also have a much higher WAF :nail_care: IMHO
Maybe I'd better sit down and drawn something to get the creativity flowing ;-)What material did you use to print it BTW?
-
Can I make a suggestion? Reverse the placement of the nuts to the top part, and the little machine screws to the bottom part of the housing. That way it will be easier to keep the water out as it will not creep in to the gap between the ABS and the screw. That capillary action will also work upside down, but good old gravity counters that to a great degree.
@DavidZH Good point. Reversing these should not be a big problem. Just a matter of re-designing the internal rotors that hold the magnets. I'd have to do that because one side has more room than the other. They are only like 15 minute prints anyway
Thanks for the suggestion.
-
So Monday I should have my new reed switches and should be able to start working on the board for the wind sensors. For the anemometer, the setup is pretty simple. The rotor has a magnet (red arrow) that passes by the reed switch (blue arrow) to count the revolutions.

The reed switch wire for the anemometer will pass through the hole at the edge (green arrow) and connect to the direction rotor PCB. Had a small problem when I was cutting the board (blue arrow), but it should still be usable for the prototype. The red lines (red arrow) are where the reed switches will get mounted for the wind direction rotor.

The direction rotor has a small round magnet (blue arrow) which should face the nose cone of the wind direction vane and will pass by the magnetic reed switches mounted on the round PCB

The circuit board mounting plate will get sandwiched between the top and bottom covers and have the main connection wire feed through the side hole near the wind direction magnet in the previous pic.

Later I will post the proposed schematic for how this will all connect to the pro mini. I will also hopefully have some test code for the setup.
-
So I was playing around a bit on the circuits.io website and came up with this for a test circuit. Each push button switch represents a reed switch for the direction rotor.

The idea is to separate the 8 reed switches into two banks which will only use 2 analog IO lines to handle all 8 switches. The first bank of reed switches will be for North, South, East and West. The second bank will be for Northeast, Southeast, Southwest and Northwest. My main reason for doing it this way was due to the fact that the MySensors library API uses V_DIRECTION for the wind direction and is a number between 0 and 360. I needed a way to get more accurate than just 0, 45, 90, 135, 180 etc... which I could do tying all of the reed switches to 1 analog IO line. With this design, I can catch the directions when the magnet is in-between 2 of the reed switches and activating both giving me another 1/8 step of accuracy.
Below is the code that I tested on the above circuit. The code should handle debouncing of the reed switches. With the reed switch and magnet rotor setup in place, the code should never reach a 999 value. It should always return a value between 0 and 337 based on the direction of the wind.
int old_NSEW = 0, old_NeSeSwNw = 0; void setup() { Serial.begin(9600); pinMode(A0, INPUT); pinMode(A1, INPUT); } int getNSEW() { int i, z, sum; int button; sum = 0; for (i=0; i < 4; i++) { sum += analogRead(A0); } z = sum / 4; //Serial.println(z); if (z > 1021) button = 999; else if (z > 357 && z < 361) button = 0; else if (z > 405 && z < 409) button = 90; else if (z > 467 && z < 471) button = 180; else if (z > 551 && z < 555) button = 270; else button = 999; return button; } int getNeSeSwNw() { int i, z, sum; int button; sum = 0; for (i=0; i < 4; i++) { sum += analogRead(A1); } z = sum / 4; //Serial.println(z); if (z > 1021) button = 999; else if (z > 357 && z < 361) button = 45; else if (z > 405 && z < 409) button = 135; else if (z > 467 && z < 471) button = 225; else if (z > 551 && z < 555) button = 315; else button = 999; return button; } void loop () { int NSEW, NeSeSwNw, NSEW_curr, NeSeSwNw_curr, triggered_NSEW, triggered_NeSeSwNw; NSEW = getNSEW(); NeSeSwNw = getNeSeSwNw(); if (NSEW != old_NSEW) { delay(50); // debounce NSEW_curr = getNSEW(); if (NSEW == NSEW_curr) { old_NSEW = NSEW; triggered_NSEW = NSEW; if (NSEW == 999 || NeSeSwNw == 999) { triggered_NSEW = NSEW; } else if (NSEW < NeSeSwNw) { triggered_NSEW = ((NeSeSwNw - NSEW) / 2) + NSEW; } else { triggered_NSEW = NSEW - ((NSEW - NeSeSwNw) / 2); } Serial.println(triggered_NSEW); } } if (NeSeSwNw != old_NeSeSwNw) { delay(50); // debounce NeSeSwNw_curr = getNeSeSwNw(); if (NeSeSwNw == NeSeSwNw_curr) { old_NeSeSwNw = NeSeSwNw; if (NSEW == 999 || NeSeSwNw == 999) { triggered_NeSeSwNw = NeSeSwNw; } else if (NSEW < NeSeSwNw) { triggered_NeSeSwNw = ((NeSeSwNw - NSEW) / 2) + NeSeSwNw; } else { triggered_NeSeSwNw = NeSeSwNw - ((NSEW - NeSeSwNw) / 2); } Serial.println(triggered_NeSeSwNw); } } }Does anyone see any issues in this approach to the wind direction?
Next I plan on working on the code for the anemometer to calculate wind speed. I could possibly have that figured out later today.
-
Personally I think you may have issues with the position when magnet will be around the middle of 2 sensors because it could either trigger both or none of them so magnet strength will be crucial to your setup. I still think the optical sensor used by the other weather stations is a preferred solution
-
Personally I think you may have issues with the position when magnet will be around the middle of 2 sensors because it could either trigger both or none of them so magnet strength will be crucial to your setup. I still think the optical sensor used by the other weather stations is a preferred solution
@gohan the diameter of the circuit board is 52mm or a radius of 26mm. From the center of the shaft to the center of the magnet is 17.75mm. The reed switches I ordered were 7mm long. I had to get shorter ones because of the tight space they will be in. The magnet's diameter is 4.25mm and it is a pretty strong neodymium magnet. Calculating the circumference to the center of where the magnet is mounted on the rotor, that is 111.5mm. Dividing that by 8 gives a distance between the reed switches of 13.94mm. I tested with a different reed switch that I had and found that the detection distance from magnet to reed switch is roughly 5mm plus or minus a smidge. The rotor should be fairly close to the reed switches if my calculations are correct. I can't say 100% till I get the reed switches and build the assembly, but I think I am going to be fine. I think worst case, I might have to get a slightly larger magnet, and even if I did it wouldn't have to be more than 1 to 2 millimeters bigger than the one I have.
-
So here is an update on where I am at with the direction rotor assembly. I came up with the following proposed circuit board assembly based on my circuits.io layout from my previous post. All of the reed switches are in a circular configuration and alternate the 2 different switch banks seen in the above post.

Following that diagram, here is the final prototype board. The only difference in the final board is that I used 3.3k resistors, as I was low on 2.2k's. I figured all I should have to do is make a couple adjustments to the code for the derived values when a reed switch was activated.

Even though the design seemed pretty solid, I seem to be having some issues with it. I have tried a few different rotor and magnet assemblies. All of the magnets are neodymium magnets that I got from various salvage operations. The order from left to right is the order that I tested them in.

It appears that @gohan was correct about the first test rotor. Some of the other ones just seemed a bit erratic. There are a couple other things that I want to try, but I'm starting to look at some kind of 360 degree angle sensor to potentially use. I am wondering if anyone in the forum has done any kind of rotational angle sensing, and what sensor did you end up using?
-
So here is an update on where I am at with the direction rotor assembly. I came up with the following proposed circuit board assembly based on my circuits.io layout from my previous post. All of the reed switches are in a circular configuration and alternate the 2 different switch banks seen in the above post.

Following that diagram, here is the final prototype board. The only difference in the final board is that I used 3.3k resistors, as I was low on 2.2k's. I figured all I should have to do is make a couple adjustments to the code for the derived values when a reed switch was activated.

Even though the design seemed pretty solid, I seem to be having some issues with it. I have tried a few different rotor and magnet assemblies. All of the magnets are neodymium magnets that I got from various salvage operations. The order from left to right is the order that I tested them in.

It appears that @gohan was correct about the first test rotor. Some of the other ones just seemed a bit erratic. There are a couple other things that I want to try, but I'm starting to look at some kind of 360 degree angle sensor to potentially use. I am wondering if anyone in the forum has done any kind of rotational angle sensing, and what sensor did you end up using?
-
I still think the central LED with 8 phototransistor around is the cheapest solution :) (given that you are already 3D printing everything, I don't think one more part will make much difference; there is one example in another topic about hacking a weather station)
-
I still think the central LED with 8 phototransistor around is the cheapest solution :) (given that you are already 3D printing everything, I don't think one more part will make much difference; there is one example in another topic about hacking a weather station)
-
I still think the central LED with 8 phototransistor around is the cheapest solution :) (given that you are already 3D printing everything, I don't think one more part will make much difference; there is one example in another topic about hacking a weather station)
@gohan $5 US for a 10 pack
http://www.ebay.com/itm/10PC-LTR-301-002-Lite-On-Phototransistor-NPN-Plastic-Side-Look-10-pieces-/111612940043?hash=item19fca64f0b:g:uKIAAOSwv0tVBIf4Or I could go this route and have a bunch of spares for the parts bin. The per unit cost would be cheaper that way, but you have to buy a bigger bulk of them.
http://www.ebay.com/itm/50-HONEYWELL-SDP8436-003-2-PIN-PHOTO-TRANSISTOR-DETECTOR-NPN-SIDE-LOOK-/191915022332?hash=item2caf06d7fc:m:mT-sRL8E_IkMeYJBasXQtng -
I was referring exactly to that topic. Maybe you could ask Flopp if he could measure his part for you. The tricky part will be to find the right brightness for the LED when it is crossing between 2 phototransistor, but I think it will be easier to adjust than changing a magnetic field :)
About those parts, I can't say much, it is up to you: with 10 you still have 2 as spares just in case, 50 are quite a lot unless you plan to build more for your friends :) -
I was referring exactly to that topic. Maybe you could ask Flopp if he could measure his part for you. The tricky part will be to find the right brightness for the LED when it is crossing between 2 phototransistor, but I think it will be easier to adjust than changing a magnetic field :)
About those parts, I can't say much, it is up to you: with 10 you still have 2 as spares just in case, 50 are quite a lot unless you plan to build more for your friends :) -
keep in mind that if you don't have a regulated voltage, the LED may change brightness as battery drains out. It just came to my mind: can you manage on the sw side 2 of your reed switches on at the same time? If you can find a way you can still use the magnet and add additional "half step" in your wind direction and make it more precise