MySensors weather station



  • So after getting my 3D printer I was thinking of all the MySensors projects that I could build with it. One of the things that I had looked at previously was setting up a weather station for my setup. The problem was that I would have had to buy some commercial weather station hardware and try to convert it to work with MySensors. The hardware alone for these was a bit expensive, not to mention the work it would take to convert it.

    Having a 3D printer now has opened new doors for this project. I started working on designs for the parts to this and have some good progress. I still need to work out some of the electronics, but that will come in time as I get parts built.

    One of the first things was designing a tipping bucket rain gauge which I have some posts on in a topic under hardware in the forum. I still need to print some parts for this. Started printing some things and ran out of white filament. Just got my new roll in the other day, so I will most likely start these in the next couple days.

    No weather station is complete without wind speed and wind direction sensors, so that's what I decided to embark on next. Since I had to wait for my new roll of filament, I decided to work on some of the design. Here is the proposed design that I came up with:
    0_1492579442253_upload-9d6f2c2d-b14f-4e01-aa55-2676b8a767a0
    This design is loosely based off of some setups that I saw when doing some google image searches. I started with the anemometer cups. I found an OpenSCAD design for these on thingiverse http://www.thingiverse.com/thing:34644 and used that as my starting point. I designed all of the other parts around this. So the only part of this that I can say is not truly my design is that. There are 12 parts total that I printed for this:

    • 3 anemometer cups with arms
    • Central cylinder that the cups mount to
    • Bottom case with square mounting peg that holds the anemometer sensor
    • wind speed rotor that holds the magnet for the sensor
    • Top case that holds the wind direction vane
    • The wind direction cap
    • 2 wind vane arms to hold the tail fin and the nose cone
    • The tail fin
    • The nose cone
      One last part that I have not designed yet which will be pretty simple is the internal wind direction rotor that will hold the magnet for the direction sensor.

    Here are some pics of the finished parts:

    Wind direction vane inside showing 1 inch roller bearing
    0_1492580928347_upload-e9276313-c9ee-4021-82f3-0f2b47e71763

    Anemometer inside showing the mounted rotor.
    0_1492581218664_upload-12a03fee-2522-449a-a4e3-8f32a3575725

    The full assembly
    0_1492581353570_upload-83e77ae4-8c44-4276-8ecb-eef6b5b55eb7

    For the screw posts to hold the cap and base together, I took some stainless circuit board mounting posts similar to the ones below that I had in my parts bin and use my soldering iron to melt them into the holes. My guess is that the melted plastic took a good hold of the threaded end, so I doubt they are coming out.
    0_1492581503247_upload-99e1007c-c652-4aa9-acf5-2a99d761c30a

    All in all, the project is coming together nicely. Once I get a few more pieces together, I will post all of this on my thingiverse page and give the link to the group. I will post further details on this as I get things done. I always welcome comments and suggestion to my designs, so if you have any, feel free to post them here.


  • Hardware Contributor

    @dbemowsk - nice work! Looking forward to follow this project!



  • @sundberg84 I should have the wind sensor finished by next week. I already have the reed switch I need for the wind speed sensor. The ones for the direction sensor needed to be smaller, so I ordered some 7mm magnetic reed switches today to use for that. I'll make the direction sensor board something like this:
    0_1492582900498_upload-dd7be013-f9bb-464c-80a4-b55d0986df7e



  • @sundberg84 I have some of your new Rev 9 boards that I got recently that I will most likely be using for this project. Kudos on the boards.


  • Hardware Contributor

    @dbemowsk - maybe we could do some sort of basic PCB to use with your project later on and MySensors people can buy and assemble both PCB and 3d printed thereself. Well that for the future. Good luck!


  • Mod

    @dbemowsk awesome what you're doing in openscad! 👍
    I wonder if we could come up with a design that also incorporates a rain meter and all electronics...



  • @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.
    0_1492609871971_upload-c7184435-2dae-4656-ba4b-2aa10de8616a

    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:
    0_1492610587524_upload-3edce7d8-df62-41ef-b664-aa07c550e9d4
    0_1492610971206_upload-9424bd18-349f-413e-8e48-114f5cf3fd62



  • @sundberg84 I love the idea of putting together a board for this. I would probably hold off though until I get the hardware built to know what we are dealing with. If we do it, it could be designed with connectors for all of the sensors and be set up as some sort of modular design so that people could build as much or as little of the project as they want.


  • Hardware Contributor

    @dbemowsk - sounds like a good plan!



  • 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.


  • Mod

    @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 💅 IMHO
    Maybe I'd better sit down and drawn something to get the creativity flowing 😉

    What material did you use to print it BTW?


  • Mod

    For what I read ASA filaments are uv resistant and can sustain outdoor exposure.



  • @Yveaux You can NEVER forget the WAF. Luckily, my wife is to the point of just asking, "so what are you building now".



  • @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.
    0_1492875963522_upload-373e9c0b-f453-4328-97fc-62a7be9b5cc1

    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.
    0_1492876264052_upload-b165feee-93e0-48a9-b1d0-4c2af21c550e

    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
    0_1492876688706_upload-57ee9f7c-ac97-4704-855f-72e916d8eb07

    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.
    0_1492877066850_upload-e840a1bf-f9b5-4b42-bfcb-4b18d46d47cf

    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.
    0_1492881263412_upload-beb662b0-043a-4250-aedd-3a51ac3497f1

    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.


  • Mod

    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.
    0_1493175374379_upload-a0192f97-d885-4f50-b4cd-9f01ec151da7

    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.
    0_1493175842348_upload-46ddb478-2a46-4b59-88fa-6a290eec5272

    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.
    0_1493176935322_upload-3b93081d-dd79-412c-b882-e6327d927e4b

    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?


  • Admin

    @dbemowsk

    Maybe you can get some inspiration from this (that's using a potentiometer)
    http://www.thingiverse.com/thing:952978


  • Mod

    20$ for a potentiometer???? 🙀
    With that price it is cheaper to hack a spare part from another weather station 😄


  • Admin

    Haha.. yes.. didn't google prices. That's pricey 😬


  • Mod

    @dbemowsk You could use a compass sensor (e.g. HMC5883L) with a small magnet revolving above it.
    Requires some math to get the angle but once you nail it you'll get incredible precision from it.


  • Mod

    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 I am assuming that you are talking about this post:
    https://forum.mysensors.org/topic/6645/fody-weather-station-wind-sensor/2

    I would have to figure out how to wire everything, but that would be an option.




  • Mod

    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 🙂



  • @gohan Good point on the 50 pieces. I can do some experimenting prior to the final design to figure out what is going to work best.


  • Mod

    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



  • @gohan My plan I think is going to be to have a solar panel that will charge a small LiPo or SLA battery. I would size the battery big enough to handle the regulator on the pro mini and use the regulated output voltage to run the LED to give it a constant brightness.

    My original plan with the reed switches was to have the ability to trigger 2 reed switches at once. That was the reason for having 4 reed switches for N S E W and the other 4 for NE SE SW NW. I designed it to use 2 IO lines for the 2 different banks of 4 reed switches. That way if the N and NE reed switches were triggered that you would get that extra half step. The biggest problem that I am running into is that for some reason the reed switches don't seem to be triggering consistently with any of the magnet configurations I have tried. That is why I wanted to look at another approach.

    I ordered the 10 photo transistors this morning. I will still look at a way to run them as 2 banks of 4 sensors like I did with the reed switches so I can get that extra half step.



  • @gohan said in MySensors weather station:

    The tricky part will be to find the right brightness for the LED when it is crossing between 2 photo-transistor, but I think it will be easier to adjust than changing a magnetic field 🙂

    What I did for wind direction is that I "look" for the first photo-transistor that get light from the LED and use that direction. So I don't care if the light is crossing between 2 photo-transistor. I scan from first digital in until i scanned all of them.

    void readWindDirection()
    {
      //check in what direction the wind is. First sensor that have light will be the direction
      int i = 4;
      for (i; i < 9 ; i++){
        if (!digitalRead(i)){
          WD = WDarray[i-4];
          return;
        }
      }
      i = 14;
      for (i; i < 17 ; i++){
        if (!digitalRead(i)){
          WD = WDarray[i-9];
          return;
        }
      }
    }
    


  • @flopp I am curious how you wired your electronics. I saw that as one of your original questions in your fody weather station post. so based on what you are saying, you really only use the 8 different directions, N, NE, E, SE, S, SW, W, NW, correct?

    I have the basic design of the one you had pictured in your post mostly done. I still have to plan for circuit board mounting and wire connections, but I don't think that should be too difficult.

    Here is my starting design done in OpenSCAD. I have the center hole threaded part way with a US 1/4 x 20 thread as that is what I used for the bolts to go through the wind vane.
    0_1493275410728_upload-206e872f-5ef5-4ef8-9c8b-5e4536d8fb31
    0_1493275543341_upload-febb1225-6256-4cc2-bee9-2c4d220d3238

    I shoud be getting the phototransistors by Monday, so I want to draw up a preliminary design for the circuit board before that.



  • @dbemowsk said in MySensors weather station:

    @flopp I am curious how you wired your electronics. I saw that as one of your original questions in your fody weather station post. so based on what you are saying, you really only use the 8 different directions, N, NE, E, SE, S, SW, W, NW, correct?

    Yes, correct. I have 8 receivers for the light.

    I want to know more about this product https://www.youtube.com/watch?v=-oQiJ50LcAc



  • @dbemowsk said in MySensors weather station:

    Here is my starting design done in OpenSCAD. I have the center hole threaded part way with a US 1/4 x 20 thread as that is what I used for the bolts to go through the wind vane.

    Your drawings look good.



  • Here is possibly how it would be fitted into the wind vane body cap. It'll be a tight fit for the PCB, but I'm sure I can make it.
    0_1493290462764_upload-41341d20-831d-4331-9aba-56d34034fbb9



  • Some things about the direction sensor, your magnet/reed switch is exactly what is in the old dallas 1-wire weather station and it worked well giving 16 positions,

    the led/photodiode method mentioed by gohan is interesting, if you used analog inputs you could use the value across 3 of them at a time to interpolate a pretty high resolution answer, multiplexing could make it so you dont need 8 analog inputs.

    Another thing is a rotary encoder, ive seen them used to measure the angles of telescope mounts, i believe they can be had with good enough resolution for your needs.

    I didnt read the whole thread, apologies if i am repeating ideas, or if you have decided on a solution.



  • @wallyllama No problem, I appreciate the input.



  • So for the phototransistor method, I figured I could use a similar approach to what I was planning with the reed switches. Here is a proposed schematic:
    0_1493356241919_upload-499fb8bd-e4c7-435b-a86a-114395356c60

    The idea is to use two identical banks of 4 phototransistors and alternating these in the slots. This should allow me to get the increased resolution that I was figuring on getting with the reed switch design.

    Does anyone see any issues with this design?



  • @dbemowsk
    On my(fody) wind direction they use GND instead of VCC. When light is hitting the receiver, GND is passing through and you get a shortcut. I think, in that way you don't need all the 3,3K resistors.

    About resolution, personally I wouldn't focus on that because the wind is never in the same direction more than a few second then it moves a little bit. Maybe it stays in same direction when you have strong winds?



  • @flopp Are you only using 1 analog data line? The idea behind the resistors is to give varying degrees of 0 to 5 volts on the analog pin. Depending on which phototransistor is triggered, the value seen by the IO line is different for every one allowing you to differentiate which sensor is tripped.

    If you are saying not to worry as much about the resolution, then I should be able to drop to using only 1 analog line instead of two with a configuration like this:
    0_1493364799125_upload-a8f9c536-c440-4196-a5f6-060f6c6ce3f4



  • @dbemowsk
    I am using 8 digital inputs, with pinmode(x,INPUT_PULLUP) on all of them, A0, A1 and A2 i use as digital input because I am using UNO so all the digitals was occupied with NRf and Rain, Wind speed.



  • @flopp I just didn't want to use up all the IO lines if I didn't have to. The designs that I was showing with the resistors allows you to detect multiple switch triggers with 1 or 2 I/O lines depending how you want that detection done. I want to add a few other sensors to the setup, so I want to keep as many IO lines free as I can.



  • Just got my phototransistors. The ebay auction said that it was for 10 sensors. I got 15..... BONUS. :^)



  • OK, so I am doing some testing on the new wind direction sensor board I am building. My problem is that the infrared LED that I have, which was scavanged from an old remote, has good IR pointing forward. but when I try to direct it sideways to the IR sensors, I appear to not be getting enough IR light to trigger the sensors. If I shine a flashlight at each of the sensors, they register, but not when O Does anyone know of either a different IR diode, or a way that I can get the existing diode to shine more in a sideways direction? Here is what the board is looking like. I currently only have one set of 4 sensors connected for testing. You can kind of see that the IR LED is lit.
    0_1495063129068_upload-5fcf55ca-db4f-48c5-9d3a-721e5c0b9bb1

    This is the design of the IR rotor that directs the light which gets screwed to the end of the bolt that is the shaft of the wind direction vane. The majority of the IR light gets directed at the end of the bolt.
    0_1495063638749_upload-c72eb7e3-4af9-4742-bffe-20d565d4835b .

    I am up for any suggestions.


  • Mod

    Something reflective that diffuses light?



  • @dbemowsk 15 is metric for 10.*

    • If you received 16, then I could have said you ordered in hex, and this would actually have been funny.


  • @dbemowsk i have an led flashlight in the shape of a lantern, it has a shape like cone that has been dehydrated, so there is a concave curve from the base to the tip. Sort of like a golf tee but different proportions.0_1495070004870_1495069978157-964853724.jpg

    I guess it it like a regular flashlight reflector inside out



  • @wallyllama That would have been funny. There are 10 types of people in this world, Those that understand binary, and those that don't.



  • @wallyllama My only problem with this is that the hole that the LED fits in is slightly larger than 5mm, so that cone would need to be tiny.



  • @dbemowsk actually, you only have to illuminate the sensors that your slot faces, a 45° mirror or a reflector opposite the slot should help.



  • @gohan I tried putting a piece of tin foil in the hole, but it must not have been at the right angle.


  • Mod

    Maybe a steel sphere? A white piece of plastic? Remember that you can use the smartphone camera to see the ir light coming from the led, in case you would like to see the result before assembling it



  • @gohan Yes, I have been using my smart phone camera. I use it all the time at work to test remotes. I have some other things to try later today. I will post my results.



  • Hello all,
    I'd like to add to this discussion my bit,
    here is code from my older project of arduino based, battery operated, solar panel charged weather station
    https://github.com/Luc3as/MySensors-WeatherStation
    I must finish all documentation, I have PCBs ready and manufactured and tested, and models ready for 3d prints too.
    I am not measuring wind so I am also interested in nice work above.
    for now it is still work in progress, here is little teaser of overall look
    0_1495694816412_IMG_20170519_171638.jpg



  • @Luc3as Thanks for the contribution. I have been quite busy the past few weeks and haven't had a lot of time to work more on the wind direction sensor. There are still a few issues I am working through with that before I can start jumping into the code for it. I am hoping to get more done this weekend.

    As for your 3D files, do you have them on thingiverse or somewhere accessible for us to check them out? I am interested in the work you have done.


  • Mod

    Those are quite a lot of solar panels. Is it that power hungry?



  • @gohan I can't see those small panels delivering that much. Plus, at certain parts of the day a number of the panels will most likely be shaded lowering their output.



  • @dbemowsk yup, actually there are 8 of them, each providing nominal 0,5 volts, so to power up the lipo charger for battery I need at least 4 volts, in direct sunlight I think this will not be problem, but as @dbemowsk says, it will not have ideal position to sun every day and for whole time. but there is big enough reserve at battery , providing power for few days to weeks even without solar panel.
    and I am also checking voltage on solar panel so if there would be some problem with charging I can set notifications or something from home automation system.



  • I did some wind speed and direction sensor boards that I use in my own weather station design. All solid state and high resolution with analog signal readout, voltage for direction, 8 pulse per rev for speed. For inspiration see http://wws.us.to. Gary


  • Mod

    @Luc3as if you put solar panels in series you will get resistance from the shaded ones (at least that is what I saw in some experiments) . It would be better to have a single one pointing south that gathers the most sunlight and that's it



  • @gohan said in MySensors weather station:

    @Luc3as if you put solar panels in series you will get resistance from the shaded ones

    That is correct, as far as what I have learned. Large monocrystaline and polycrystaline solar panels like the ones shown below have low to no output for the entire panel when one or more of the cells on a panel is shaded or covered.
    0_1495767863204_upload-5b7ebb13-0e24-46c9-9309-63bcf0032e7a

    Amorphous solar panels like these have closer to full output with less drop-off in shaded areas, but have a lower overall amperage output than monocrystaline and polycrystaline panels.
    0_1495768140607_upload-6ac6d03c-ceb7-4228-ac66-8918a44a6ea5

    The cells that @Luc3as has in his pic appear to be monocrystaline cells. Each cell will produce about 0.5 volts, so depending on the batteries you are using and the charging circuit, you could put some of these in series to create a couple banks, and then put the banks in parallel, you may get some usable power to charge a battery.



  • @GaryStofer I was checking out your weather station design. Nice work. Out of curiosity, what did you use for your wind direction sensor?



  • @dbemowsk Initially I uses an AS5030 encoder, but then I switched to the EM-3242 as it's much cheaper and smaller and does the same. My board has an Op-amp inverter to change the sense of angle to voltage so that the magnet can run on the top of the chip rather than on the bottom. Only problem we had with the EM-3242 was that it has no hysteresis which shows up at the 360/0 junction.



  • So, I had put this project on hold for a bit, but I am back at it. One of the parts of the project that I will be talking about in this post is the rain gauge portion of this. I had started a thread on this part a while back, but decided that I would combine everything for the weather station in this thread.

    So one of the things with this rain gauge was that I wanted to make it fairly accurate. In my "tipping bucket rain gauge" thread, @BulldogLowell had mentioned that an 8 inch opening on the funnel is typical for what is used commercially, so I went with that and designed this:
    0_1497912167330_upload-e18b1b01-0515-4e52-8869-e9ec3f454828
    0_1497912228058_upload-93bcefc3-6e26-4066-897f-6f7e668ec752
    Before I could print this on the 3D printer, I needed to print some different parts for my printer to allow for it to print the large size of the funnel. I also did some research on what type of plastic I should use before printing this monstrous part. Something I should have looked into more before printing the wind direction vane and wind speed rotor. Being that this will be outdoors in the sun it will need to have some UV resistance. I ended up settling on e-sun PETG filament. According to this review that I read, there was this statement that sold me on it:

    "It can also maintain the finished product's toughness and prevent it from turning into a yellowish color. PETG also contains UV absorber and can serve as a protective layer from the influence of ultraviolet light."

    At any rate, I just got my brand new roll of white and started the print:
    0_1497913538802_upload-f3954b84-720b-42d5-bfa9-6674b7d6e7c1
    I am running at a 0.24 layer height which should be fine for this. I am printing at 30 mm/s. Cura says 44 hours 40 minutes for the print, but the times from cura are usually a bit short. I am betting on about 48 hours total print time. This will be the largest print job I have ever had the printer do. The picture is at about 17 to 18 hours into the print.

    Tonight I will be tweaking the design of the base that will hold the tipping bucket and sensor. I did some test prints a while back of the basic parts of this to see how they would function, and I think they worked well. This is the basic design that I have as of now:
    0_1497915054416_upload-ac77942b-edef-44c7-b719-1c3f83dc2fca
    A few tweaks to this and it should be good. The main thing is going to be figuring out how I want this to mount/attach to the rest of the system with the wind sensors and the arduino. Since this will just have the reed sensor, I will need to account for how it will get wired to the arduino. I am open for any suggestions on how to attach this to the rest of the sensors. My plan was to have some PVC pipes as the supports and mount things to that. I will need to watch out for the drain holes when mounting.

    All in all I think the project is coming along despite having to put it on hold for a while. As always, I am open to any feedback or suggestions that anyone can give.

    Thanks for reading.



  • thanks for this
    one of my cups on my anemometer is broken might be able to tweak that file instead of starting from scratch now



  • @MasterCATZ the anemometer that I used was one that I found on thingiverse. The link is in the beginning of the thread, but I am sure you found that already. You may want to just create a whole new cup rotor for yours.


  • Mod

    @dbemowsk that's quite a lot of support material ☺



  • @gohan I agree, but I wanted to play it safe for when it got to the main funnel part. I opted to set the structure type to lines instead of a grid to at least keep the waste down some.

    Just over 24 hours into the print. As you can see in this updated pic, it is just starting to get to what will be the top part of the funnel where it is tapering in.
    0_1497937820531_upload-83c04d37-8a81-45b2-9365-97b38eb56b4a



  • Just an update on the progress. It just started on the box this morning. Should be finished tonight at some point.
    0_1497958856921_upload-537b0254-6498-4d49-86a9-5c88d9f525b6



  • Hello,

    I found this in the forum. Perhaps it helps for the wind direction detection.

    https://forum.mysensors.org/post/17825

    Especially here
    http://www.philpot.me/weatherinsider.html



  • @marco4711 Thanks for the links. I still have a few more things that I want to try to get my setup working If it comes down to it, I may use MasterCATZ' idea of using a magnetic rotational sensor. I don't give up easily.



  • Well, the part finally finished. Roughly 46 hours. Overall, I think it will work good. It was a bit of a job clearing out all of the support material though.
    0_1498016481853_upload-8d7bd6b4-81c8-47d1-b5ea-634de160c85f

    The bottom turned out well.
    0_1498016713961_upload-c8b84df7-4dee-468d-baeb-ac2c8d91188b

    The first few layers had some issues, but really nothing that will defeat it's purpose. Had me worried for a short time though, but I gave it the benefit of the doubt.
    0_1498016851444_upload-f03e5ee9-a10f-498c-93dd-0d5985544c58



  • So, for the latest addition to my weather station, I decided to make a radiation shield to house a DHT22 temp and humidity sensor. I figured that I would also need a place to put the arduino to be used as a connection hub for everything and I figured this would be as good a place as any. This is my design for it:
    0_1498978951186_upload-fc2eb2a2-f4be-4e60-b58f-d8acacfde543

    The under side of the base is where the electronics will be mounted. I have designed the standoffs to mount an easy newbie board. and should have plenty of room for wire connections as these will be fairly basic.
    0_1498979383692_upload-f73c8994-4742-42f0-b710-6d097e4e3fbc

    In the event that water should get inside of the unit due to wind or other factors, I have designed the bottom cover with a tapered center going to a drain hole.
    0_1498979569506_upload-bba6491f-732a-4a60-bc61-897dc90f2f70

    I have the radiation shield and rain gauge partially assembled for now for programming and testing. I will get some better pictures of that tomorrow and post them to the thread.

    One other change that I decided on was for the wind direction sensor. Since I had a bit of trouble with the other designs that I tested using reed switches and IR phototransistors, I decided to try an AS5047P magnetic direction sensor. I ordered this one off of ebay. It was a bit expensive at $16 US plus $3.39 for shipping, but the person selling it mentioned that it comes with an extra chip. These sell on Digikey for $17 plus $7 and change for shipping, and the chips alone sell for around $9, so I didn't think it was that bad of a deal. I should have that later this week.
    0_1498980091138_upload-31626253-dcaf-4ca5-b68e-f4d11c479f05

    Once I get this assembled I think the last thing will be to figure out all of the programming, which I have a bit of a start on using the rain gauge code from the build section of the site. I have been researching the code for the anemometer, and that may take a bit of planning with everything else that I have running, but I think it can be done. With the new direction sensor module, that should be pretty straight forward as far as connection and code, I just need to decide if I want to connect it with SPI or straight analog. I am thinking though that this project is nearing completion. It was a bit of a learning curve building all of the parts, but I think it was a good journey.

    As mentioned, I'll post more pics tomorrow.



  • looking good

    I need to beef up my solar panels

    I get 1 week before the low battery indicator switches on and I loose half my distance

    instead of using 2x AA 1.5v batteries ( or 1.2v rechargeables )

    I am just going to run 18650 cells and use a 4v solar panel



  • @MasterCATZ I had actually thought of getting a small 6 volt SLA or AGM battery and connecting a small solar panel to it. I can knock out an easy battery box with a solar panel mount on my 3D printer. These are the solar panels I was looking at as possibilities:
    https://www.amazon.com/Sunnytech-333ma-Module-System-Charger/dp/B00HQXQOIQ/ref=sr_1_28?ie=UTF8&qid=1499001654&sr=8-28&keywords=6+volt+solar+panel+charger
    https://www.amazon.com/Portable-Module-System-Battery-Charger/dp/B01JLPM81I/ref=sr_1_39?ie=UTF8&qid=1499001192&sr=8-39&keywords=6+volt+solar+panel+charger
    I just need enough power from the panel to power the arduino and sensors during the day plus a little extra to top off the battery. I figured if I ever decide to add more sensors to the station I'll have all the power I need to handle whatever I put on it. I have my Easy Newbie board set up with a 5V pro mini and power coming into the RAW input. I think I'll be set.



  • Here are a couple pics of my first prototype mounting layout of the sensors. I may still use some elbows and get the anemometer and wind direction vane moved a bit higher than the other sensors. My fear is that with all of the sensors sitting on the same plane, wind passing by the other sensor housings may affect the readings of these. The main one I am concerned with is the rain sensor. This is a minor obstacle that can be fixed with two PVC elbows.
    0_1499028515008_upload-d23be907-c68e-4994-863c-4f73824bb0ba0_1499028531031_upload-1b3c57ac-913d-4ddd-aa07-2552f9f2e78e

    Another thing, I was thinking about the batteries that I want to use with this and I noticed that I have had the 4 - AA battery pack on for a few days now and they are still running. If I put together a pack of 2 18650 batteries, I should be good. Those batteries run at 3.7 volts, so 2 of them should give my 7.4 volts which should be no problem on the RAW input of the pro mini. My only worry with these would be overcharging them. Being that these are lithium ion batteries, they can be dangerous if overcharged. Just need to find a decent solar charging circuit for them. I am open for suggestions if anyone has any.

    I hope within the next week I can have all of the OpenSCAD files cleaned up and posted on thingiverse. I wanted to post some of them a while back, but ended up making a few minor tweaks.

    Enjoy...



  • So today as I was working on the rig to change the placement of the anemometer/wind direction assembly, I ended up dropping the assembly and broke one of the cups off. As I was getting ready to make a new wind cup assembly, I decided to make a small change in the design. The change that I made has the arms holding the cups lower to better prevent wind interference from the housing. Here is the new design.
    0_1499058501983_upload-14e57d76-754e-42f9-93c1-2674252c6a5b

    I will post more pics tomorrow of the change in placement of the anemometer assembly with the new cups.


  • Mod

    You could power the pro mini directly to vcc using just one lithium cell and remove the voltage regulator and led to save power.



  • @gohan Right now the only Pro Minis that I have left in my parts bin are 5 volt ones. Besides, I already have the newbie board fitted with the 3.3v regulator and power caps. Another compelling reason for using a 5v mini is that it is 16MHz instead of 8MHz for the 3.3v ones. I think that I am going to want the extra speed for the number of sensors I have connected to a single pro mini and the data that I need to collect. I need to use interrupts for the pulse counting of the anemometer, so the faster I can do those things, the better off I'll be.


  • Hardware Contributor

    @dbemowsk - are your goal to sleep this sensor or whats your thoughts running it with battery? It might be a hard nut to crack 5v 16mhz and batteries?

    Love your thread btw! Keep up the good work 🙂



  • @sundberg84 I don't plan to sleep the sensor at all. Putting the sensor to sleep would cause problems with the anemometer and the interrupt I need to use for that. The main reason for needing it to run on battery is that I plan to mount this up in the air on the top edge of my house. This is why I want to also put a solar panel on it. During the day the solar panel can run the sensor and charge the battery, and at night the battery can take over.


  • Mod

    Are you sure you don't want to sleep sensor? If it is a matter of interrupts for anemometer, you could use a dinamic sleep time, like if you don't have any wind motion within 2 seconds put the node to sleep and wake it up on pin change



  • @gohan I have never worked with a dynamic sleep timer. Do you have am example of how this is used?


  • Mod

    Not really, maybe just put the sleep in an IF statement and check if the time from last impulse from the anemometer is over than 2 sec then sleep, otherwise it just continues loop



  • @gohan So am I correct in assuming that an interrupt will wake a sleep timer? As long as I can catch the pulses from the anemometer, I don't see a reason I couldn't use a sleep timer. Just thinking about it, I may also want to use an interrupt for the rain gauge sensor for similar reasons. Not sure about the wind direction sensor.



  • Here are a few more pictures of the new layout with the new anemometer cups.
    0_1499087266284_upload-2b958d54-e3bb-4ae1-9ba4-815bc9ac5f88
    0_1499087278053_upload-dec6c2b6-ee03-4891-9f89-161246ed722f
    0_1499087288381_upload-164b9af0-fe6c-4ebf-ab25-e675e10c41d7


  • Mod

    @dbemowsk basically you would need to attach sleep to both interrupts on pin 2 and 3 and use them for anemometer and rain meter. For wind direction check it when it wakes up



  • So I am trying to figure out code for the wind speed sensor and I see there is a V_GUST value. I am wondering what people use for that value.



  • So now that I have the wind direction sensor working, I need to try to migrate the code into my weather_station sketch. One option that I am working on implementing is a calibration button for North. So after I get things set up and mounted, I will use a compass to point the wind vane towards North. I will then press the calibration button which will save the current direction position to EEPROM if it is different than the one stored. The following code will then be used to get the true direction that the wind vane is pointing.

    value = 360 * myAS5047.sensor_read() / 16383; //Read the value from the direction sensor as a value from 0 to 360
    north_offset = EEPROM.read(address);  //Read the offset value from EEPROM
    
    dir = ((value - north_offset) < 0) ? 360 - abs (value - north_offset)  : value - north_offset; //Get the true direction
    /*
    insert code to read the button and if pressed, check the current value stored in EEPROM against the value read from the sensor
    and write the new value if it is different.  If the sensor value matches the current stored value, then ignore the write to
    save on EEPROM writes.
    */
    

    So with this idea, I will need to know a few things. First, I am assuming that MySensors does EEPROM writes and reads. Is there a particular addreess pointer variable that I should use when writing my value to EEPROM? I will also need to know how I can get the address pointer to that data the same each time the arduino is reset, especially if MySensors does writes and reads.

    As always, any input is appreciated.


  • Hardware Contributor

    Hello, @dbemowsk
    You should use the built in method from the MySensors library to do that :
    https://www.mysensors.org/download/sensor_api_20#saving-state



  • @Nca78 Thanks, exactly what I wanted to know.



  • @Nca78 So my values are from 0 to 360, looking at the link you posted, the value that you save to an address is uint8_t which is equivalent to a byte (0 to 255). Is there a way to store a word value (uint16_t), or do I need to break the value into two bytes and store those into two positions?


  • Hardware Contributor

    @dbemowsk said in MySensors weather station:

    @Nca78 So my values are from 0 to 360, looking at the link you posted, the value that you save to an address is uint8_t which is equivalent to a byte (0 to 255). Is there a way to store a word value (uint16_t), or do I need to break the value into two bytes and store those into two positions?

    Yes it can only store bytes, but it's not a big deal to make a method to read/write values on 2 bytes.
    Else you can just keep a precision of 2° and divide by 2 to get a 0=>180 value 😉



  • Actually thinking about this, I should be using 0 to 359. 0 to 360 is actually 361 positions, not 360.


  • Mod

    Precision of 2° I believe it's enough as many weather stations provide just the 8 general directions



  • @gohan It would only be for saving the offset for north, so I think I will do that.



  • So I am trying to figure out the SPI for the wind direction sensor. Where is the SPI code for MySensors. Do I need to call SPI.begin()? Does MySensors code use transactions? If so, where can I find that to look at.


  • Mod

    Doesn't it have a library?



  • @gohan It does, but it is an untested library. This is the test code that I ran using that library:

    #include "AS5047.h"
    #include <SPI.h>
    #include <EEPROM.h>
    
    #define SWITCH_PIN 7 //The north calibration switch
    
    AS5047 myAS5047(5); // SS pin
     
    int address = 0;      //EEPROM address counter
    int north_offset = 0;
    long value;
    int dir;
    bool button;
    
    void setup()
    {
      SPI.begin;
      Serial.begin(9600);
    
      pinMode(SWITCH_PIN, INPUT_PULLUP);
    
      north_offset = EEPROM.read(address);
    }
    
    void loop()
    {
      value=(360*myAS5047.sensor_read())/16383;
      dir = ((value - north_offset) < 0) ? 360 - abs(value - north_offset) : value - north_offset;
      
      Serial.print("measured direction: ");
      Serial.println(dir);
      Serial.print("north_offset: ");
      Serial.println(north_offset);
    
      button = digitalRead(SWITCH_PIN);
      north_offset = EEPROM.read(address);
      if (!button && north_offset != value) {
        EEPROM.write(address, value);
        north_offset = value;
        Serial.println("Button pressed");
      }
      
      delay(1000);
    }
    

    This test worked fine, now I am trying to merge this with my weather station sketch. I am not very familiar with working with SPI. In the setup() method, they call SPI.begin(). I am just trying to figure out what I need to do for merging the code.



  • Should all of the SPI stuff be included in the library?


Log in to reply
 

Suggested Topics

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts