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

    Hi,

    I recently bought a Windspeed sensor on Ebay: http://www.ebay.com/itm/181741789708?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT This to use it later in domoticz.

    Now, I found some sketches on MySensors which can be used on a Windsensor and domoticz, but I have hard time figure out how to what the data is that I am seeing. I attached the windsensor to a 12V powersupply and the data line of the wind speed sensor is connected to analog pin 1. Now, as a test I only read out the analog A1 line with this code:

    nomod_wspeed = (analogRead(WIND_SENSOR_ANALOG_PIN));

    When I do a Serial.print, I get these numbers below. Now what the strange thing is, I do not rotate my wind speed sensor? So I cannot understand what the data is that I am seeing here?? I would expect that everything is zero when I don't rotate it? In example on this forum, I saw that the sketches will do something with this value, but what then?

    NoMod_WS: 0
    NoMod_WS: 912
    NoMod_WS: 0
    NoMod_WS: 254
    NoMod_WS: 954
    NoMod_WS: 117
    NoMod_WS: 775
    NoMod_WS: 165
    NoMod_WS: 799
    NoMod_WS: 0
    NoMod_WS: 1023
    NoMod_WS: 0
    NoMod_WS: 1023
    NoMod_WS: 10
    NoMod_WS: 1023
    NoMod_WS: 0
    NoMod_WS: 997
    NoMod_WS: 0
    NoMod_WS: 979
    NoMod_WS: 178
    NoMod_WS: 1015
    NoMod_WS: 239
    NoMod_WS: 0
    NoMod_WS: 809
    NoMod_WS: 0
    NoMod_WS: 1023
    NoMod_WS: 0
    NoMod_WS: 1023
    NoMod_WS: 712
    NoMod_WS: 209

    Can someone help ? Is my device well attached or am I doing something wrong here?

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

    @rnollen It is advertised as a pulse sensor. This means you will get one or more digital pulses (e.g. low level is 0V, a pulse is represented by a 5V level for some time).
    I'm a bit worried by the 12V supply signal to the sensor. It doesn't say what signal level the generated pulses are.
    Your arduino is likely powered by 5V or even 3.3V (depending on the model) and 12V is definately too much for the analog and digital inputs; you might have broken it.
    Another option is that the pulse signal is so called open-collector, which means it will only pull the signal to 0V, and you have to supply the high-level of your choice.
    I would suggest to browse the internet or ask the supplier on some more info on this sensor, or even an example on how to connect it to an Arduino.
    Good luck!

    http://yveaux.blogspot.nl

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

      Thanks for you're reply. On the ebay website at the product description, it is said: "Supply voltage: DC 12-24 V", so therefore I thought I needed a 12V powersupply to power this device

      I use a nano board, so I can attach a 5V to it, I will give this a try. I still need to find out first if it is broken basically :) But a few things that worries me regarding this setup:

      • The picture on the ebay site shows 4 cables coming out of the device. I only see three :) Regarding the other sketches, this seems to be OK, because A1 is only attached.. but I am not sure
      • When I run the sketch and I just read out the Analog pin 1, I always get data. The device doesn't needs to be attached basically. So I really don't get how the Analog 1 pin should work and why I get data when nothing is attached? I used the sketch of this topic: https://forum.mysensors.org/topic/2856/wind-speed-sensor-node/21 using the last reply. Only I deleted the direction and gust values, because I can only measure speed I think.

      Can you give me a heads up? How should you think I need to connect it? And how I must adjust the sketch in order to get the data?

      AWIA YveauxY 2 Replies Last reply
      0
      • rnollenR rnollen

        Thanks for you're reply. On the ebay website at the product description, it is said: "Supply voltage: DC 12-24 V", so therefore I thought I needed a 12V powersupply to power this device

        I use a nano board, so I can attach a 5V to it, I will give this a try. I still need to find out first if it is broken basically :) But a few things that worries me regarding this setup:

        • The picture on the ebay site shows 4 cables coming out of the device. I only see three :) Regarding the other sketches, this seems to be OK, because A1 is only attached.. but I am not sure
        • When I run the sketch and I just read out the Analog pin 1, I always get data. The device doesn't needs to be attached basically. So I really don't get how the Analog 1 pin should work and why I get data when nothing is attached? I used the sketch of this topic: https://forum.mysensors.org/topic/2856/wind-speed-sensor-node/21 using the last reply. Only I deleted the direction and gust values, because I can only measure speed I think.

        Can you give me a heads up? How should you think I need to connect it? And how I must adjust the sketch in order to get the data?

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

        @rnollen Your values could be from a floating input. So like @Yveaux suggested the wind sensor can have an open collector output. Best to try with a multimeter first. You can connect a 10 - 100k resistor from the output to Vcc and see if you get a pulse output when rotating.

        rnollenR 1 Reply Last reply
        0
        • rnollenR rnollen

          Thanks for you're reply. On the ebay website at the product description, it is said: "Supply voltage: DC 12-24 V", so therefore I thought I needed a 12V powersupply to power this device

          I use a nano board, so I can attach a 5V to it, I will give this a try. I still need to find out first if it is broken basically :) But a few things that worries me regarding this setup:

          • The picture on the ebay site shows 4 cables coming out of the device. I only see three :) Regarding the other sketches, this seems to be OK, because A1 is only attached.. but I am not sure
          • When I run the sketch and I just read out the Analog pin 1, I always get data. The device doesn't needs to be attached basically. So I really don't get how the Analog 1 pin should work and why I get data when nothing is attached? I used the sketch of this topic: https://forum.mysensors.org/topic/2856/wind-speed-sensor-node/21 using the last reply. Only I deleted the direction and gust values, because I can only measure speed I think.

          Can you give me a heads up? How should you think I need to connect it? And how I must adjust the sketch in order to get the data?

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

          @rnollen no, without more info it's just guessing and that won't help you at all.
          One thing I am quite sure about is that it doesn't have an analog output and therefore you should not try to read it with an analog input.

          http://yveaux.blogspot.nl

          1 Reply Last reply
          0
          • AWIA AWI

            @rnollen Your values could be from a floating input. So like @Yveaux suggested the wind sensor can have an open collector output. Best to try with a multimeter first. You can connect a 10 - 100k resistor from the output to Vcc and see if you get a pulse output when rotating.

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

            @AWI said:

            @rnollen Your values could be from a floating input. So like @Yveaux suggested the wind sensor can have an open collector output. Best to try with a multimeter first. You can connect a 10 - 100k resistor from the output to Vcc and see if you get a pulse output when rotating.

            @all thanks for all the replies. I did send an e-mail to that ebay supplier. :)

            @AWI: I have a 100 ohm resistor. Connect this to my breadboard, but don't know how to connect this then to an arduino? The windmeter has three cables: black / red and yellow. The yellow line is the data line and black/red are power and ground? I have a multimeter, but not sure how to use it for this purpose :)

            AWIA 1 Reply Last reply
            0
            • rnollenR rnollen

              @AWI said:

              @rnollen Your values could be from a floating input. So like @Yveaux suggested the wind sensor can have an open collector output. Best to try with a multimeter first. You can connect a 10 - 100k resistor from the output to Vcc and see if you get a pulse output when rotating.

              @all thanks for all the replies. I did send an e-mail to that ebay supplier. :)

              @AWI: I have a 100 ohm resistor. Connect this to my breadboard, but don't know how to connect this then to an arduino? The windmeter has three cables: black / red and yellow. The yellow line is the data line and black/red are power and ground? I have a multimeter, but not sure how to use it for this purpose :)

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

              @rnollen I think you can just assume that red =positive, black = gnd and yellow = signal.
              You should connect the resistor between yellow and red if you assume an open collector output. Then power the sensor on black and red.Connect your multimeter (in volt position)(just noticed you have one) to yellow and ground and rotate the sensor slowly. A 100 ohm resistor will do for testing.

              rnollenR 1 Reply Last reply
              0
              • AWIA AWI

                @rnollen I think you can just assume that red =positive, black = gnd and yellow = signal.
                You should connect the resistor between yellow and red if you assume an open collector output. Then power the sensor on black and red.Connect your multimeter (in volt position)(just noticed you have one) to yellow and ground and rotate the sensor slowly. A 100 ohm resistor will do for testing.

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

                @AWI said:

                @rnollen I think you can just assume that red =positive, black = gnd and yellow = signal.
                You should connect the resistor between yellow and red if you assume an open collector output. Then power the sensor on black and red.Connect your multimeter (in volt position)(just noticed you have one) to yellow and ground and rotate the sensor slowly. A 100 ohm resistor will do for testing.

                Thanks. I did a quick test. Grabbed my multimeter and set it on the 20v. (2v gives me an error). Connected it like you have said, using the resistor. Used the ground and 5v of my Arduino nano as power.
                When I do not rotate; I get 4.54V on the yellow and black line. When I start rotating, it is less.. mostly around 3. But it jumps around, but always less then the 4.6 when I start to rotate. I cannot say that rotating faster gives me another or different value, I think it will go to the 3.

                So any idea :)

                AWIA 1 Reply Last reply
                0
                • rnollenR rnollen

                  @AWI said:

                  @rnollen I think you can just assume that red =positive, black = gnd and yellow = signal.
                  You should connect the resistor between yellow and red if you assume an open collector output. Then power the sensor on black and red.Connect your multimeter (in volt position)(just noticed you have one) to yellow and ground and rotate the sensor slowly. A 100 ohm resistor will do for testing.

                  Thanks. I did a quick test. Grabbed my multimeter and set it on the 20v. (2v gives me an error). Connected it like you have said, using the resistor. Used the ground and 5v of my Arduino nano as power.
                  When I do not rotate; I get 4.54V on the yellow and black line. When I start rotating, it is less.. mostly around 3. But it jumps around, but always less then the 4.6 when I start to rotate. I cannot say that rotating faster gives me another or different value, I think it will go to the 3.

                  So any idea :)

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

                  @rnollen can you get it to a stable less than 3v when rotating.? If you can not get it stable than I there is a chance a serial protocol like "onewire" is used. Then you need a clue from the supplier. If you have stable outputs when rotating very slowly it is probably a pulse train which you can count.

                  rnollenR 1 Reply Last reply
                  0
                  • AWIA AWI

                    @rnollen can you get it to a stable less than 3v when rotating.? If you can not get it stable than I there is a chance a serial protocol like "onewire" is used. Then you need a clue from the supplier. If you have stable outputs when rotating very slowly it is probably a pulse train which you can count.

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

                    @AWI said:

                    @rnollen can you get it to a stable less than 3v when rotating.? If you can not get it stable than I there is a chance a serial protocol like "onewire" is used. Then you need a clue from the supplier. If you have stable outputs when rotating very slowly it is probably a pulse train which you can count.

                    Yes, It is stable when you rotate it. Around the 3V. But how can I count it then?

                    AWIA 1 Reply Last reply
                    0
                    • rnollenR rnollen

                      @AWI said:

                      @rnollen can you get it to a stable less than 3v when rotating.? If you can not get it stable than I there is a chance a serial protocol like "onewire" is used. Then you need a clue from the supplier. If you have stable outputs when rotating very slowly it is probably a pulse train which you can count.

                      Yes, It is stable when you rotate it. Around the 3V. But how can I count it then?

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

                      @rnollen I would expect a low high signal transition when you rotate slowly.
                      0_1468496891675_upload-6bd65600-8754-4568-9dff-120fd20da85c
                      If that is not the case it is hard to determine from here what kind of signal you get.. (is assume you don't have access to an oscilloscope.. ;-)

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

                        Thanks; but how to go further from here then :) Is there a way to create a sketch for this device? And how to attach it to a Nano board?

                        I got a manual from the supplier: https://1drv.ms/w/s!AmsPyx0xoB6jjYo0PZZRazdA3-vPpw for this device. But I already see a difference with the wires :) But to give it a start then, according to the manual it counts the pulses and that gives a windspeed :)

                        AWIA 1 Reply Last reply
                        0
                        • rnollenR rnollen

                          Thanks; but how to go further from here then :) Is there a way to create a sketch for this device? And how to attach it to a Nano board?

                          I got a manual from the supplier: https://1drv.ms/w/s!AmsPyx0xoB6jjYo0PZZRazdA3-vPpw for this device. But I already see a difference with the wires :) But to give it a start then, according to the manual it counts the pulses and that gives a windspeed :)

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

                          @rnollen Hi, the manual is a bit confusing in that it mentions a "serial protocol" and also a table is mentioned with voltages and wind speed. As yours iw 3 wire we can assume it is not a RS485 output.

                          Then there are you need to dertermine what kind of output it is either NPN or PNP. : PNP needs a "pull down" resistor. NPN needs a "pull up". resistor..Best thing is to test the different options with the volt meter.

                          According to the table the "average" voltage should vary with the rotating spreed.

                          Note that I make a lot of assumptions.... but: If you get a voltage on your meter that changes with the rotating spreed than it is time to connect the nan. With the assumption that there are pulses, best thing is to write a routine which counts the pulses in a certain time frame e.g 10 secs. (connect the nano with a either a digital or analog pin, but read with digitalread(),. There should be many examples on the web.

                          Have fun

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

                            @AWI . I will try to find out. But for the record later, can I simply connect the 5V, ground and the Yellow dataline directly to the arduino ? Or do I still need a resistor somewhere?
                            Then I will try to find I sketch to read the digital pin. Can i maybe use other pulse sketches as an example?
                            I will do the Volt test, I know that the volt test remains the same when I rotate on the same speed. Don't know for sure, if I rotate faster if the volt's are the same then as before. I thought not, but I will test later tonight.

                            AWIA 1 Reply Last reply
                            0
                            • rnollenR rnollen

                              @AWI . I will try to find out. But for the record later, can I simply connect the 5V, ground and the Yellow dataline directly to the arduino ? Or do I still need a resistor somewhere?
                              Then I will try to find I sketch to read the digital pin. Can i maybe use other pulse sketches as an example?
                              I will do the Volt test, I know that the volt test remains the same when I rotate on the same speed. Don't know for sure, if I rotate faster if the volt's are the same then as before. I thought not, but I will test later tonight.

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

                              @rnollen If you keep the voltage at 5v you can directy connect to the arduino pin. You still need a pull-up/down resistor though.

                              pin D13 on the nano has a LED connected to it. It may help you in observing what is going on. A LED is much faster than a volt meter..

                              rnollenR 1 Reply Last reply
                              0
                              • AWIA AWI

                                @rnollen If you keep the voltage at 5v you can directy connect to the arduino pin. You still need a pull-up/down resistor though.

                                pin D13 on the nano has a LED connected to it. It may help you in observing what is going on. A LED is much faster than a volt meter..

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

                                @AWI said:

                                @rnollen If you keep the voltage at 5v you can directy connect to the arduino pin. You still need a pull-up/down resistor though.

                                pin D13 on the nano has a LED connected to it. It may help you in observing what is going on. A LED is much faster than a volt meter..

                                Sorry for all the questions :) But I am a noob on this matter. I do know something of scripting, but electronics is not something where I am familiar with.
                                But to summarize then how to connect it; The yellow line, will go through a resistor (which one?) and that is connected to D13. Black is Ground, Red is 5 Volt? Is this correct? And is this setup only for testing or also as the final solution later on, because the D13 is also used for the radio? Problem is: I don't know exactly what a LED is in you're example :)

                                Edit-> Also send questions to the supplier. Maybe he can gives me an answer if it is PNP or NPN device. Also asked for schematics and how to calculate the pulses.

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

                                  When I use the volt meter and I rotate, then the volts are pretty much the same. Rotating faster, doesn't give me higher values.
                                  As a test I have attached it to my Arduino nano using a 10k Pullup resistor. Found a little example sketch regarding the LED on the arduino site. As the very first test I can see the light bling on the arduino when I rotate the windmeter. Rotating it harder will make the light bling faster, rotating slower and it blings slowly. So the pulses seems to come through.

                                  But now, I need a vary small and basic way to start counting the pulses when it rotates. I have tried to create a very small sketch (using an example of the Arduino website). But that is not working OK. Tried to modify the examples for powermeter and watermeter which are also pulse sketches, but at this stage it has too much code.
                                  Does anyone have a very small example sketch to start with for my setup?

                                  1 Reply Last reply
                                  0
                                  • AWIA AWI

                                    @rnollen Hi, the manual is a bit confusing in that it mentions a "serial protocol" and also a table is mentioned with voltages and wind speed. As yours iw 3 wire we can assume it is not a RS485 output.

                                    Then there are you need to dertermine what kind of output it is either NPN or PNP. : PNP needs a "pull down" resistor. NPN needs a "pull up". resistor..Best thing is to test the different options with the volt meter.

                                    According to the table the "average" voltage should vary with the rotating spreed.

                                    Note that I make a lot of assumptions.... but: If you get a voltage on your meter that changes with the rotating spreed than it is time to connect the nan. With the assumption that there are pulses, best thing is to write a routine which counts the pulses in a certain time frame e.g 10 secs. (connect the nano with a either a digital or analog pin, but read with digitalread(),. There should be many examples on the web.

                                    Have fun

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

                                    @AWI said:
                                    ..... There should be many examples on the web.

                                    Have fun
                                    Unfortunately I cannot find any working example code. Found all kind of stuff on the internet, but nothing that will give me some valuable data.
                                    I think that the examples on the internet mostly uses an pull up anemometer, as far as I can see the Arduino Nano also have a internal one which you can activate on the sketch. But basically, when I use a resistor, which is connected on the yellow and red wire, I am still stuck on the sketch I cannot find something desent (and small), that gives me something valuable. I now know why the windmeter is not an example on the Mysensors site :) Way to difficult :).

                                    AWIA 1 Reply Last reply
                                    0
                                    • rnollenR rnollen

                                      @AWI said:
                                      ..... There should be many examples on the web.

                                      Have fun
                                      Unfortunately I cannot find any working example code. Found all kind of stuff on the internet, but nothing that will give me some valuable data.
                                      I think that the examples on the internet mostly uses an pull up anemometer, as far as I can see the Arduino Nano also have a internal one which you can activate on the sketch. But basically, when I use a resistor, which is connected on the yellow and red wire, I am still stuck on the sketch I cannot find something desent (and small), that gives me something valuable. I now know why the windmeter is not an example on the Mysensors site :) Way to difficult :).

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

                                      @rnollen It shouldn't be so complicated.. there are a many ways to do it. Start in the learning curve with the most simple method of counting pulses using the arduino builtin method pulseIn(). (non MySensors, basic arduino). You should be able to see the pulse frequency on the serial port when turning the rotor.

                                      const int anemometerPin = 4 ; // wherever you connected the anemometer
                                      unsigned long timePeriod = 0;  
                                      unsigned long timeon = 0;
                                      unsigned long timeoff =0;
                                      
                                      void setup()
                                      { pinMode(anemometerPin, INPUT_PULLUP);
                                        Serial.begin(9600);
                                      }
                                      
                                      void loop()
                                      {
                                         timeon = pulseIn(anemometerPin,HIGH); // Measured Time On
                                         timeoff = pulseIn(anemometerPin,LOW); // Measure Time Off
                                         timePeriod = timeon + timeoff; // total period = on + off 
                                         float frequency  = 1000000.0/timePeriod; // calculate the frequency
                                         Serial.println(frequency);
                                         delay(1000);
                                      }
                                      
                                      
                                      1 Reply Last reply
                                      0
                                      • rnollenR Offline
                                        rnollenR Offline
                                        rnollen
                                        wrote on last edited by
                                        #20

                                        @AWI Thanks, I will give it a try. Today I also received some additional info. The device is a NPN model. Type 12CM, according to the supplier it is 12 pulses for 1m/s per second. But the manual says that this model is 10 pulses for 1m/s.

                                        So basically I could now connect the device as NPN, only I need to find out how :)

                                        AWIA 1 Reply Last reply
                                        0
                                        • rnollenR rnollen

                                          @AWI Thanks, I will give it a try. Today I also received some additional info. The device is a NPN model. Type 12CM, according to the supplier it is 12 pulses for 1m/s per second. But the manual says that this model is 10 pulses for 1m/s.

                                          So basically I could now connect the device as NPN, only I need to find out how :)

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

                                          @rnollen good news. Npn needs a pull-up so the sketch above should be able to do it. It uses the internal pull-up of the Arduino. I am curious to the outcome.

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


                                          15

                                          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