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. Troubleshooting
  3. Problem with Wind Speed sensor

Problem with Wind Speed sensor

Scheduled Pinned Locked Moved Troubleshooting
53 Posts 6 Posters 14.7k Views 7 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.
  • AWIA AWI

    @rnollen the "inf" means infinite and is caused by a 0 division. You can try to remove the line starting with 'float' and print the time values.
    I assume you changed the anemometer pin in the sketch to d7...?
    And connected the gnd of 12v and 5v together?

    rnollenR Offline
    rnollenR Offline
    rnollen
    wrote on last edited by
    #24

    @AWI said:

    @rnollen the "inf" means infinite and is caused by a 0 division. You can try to remove the line starting with 'float' and print the time values.
    I assume you changed the anemometer pin in the sketch to d7...?

    I have did some additional testing. The DC12 is wrong I think, when I use that then the whole sketch does not give any values back. Now used the 5V of the arduino, then I got something readings using this sketch. I have added some additional serial print lines for logging. But when times are zero, then the frequency is INF and that happens when I don't rotate, so that looks OK I think
    ..
    Timeon: 0
    Timeoff: 0
    TimePeriod: 0
    Frequency: inf
    Timeon: 0
    Timeoff: 87951
    TimePeriod: 87951
    Frequency: 11.37
    Timeon: 24222
    Timeoff: 22899
    TimePeriod: 47121
    Frequency: 21.22
    Timeon: 24960
    Timeoff: 27680
    TimePeriod: 52640
    Frequency: 19.00
    Timeon: 27545
    Timeoff: 28273
    TimePeriod: 55818
    Frequency: 17.92
    Timeon: 63310
    Timeoff: 0
    TimePeriod: 63310
    Frequency: 15.80

    The serial.print lines:
    Serial.print("Timeon: ");
    Serial.println(timeon);
    Serial.print("Timeoff: ");
    Serial.println(timeoff);
    Serial.print("TimePeriod: ");
    Serial.println(timePeriod);
    Serial.print("Frequency: ");
    Serial.println(frequency);

    But any idea, because I am still lost don't know exactly what the conclusion of this is :)

    AWIA 2 Replies Last reply
    0
    • rnollenR rnollen

      @AWI said:

      @rnollen the "inf" means infinite and is caused by a 0 division. You can try to remove the line starting with 'float' and print the time values.
      I assume you changed the anemometer pin in the sketch to d7...?

      I have did some additional testing. The DC12 is wrong I think, when I use that then the whole sketch does not give any values back. Now used the 5V of the arduino, then I got something readings using this sketch. I have added some additional serial print lines for logging. But when times are zero, then the frequency is INF and that happens when I don't rotate, so that looks OK I think
      ..
      Timeon: 0
      Timeoff: 0
      TimePeriod: 0
      Frequency: inf
      Timeon: 0
      Timeoff: 87951
      TimePeriod: 87951
      Frequency: 11.37
      Timeon: 24222
      Timeoff: 22899
      TimePeriod: 47121
      Frequency: 21.22
      Timeon: 24960
      Timeoff: 27680
      TimePeriod: 52640
      Frequency: 19.00
      Timeon: 27545
      Timeoff: 28273
      TimePeriod: 55818
      Frequency: 17.92
      Timeon: 63310
      Timeoff: 0
      TimePeriod: 63310
      Frequency: 15.80

      The serial.print lines:
      Serial.print("Timeon: ");
      Serial.println(timeon);
      Serial.print("Timeoff: ");
      Serial.println(timeoff);
      Serial.print("TimePeriod: ");
      Serial.println(timePeriod);
      Serial.print("Frequency: ");
      Serial.println(frequency);

      But any idea, because I am still lost don't know exactly what the conclusion of this is :)

      AWIA Offline
      AWIA Offline
      AWI
      Hero Member
      wrote on last edited by
      #25

      @rnollen this looks much better. You get frequencies in the 10 to 20 range when rotating. The inf when you're not rotating are caused by timer overflow so nothing wrong there.
      Now it is time for a more dedicated measurement. Basically replace the standard arduino routines with your own version. It is middle of the night here so I have to leave it for tomorrow...

      1 Reply Last reply
      0
      • rnollenR rnollen

        @AWI said:

        @rnollen the "inf" means infinite and is caused by a 0 division. You can try to remove the line starting with 'float' and print the time values.
        I assume you changed the anemometer pin in the sketch to d7...?

        I have did some additional testing. The DC12 is wrong I think, when I use that then the whole sketch does not give any values back. Now used the 5V of the arduino, then I got something readings using this sketch. I have added some additional serial print lines for logging. But when times are zero, then the frequency is INF and that happens when I don't rotate, so that looks OK I think
        ..
        Timeon: 0
        Timeoff: 0
        TimePeriod: 0
        Frequency: inf
        Timeon: 0
        Timeoff: 87951
        TimePeriod: 87951
        Frequency: 11.37
        Timeon: 24222
        Timeoff: 22899
        TimePeriod: 47121
        Frequency: 21.22
        Timeon: 24960
        Timeoff: 27680
        TimePeriod: 52640
        Frequency: 19.00
        Timeon: 27545
        Timeoff: 28273
        TimePeriod: 55818
        Frequency: 17.92
        Timeon: 63310
        Timeoff: 0
        TimePeriod: 63310
        Frequency: 15.80

        The serial.print lines:
        Serial.print("Timeon: ");
        Serial.println(timeon);
        Serial.print("Timeoff: ");
        Serial.println(timeoff);
        Serial.print("TimePeriod: ");
        Serial.println(timePeriod);
        Serial.print("Frequency: ");
        Serial.println(frequency);

        But any idea, because I am still lost don't know exactly what the conclusion of this is :)

        AWIA Offline
        AWIA Offline
        AWI
        Hero Member
        wrote on last edited by
        #26

        @rnollen time for "Take 2" I created it in Codebender to make sure it compiles. Could not test functionality yet.

        The "take 2" code implements a non-blocking measurement of the frequency of the anemometer (pulses per second). It should be safe for overflow.
        Take 3 could be to translate it to m/s windspeed according to your type of anemometer and finally:
        Take 4 MySensors' ise it!!

        https://codebender.cc/sketch:347690

        1 Reply Last reply
        1
        • rnollenR Offline
          rnollenR Offline
          rnollen
          wrote on last edited by rnollen
          #27

          @AWI Hmm.. I see this:
          1000.00
          1000.00
          1000.00
          1000.00
          1000.00
          1000.00
          1000.00
          1000.00
          1000.00
          500.00
          1000.00
          0.00
          inf
          1000.00
          0.00
          0.00

          Don't think that this is correct right? Am I doing something wrong, or does these numbers say anything to you :)

          AWIA 1 Reply Last reply
          0
          • rnollenR rnollen

            @AWI Hmm.. I see this:
            1000.00
            1000.00
            1000.00
            1000.00
            1000.00
            1000.00
            1000.00
            1000.00
            1000.00
            500.00
            1000.00
            0.00
            inf
            1000.00
            0.00
            0.00

            Don't think that this is correct right? Am I doing something wrong, or does these numbers say anything to you :)

            AWIA Offline
            AWIA Offline
            AWI
            Hero Member
            wrote on last edited by AWI
            #28

            @rnollen was a short night... :sweat:

            Forgot the return lastFrequencyI changed the sketch in last post. No guarantee that it works, don't have the hardware.

            1 Reply Last reply
            0
            • rnollenR Offline
              rnollenR Offline
              rnollen
              wrote on last edited by
              #29

              @AWI Sorry for the late reply, I got the flu :( But did test the sketch, but I got the same results basically.. Mostly 1000, inf and sometimes a 500? So what can be wrong here?

              Thanks for all you're efforts so far!! Really appreciate it :)

              AWIA 1 Reply Last reply
              0
              • rnollenR rnollen

                @AWI Sorry for the late reply, I got the flu :( But did test the sketch, but I got the same results basically.. Mostly 1000, inf and sometimes a 500? So what can be wrong here?

                Thanks for all you're efforts so far!! Really appreciate it :)

                AWIA Offline
                AWIA Offline
                AWI
                Hero Member
                wrote on last edited by AWI
                #30

                @rnollen No problem, I hope you recovered well. Haven't looked at the sketch until now and discovered that I must have been suffering from something too... I added a missing line but still can't test it. Please give it a try..

                1 Reply Last reply
                0
                • rnollenR Offline
                  rnollenR Offline
                  rnollen
                  wrote on last edited by
                  #31

                  @AWI I am still ill, while doing this :) Hopefully tomorrow will be better, Hahaha.. :)
                  But, the results looks promising and OK I guess :)
                  8.13
                  10.87
                  14.08
                  20.00
                  27.78
                  23.81
                  25.64
                  10.75
                  0.00
                  1.81
                  12.66
                  11.49
                  10.75
                  10.00
                  9.35
                  8.85
                  8.33
                  7.87

                  It's 0 when I am not turning it around, so that is OK. Low number, when rotating it slowly. High number when rotating it fast :)

                  AWIA 1 Reply Last reply
                  0
                  • rnollenR rnollen

                    @AWI I am still ill, while doing this :) Hopefully tomorrow will be better, Hahaha.. :)
                    But, the results looks promising and OK I guess :)
                    8.13
                    10.87
                    14.08
                    20.00
                    27.78
                    23.81
                    25.64
                    10.75
                    0.00
                    1.81
                    12.66
                    11.49
                    10.75
                    10.00
                    9.35
                    8.85
                    8.33
                    7.87

                    It's 0 when I am not turning it around, so that is OK. Low number, when rotating it slowly. High number when rotating it fast :)

                    AWIA Offline
                    AWIA Offline
                    AWI
                    Hero Member
                    wrote on last edited by
                    #32

                    @rnollen take care.. This is how it should be (with the anemometer) I will post the MySensors version tomorrow (need some sleep now)

                    rnollenR 1 Reply Last reply
                    0
                    • AWIA AWI

                      @rnollen take care.. This is how it should be (with the anemometer) I will post the MySensors version tomorrow (need some sleep now)

                      rnollenR Offline
                      rnollenR Offline
                      rnollen
                      wrote on last edited by rnollen
                      #33

                      @AWI said:
                      @rnollen take care.. This is how it should be (with the anemometer) I will post the MySensors version tomorrow (need some sleep now)

                      @AWI ..Awesome ☺ Thanks so far ☺

                      AWIA 1 Reply Last reply
                      0
                      • rnollenR rnollen

                        @AWI said:
                        @rnollen take care.. This is how it should be (with the anemometer) I will post the MySensors version tomorrow (need some sleep now)

                        @AWI ..Awesome ☺ Thanks so far ☺

                        AWIA Offline
                        AWIA Offline
                        AWI
                        Hero Member
                        wrote on last edited by AWI
                        #34

                        @rnollen I made the sketch but forgot to post it... Have a look here

                        https://codebender.cc/sketch:347770

                        I does not compile in codebender.cc yet because of v2 MySensor but it should in the IDE.

                        Have fun and let me know the results

                        TheoLT 1 Reply Last reply
                        2
                        • AWIA AWI

                          @rnollen I made the sketch but forgot to post it... Have a look here

                          https://codebender.cc/sketch:347770

                          I does not compile in codebender.cc yet because of v2 MySensor but it should in the IDE.

                          Have fun and let me know the results

                          TheoLT Offline
                          TheoLT Offline
                          TheoL
                          Contest Winner
                          wrote on last edited by
                          #35

                          @AWI Great job. I'm planning to make my own anemometer, just because it's fun to do. And was already thinking about the problems that might occur. Hardware wise it's easy. Just use a hall sensor to detect pulses and a rotating magnet.

                          When the diameter of the magnet will be around 9cm, the magnet will reach the Hall sensor within 3ms or less if there's a Hurricane. That can be a problem because the sensor might think that the magnet isn't moving.

                          Because of that I was thinking about counting the pulses in a interrupt handler (pin 2 or 3) . And just let the loop periodically read the values and send them to the gateway if necessary.

                          Now comes my question for you. I was thinking of using some kind of decade counter IC. And let the IC handle the pulse counting. That way I only have to read and reset the counter IC. Do you happen to know a good counter IC that I can connect to the Arduino? It would make the project much easier.

                          AWIA 1 Reply Last reply
                          0
                          • TheoLT TheoL

                            @AWI Great job. I'm planning to make my own anemometer, just because it's fun to do. And was already thinking about the problems that might occur. Hardware wise it's easy. Just use a hall sensor to detect pulses and a rotating magnet.

                            When the diameter of the magnet will be around 9cm, the magnet will reach the Hall sensor within 3ms or less if there's a Hurricane. That can be a problem because the sensor might think that the magnet isn't moving.

                            Because of that I was thinking about counting the pulses in a interrupt handler (pin 2 or 3) . And just let the loop periodically read the values and send them to the gateway if necessary.

                            Now comes my question for you. I was thinking of using some kind of decade counter IC. And let the IC handle the pulse counting. That way I only have to read and reset the counter IC. Do you happen to know a good counter IC that I can connect to the Arduino? It would make the project much easier.

                            AWIA Offline
                            AWIA Offline
                            AWI
                            Hero Member
                            wrote on last edited by
                            #36

                            @TheoL I have to dig in my ancient history to find hardware for that purpose. An interrupt routine would be much easier and fast enough. (would be take 4 of this thread :smile:)

                            TheoLT 1 Reply Last reply
                            0
                            • AWIA AWI

                              @TheoL I have to dig in my ancient history to find hardware for that purpose. An interrupt routine would be much easier and fast enough. (would be take 4 of this thread :smile:)

                              TheoLT Offline
                              TheoLT Offline
                              TheoL
                              Contest Winner
                              wrote on last edited by
                              #37

                              @AWI I know it's ancient stuff ;-) But very reliable. Maybe something like this? THE 4017B DECADE COUNTER But I don't know I it could handle the speed?

                              I'm also thinking about replacing the hall sensor with an infrared pulse sensor. It has a shorter on time than a magnet with a hall sensor. At least that's what I'm thinking ;-)

                              AWIA 1 Reply Last reply
                              0
                              • rnollenR Offline
                                rnollenR Offline
                                rnollen
                                wrote on last edited by rnollen
                                #38

                                @AWI Thanks for the sketch, but I still run in some issues. When i download the sketch, I got an error with the line "#include <MySensor.h> ". The strange thing is, everything seems to be OK, but it say it cannot be found. When I copy/paste the lines from a different sketch, it does work correct?? The strange thing is, I don't see difference. Maybe something wrong with a font or some sort?

                                But, then the issues really start. All the Mysensors stuff, is not recognized (e.g.send). I was able to fix that, copying from other sketches and add gw. before everything. In the serial monitor it then looks OK. That seems for me to solve the issues on that side.

                                But finally, in domoticz, it does not work then :( Everything is looking perfect, I see the sensors appear, but no new device is added). I saw a topic on the domoticz forum where the same thing happened :) and where you also replyed in: https://www.domoticz.com/forum/viewtopic.php?f=42&t=11490&p=82522&hilit=wind#p82522

                                Tried some various stuff, but no result sofar

                                Any idea?

                                AWIA 2 Replies Last reply
                                0
                                • rnollenR rnollen

                                  @AWI Thanks for the sketch, but I still run in some issues. When i download the sketch, I got an error with the line "#include <MySensor.h> ". The strange thing is, everything seems to be OK, but it say it cannot be found. When I copy/paste the lines from a different sketch, it does work correct?? The strange thing is, I don't see difference. Maybe something wrong with a font or some sort?

                                  But, then the issues really start. All the Mysensors stuff, is not recognized (e.g.send). I was able to fix that, copying from other sketches and add gw. before everything. In the serial monitor it then looks OK. That seems for me to solve the issues on that side.

                                  But finally, in domoticz, it does not work then :( Everything is looking perfect, I see the sensors appear, but no new device is added). I saw a topic on the domoticz forum where the same thing happened :) and where you also replyed in: https://www.domoticz.com/forum/viewtopic.php?f=42&t=11490&p=82522&hilit=wind#p82522

                                  Tried some various stuff, but no result sofar

                                  Any idea?

                                  AWIA Offline
                                  AWIA Offline
                                  AWI
                                  Hero Member
                                  wrote on last edited by
                                  #39

                                  @rnollen it seems you are running into the changes related to the new development syntax. I wrote the sketch with the development version.. There are many threads on the forum discussing that so I won't repeat it here.

                                  The sensor not appearing I remember from another wind sensor discussion. Domoticz builds it when a few wind types are present. You can add a wind direction dummy (presentation is already in the sketch, commented) and send a "0" degrees value.

                                  1 Reply Last reply
                                  0
                                  • TheoLT TheoL

                                    @AWI I know it's ancient stuff ;-) But very reliable. Maybe something like this? THE 4017B DECADE COUNTER But I don't know I it could handle the speed?

                                    I'm also thinking about replacing the hall sensor with an infrared pulse sensor. It has a shorter on time than a magnet with a hall sensor. At least that's what I'm thinking ;-)

                                    AWIA Offline
                                    AWIA Offline
                                    AWI
                                    Hero Member
                                    wrote on last edited by
                                    #40

                                    @TheoL speed will not be an issue with these components if we are talking milliseconds. The atmega328p also has no problems there. So no need for additional hardware. But for the diehards a shift register can act as a modulo 2^ divider.

                                    TheoLT 1 Reply Last reply
                                    0
                                    • AWIA AWI

                                      @TheoL speed will not be an issue with these components if we are talking milliseconds. The atmega328p also has no problems there. So no need for additional hardware. But for the diehards a shift register can act as a modulo 2^ divider.

                                      TheoLT Offline
                                      TheoLT Offline
                                      TheoL
                                      Contest Winner
                                      wrote on last edited by
                                      #41

                                      @AWI It's something I have to postpone till winter time ;-) But I'll keep it in mind. I never told about the buck converter you've send to me. Works like a charm much better than the power regulators I was using. Thank you for that. When things will start to settle down, I'll do a repost on my gesture controlled lamp. I've received some cheap gesture sensors so I'll be updating that part is well. Then it I'll be a very cheap project.

                                      1 Reply Last reply
                                      0
                                      • rnollenR rnollen

                                        @AWI Thanks for the sketch, but I still run in some issues. When i download the sketch, I got an error with the line "#include <MySensor.h> ". The strange thing is, everything seems to be OK, but it say it cannot be found. When I copy/paste the lines from a different sketch, it does work correct?? The strange thing is, I don't see difference. Maybe something wrong with a font or some sort?

                                        But, then the issues really start. All the Mysensors stuff, is not recognized (e.g.send). I was able to fix that, copying from other sketches and add gw. before everything. In the serial monitor it then looks OK. That seems for me to solve the issues on that side.

                                        But finally, in domoticz, it does not work then :( Everything is looking perfect, I see the sensors appear, but no new device is added). I saw a topic on the domoticz forum where the same thing happened :) and where you also replyed in: https://www.domoticz.com/forum/viewtopic.php?f=42&t=11490&p=82522&hilit=wind#p82522

                                        Tried some various stuff, but no result sofar

                                        Any idea?

                                        AWIA Offline
                                        AWIA Offline
                                        AWI
                                        Hero Member
                                        wrote on last edited by
                                        #42

                                        @rnollen I updated the sketch for you with a dummy value of "0 degrees" windirection to keep Domoticz happy. (MySensors 2.0)
                                        https://codebender.cc/sketch:347770

                                        1 Reply Last reply
                                        0
                                        • rnollenR Offline
                                          rnollenR Offline
                                          rnollen
                                          wrote on last edited by rnollen
                                          #43

                                          @AWI Thanks! The sketch works. But, I am not quite sure if the readings in m/s are correct. As a test, I have used a normal table fan, then I got 3.3 m/s on full speed..
                                          Then I used a hairdryer, that on full speed.. It spins then very very fast, but it is still only 11 m/s. This is classified as normal, somewhat powerfull wind? Looks to me it's pretty low? Or could this correct for this case? :)'

                                          Edit-> Maybe it is correct :) Saw somewhere on internet a test with somewhat smaller hairdryer, which gave 9.5 m/s :)
                                          Unfortunately I don't have any experience with windmeters :) Don't know how hard it should spin and how to test the output :)

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


                                          10

                                          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