Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Enclosures / 3D Printing
  3. MySensors weather station

MySensors weather station

Scheduled Pinned Locked Moved Enclosures / 3D Printing
138 Posts 16 Posters 58.6k Views 15 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • dbemowskD dbemowsk

    @Nca78 ok, so I tried adding this:

    void before()
    {
      digitalWrite(AS5047_CHIP_SELECT_PIN, HIGH);
    }
    

    This seems to now allow the radio to connect, but I am still having some trouble. I then tried removing setting the CSN pin high in the before(), and adding it to the constructor of the library class here:

    AS5047::AS5047(uint16_t SelectPin)
             : _ss(SelectPin)
    {
             pinMode(_ss, OUTPUT);
             SPCR = (1<<SPE) | (1<<MSTR) | (1<<CPHA) | (1<<SPR1) | (1<<SPR0); // slow down clock speed, set up spi
             digitalWrite(_ss, HIGH); //<<-------------
             SPI.begin();
    }
    

    This seemed to do the same as putting it in the begin() method, but still having some trouble. I am going to see if I can work through the problems on my own, but I may post if I have questions. Let me know if you see problems with what I did to the class.

    Thanks.

    YveauxY Offline
    YveauxY Offline
    Yveaux
    Mod
    wrote on last edited by Yveaux
    #104

    @dbemowsk it's good practice to have a pull up resistor on each SPI CS line (approx. 10k).
    It can save you a lot of hassle when multiple devices share the same SPI bus.

    http://yveaux.blogspot.nl

    dbemowskD 1 Reply Last reply
    1
    • YveauxY Yveaux

      @dbemowsk it's good practice to have a pull up resistor on each SPI CS line (approx. 10k).
      It can save you a lot of hassle when multiple devices share the same SPI bus.

      dbemowskD Offline
      dbemowskD Offline
      dbemowsk
      wrote on last edited by
      #105

      @Yveaux Thanks, this is easy enough. I have some small 1/8w 10k resistors with a small bit of room in the proto area of the easy newbie board yet, I will add one in.

      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

      YveauxY 1 Reply Last reply
      0
      • dbemowskD dbemowsk

        @Yveaux Thanks, this is easy enough. I have some small 1/8w 10k resistors with a small bit of room in the proto area of the easy newbie board yet, I will add one in.

        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #106

        @dbemowsk said in MySensors weather station:

        I will add one in.

        Two, one for each SPI device ;-)

        http://yveaux.blogspot.nl

        dbemowskD 1 Reply Last reply
        0
        • YveauxY Yveaux

          @dbemowsk said in MySensors weather station:

          I will add one in.

          Two, one for each SPI device ;-)

          dbemowskD Offline
          dbemowskD Offline
          dbemowsk
          wrote on last edited by
          #107

          @Yveaux I thought the nRF24 radios would have had it built in to the module, but I never checked. It is just that and the magnetic direction sensor on the SPI bus. After thinking about it too, I may just add the resistor on to the small board I have inside the wind speed and direction sensor case that the wire harness connects to, or do you think it would be better if it was closer to the arduino? If that is the case, then I would stick with my original plan to put it in the little bit of leftover space in the proto area of the easy newbie board. Jumper wires are getting a bit cramped in that space though, so if I can avoid it I will.

          Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
          Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

          YveauxY 1 Reply Last reply
          0
          • dbemowskD dbemowsk

            @Yveaux I thought the nRF24 radios would have had it built in to the module, but I never checked. It is just that and the magnetic direction sensor on the SPI bus. After thinking about it too, I may just add the resistor on to the small board I have inside the wind speed and direction sensor case that the wire harness connects to, or do you think it would be better if it was closer to the arduino? If that is the case, then I would stick with my original plan to put it in the little bit of leftover space in the proto area of the easy newbie board. Jumper wires are getting a bit cramped in that space though, so if I can avoid it I will.

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by Yveaux
            #108

            @dbemowsk the nrf module doesn't have a pullup on CS.
            Where you put them doesn't really matter. It's just to have a defined, unselected state when the lines are not actively driven by the microcontroller.
            If it is too much trouble in your current hardware, then skip the pull-ups and save them for your next piece of hardware. The same can be achieved in software, but you just must make sure all CS lines are made inactive (high) before doing anything with the SPI bus. Before() is a good place to achieve this, but bad designed drivers that use eg the constructor to do spi initialization could still beat you to it...
            Therefore pull-ups are preferred.

            http://yveaux.blogspot.nl

            dbemowskD 2 Replies Last reply
            0
            • YveauxY Yveaux

              @dbemowsk the nrf module doesn't have a pullup on CS.
              Where you put them doesn't really matter. It's just to have a defined, unselected state when the lines are not actively driven by the microcontroller.
              If it is too much trouble in your current hardware, then skip the pull-ups and save them for your next piece of hardware. The same can be achieved in software, but you just must make sure all CS lines are made inactive (high) before doing anything with the SPI bus. Before() is a good place to achieve this, but bad designed drivers that use eg the constructor to do spi initialization could still beat you to it...
              Therefore pull-ups are preferred.

              dbemowskD Offline
              dbemowskD Offline
              dbemowsk
              wrote on last edited by
              #109

              @Yveaux If I am going to do one for the radio too, I can put one in the case of the wind sensor and one in the proto area for the radio. I think I'll be alright. It will eliminate confusion on the programming end.

              Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
              Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

              1 Reply Last reply
              0
              • YveauxY Yveaux

                @dbemowsk the nrf module doesn't have a pullup on CS.
                Where you put them doesn't really matter. It's just to have a defined, unselected state when the lines are not actively driven by the microcontroller.
                If it is too much trouble in your current hardware, then skip the pull-ups and save them for your next piece of hardware. The same can be achieved in software, but you just must make sure all CS lines are made inactive (high) before doing anything with the SPI bus. Before() is a good place to achieve this, but bad designed drivers that use eg the constructor to do spi initialization could still beat you to it...
                Therefore pull-ups are preferred.

                dbemowskD Offline
                dbemowskD Offline
                dbemowsk
                wrote on last edited by
                #110

                @Yveaux So if this is done in software, is it better to be done in the before() method rather than the constructor of the library class? If the nRF24 radios do not have a built in pull up on the CS line, does the MySensors library somehow take care of this in one of it's class files? I haven't seen a push to have designers of MySensors hardware include pull-ups on the nRF24's CS line...

                Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                YveauxY 1 Reply Last reply
                0
                • dbemowskD dbemowsk

                  @Yveaux So if this is done in software, is it better to be done in the before() method rather than the constructor of the library class? If the nRF24 radios do not have a built in pull up on the CS line, does the MySensors library somehow take care of this in one of it's class files? I haven't seen a push to have designers of MySensors hardware include pull-ups on the nRF24's CS line...

                  YveauxY Offline
                  YveauxY Offline
                  Yveaux
                  Mod
                  wrote on last edited by Yveaux
                  #111

                  @dbemowsk said in MySensors weather station:

                  @Yveaux So if this is done in software, is it better to be done in the before() method rather than the constructor of the library class?

                  It all depends on initialization order of the classes, which isn't trivial. For global static instances (declared outside a function like loop()) the constructor will be called before the before() call, but if one places an instance inside a function or dynamically creates it things will be different. So, when designing a library you simply can't be sure when your constructie is called...

                  I'm not sure right now if the drivers actively pull the CS line high at startup, but IMHO they should.
                  The fact that some mySensors hardware designs lack pull-ups on CS is probably because the SPI bus isn't shared in many cases, and maybe because people aren't aware.
                  This would be a good item to add to a design checklist, if only we had one :-)

                  http://yveaux.blogspot.nl

                  dbemowskD 1 Reply Last reply
                  1
                  • YveauxY Yveaux

                    @dbemowsk said in MySensors weather station:

                    @Yveaux So if this is done in software, is it better to be done in the before() method rather than the constructor of the library class?

                    It all depends on initialization order of the classes, which isn't trivial. For global static instances (declared outside a function like loop()) the constructor will be called before the before() call, but if one places an instance inside a function or dynamically creates it things will be different. So, when designing a library you simply can't be sure when your constructie is called...

                    I'm not sure right now if the drivers actively pull the CS line high at startup, but IMHO they should.
                    The fact that some mySensors hardware designs lack pull-ups on CS is probably because the SPI bus isn't shared in many cases, and maybe because people aren't aware.
                    This would be a good item to add to a design checklist, if only we had one :-)

                    dbemowskD Offline
                    dbemowskD Offline
                    dbemowsk
                    wrote on last edited by
                    #112

                    @Yveaux Great explanation, thanks.

                    I am close to having things all working. I will post more as I progress.

                    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                    1 Reply Last reply
                    0
                    • dbemowskD Offline
                      dbemowskD Offline
                      dbemowsk
                      wrote on last edited by
                      #113

                      OK, so here is my easy newbie board layout showing pin connections and header plug identifications. I am still working on the code a bit. I still need to work in the wind speed and wind gust code and figure out the calculations for that. I am nearing the point of full sensor testing. I will then need to figure out my power situation.
                      0_1500169191817_upload-6df2b074-decd-4232-958c-973fb97d1173

                      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                      1 Reply Last reply
                      1
                      • dbemowskD Offline
                        dbemowskD Offline
                        dbemowsk
                        wrote on last edited by
                        #114

                        Here are some of the final pics of the wind sensor assembly. The first one shows the circuit board mounting assembly. I have a small channel on the top and bottom sides of the mounting plate to hold rubber O-ring seals to keep water out. The seals can be seen to the left of the image.
                        0_1500170436823_upload-15dd3888-b1c6-4e4b-8b03-32a0533eec63

                        Next is just a wide angle shot of all the parts. The connector for the anemometer reed switch feeds through the hole next to the wire harness board and plugs into a header on that board.
                        0_1500170696031_upload-bca62065-4537-4f33-a19e-cb472587f0ef

                        The last pic is the fully assembled unit with the wire harness attached. I added a shot of the O-rings sandwiched between the layers to keep water out.
                        0_1500171521761_upload-fd7d3c7c-9ac7-4a13-8a91-d6423d083117

                        Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                        Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                        mfalkviddM 1 Reply Last reply
                        2
                        • dbemowskD dbemowsk

                          Here are some of the final pics of the wind sensor assembly. The first one shows the circuit board mounting assembly. I have a small channel on the top and bottom sides of the mounting plate to hold rubber O-ring seals to keep water out. The seals can be seen to the left of the image.
                          0_1500170436823_upload-15dd3888-b1c6-4e4b-8b03-32a0533eec63

                          Next is just a wide angle shot of all the parts. The connector for the anemometer reed switch feeds through the hole next to the wire harness board and plugs into a header on that board.
                          0_1500170696031_upload-bca62065-4537-4f33-a19e-cb472587f0ef

                          The last pic is the fully assembled unit with the wire harness attached. I added a shot of the O-rings sandwiched between the layers to keep water out.
                          0_1500171521761_upload-fd7d3c7c-9ac7-4a13-8a91-d6423d083117

                          mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #115

                          @dbemowsk great work, thanks for sharing!

                          My 3D printer does not create watertight prints. Water seems to be able to slowly pass through the walls. Hopefully your printer is better, but it might be something to look out for.

                          dbemowskD 1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            @dbemowsk great work, thanks for sharing!

                            My 3D printer does not create watertight prints. Water seems to be able to slowly pass through the walls. Hopefully your printer is better, but it might be something to look out for.

                            dbemowskD Offline
                            dbemowskD Offline
                            dbemowsk
                            wrote on last edited by
                            #116

                            @mfalkvidd The walls of the upper and lower case are pretty thick. I used 100% infill which was probably a bit overboard, but I didn't want any water in it. That is why I also put the rubber O-rings in the middle. With the sides compressing that rubber it gives it a pretty good seal. I was originally going to make gaskets. but I found the O-rings to be a better fit.

                            Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                            Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                            1 Reply Last reply
                            1
                            • dbemowskD Offline
                              dbemowskD Offline
                              dbemowsk
                              wrote on last edited by
                              #117

                              So for those that have wind sensors on your setups, what are you using for your V_GUST value that you send back to the controller?

                              Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                              Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                              YveauxY 1 Reply Last reply
                              0
                              • dbemowskD dbemowsk

                                So for those that have wind sensors on your setups, what are you using for your V_GUST value that you send back to the controller?

                                YveauxY Offline
                                YveauxY Offline
                                Yveaux
                                Mod
                                wrote on last edited by
                                #118

                                @dbemowsk said in MySensors weather station:

                                what are you using for your V_GUST value that you send back to the controller?

                                I send a new value every minute. The sensor measures continuously and the wind speed reported is the average speed over this minute. Gust is simply the maximum speed in a minute.

                                http://yveaux.blogspot.nl

                                1 Reply Last reply
                                0
                                • wallyllamaW Offline
                                  wallyllamaW Offline
                                  wallyllama
                                  wrote on last edited by
                                  #119

                                  This is the official (US)National Weather Service definition of wind gust. It looks like they dont report gusts until wind speed is above a certain amount. I like to overcomplicate things, so I would report the average, max in a minute (like Yveaux), and a standard deviation(just to be fancy)

                                  https://graphical.weather.gov/definitions/defineWindGust.html

                                  1 Reply Last reply
                                  0
                                  • dbemowskD Offline
                                    dbemowskD Offline
                                    dbemowsk
                                    wrote on last edited by
                                    #120

                                    Thanks to you both, just what I needed.

                                    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                    1 Reply Last reply
                                    0
                                    • dbemowskD Offline
                                      dbemowskD Offline
                                      dbemowsk
                                      wrote on last edited by
                                      #121

                                      How often do people transmit their wind speed to the controller.

                                      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                      1 Reply Last reply
                                      0
                                      • tombstoneT Offline
                                        tombstoneT Offline
                                        tombstone
                                        wrote on last edited by
                                        #122

                                        really looking good :+1:

                                        dbemowskD 1 Reply Last reply
                                        0
                                        • tombstoneT tombstone

                                          really looking good :+1:

                                          dbemowskD Offline
                                          dbemowskD Offline
                                          dbemowsk
                                          wrote on last edited by
                                          #123

                                          @tombstone thanks.

                                          Trying to run some tests today. I think I have some workable code, but I don't have any sleep figured in yet. With all of the sensors being run from one pro mini, there is a lot going on and I will need to figure sleep in carefully if I even do. I have temp, humidity, rain, wind direction and wind speed. Arduino IDE says that it takes 75% of the program memory and that is not with debugging on. If I turn that on I start to get warnings, but it will compile and run.

                                          Getting even closer to being able to mount this on my roof.

                                          Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                                          Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          11

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular