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

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

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

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

    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/

    sundberg84S 1 Reply Last reply
    0
    • dbemowskD dbemowsk

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

      sundberg84S Offline
      sundberg84S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by sundberg84
      #80

      @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 :)

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      dbemowskD 1 Reply Last reply
      0
      • sundberg84S sundberg84

        @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 :)

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

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

        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
        • gohanG Offline
          gohanG Offline
          gohan
          Mod
          wrote on last edited by
          #82

          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

          dbemowskD 1 Reply Last reply
          0
          • gohanG gohan

            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

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

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

            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
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #84

              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

              dbemowskD 1 Reply Last reply
              0
              • gohanG gohan

                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

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

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

                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/

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

                  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

                  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
                  4
                  • dbemowskD dbemowsk

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

                    gohanG Offline
                    gohanG Offline
                    gohan
                    Mod
                    wrote on last edited by
                    #87

                    @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

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

                      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.

                      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
                        #89

                        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.

                        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/

                        Nca78N 1 Reply Last reply
                        0
                        • dbemowskD dbemowsk

                          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.

                          Nca78N Offline
                          Nca78N Offline
                          Nca78
                          Hardware Contributor
                          wrote on last edited by
                          #90

                          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

                          dbemowskD 2 Replies Last reply
                          0
                          • Nca78N Nca78

                            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

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

                            @Nca78 Thanks, exactly what I wanted to know.

                            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
                            • Nca78N Nca78

                              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

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

                              @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?

                              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/

                              Nca78N 1 Reply Last reply
                              0
                              • dbemowskD dbemowsk

                                @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?

                                Nca78N Offline
                                Nca78N Offline
                                Nca78
                                Hardware Contributor
                                wrote on last edited by
                                #93

                                @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 ;)

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

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

                                  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
                                  • gohanG Offline
                                    gohanG Offline
                                    gohan
                                    Mod
                                    wrote on last edited by gohan
                                    #95

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

                                    dbemowskD 1 Reply Last reply
                                    0
                                    • gohanG gohan

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

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

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

                                      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
                                        #97

                                        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.

                                        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
                                        • gohanG Offline
                                          gohanG Offline
                                          gohan
                                          Mod
                                          wrote on last edited by
                                          #98

                                          Doesn't it have a library?

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


                                          13

                                          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