How to read pulses from wind sensor

Hello everyone,

I am trying to connect a wind sensor to my Arduino via I2C communication, but I have problems finding out the ID of the sensor using an I2C scanner. I have done a few minor Arduino projects before and I am familiar with basic electronics and coding. However, this is my first time working with I2C communication.

Hardware used:

  • Arduino Nano
  • Thies Clima Wind Direction Transmitter Type 4.3129.03.000
    (I have attached the datasheet. Unfortunately, I have only found it in German.)

Software used:

I have connected:

  • sensor input power to the 5V Arduino power output
  • sensor ground to Arduino GND
  • sensor SDA to Arduino pin A4
  • sensor SCL to Arduino pin A5
  • two 10kOhm pull up resistors to SDA and SCL

When I now run the code, the I2C scanner gets stuck on “Scanning…” and nothing happens.

When I remove the SCA or SCL cable and restart the code, the scanner says “No device found”.
I have also tried to exchange my wind sensor by an OLED SSD1306 display and the I2C scanner worked perfectly. From this I conclude that:

  • the code is working
  • the Arduino is working
  • the circuit is correct
    Hence, the problem must be in my wind sensor.

I have read several threads on this issue already and in most of the cases the problem seemed to be in the sensor connection. My cables look good and I cannot see any bridges but I would like to test that.

Do you have any ideas, how I can do that? Do I have to buy a multimeter and measure between the pins of my sensor like cattledog said in this thread: http:// or are there other ways?

Best regards.

4.3129.03.000_WR-Geber-compact_seriell_deu.pdf (341 KB)

Second link is not working. This is the correct one:

What happens when you change this line (in the I2C scanner)

for(address = 1; address < 127; address++)


for(address = 8; address < 120; address++)


Now the scanner says "No device found". What can I conclude from this?

I also realized, that when I change back the limits to 1 and 126 and reload the program the scanner now says "No device found", too. Which is very strange, since I am now using the same code as before when it got stuck at "Scanning...".

I can't read German, but I don't see anything in that document to suggest that the device uses I2C.

Google translate tells me:

This code disk is coded with a 5-bit Gray code, which is optoelectronically scanned and is available serially at the output. In addition, a 3-bit identifier is transmitted (see Gray code table).

You may need to read it bit by bit.

Actually, I think the reason I assumed it uses I2C was simply that it has a data and a clock line. As I said, I am not experienced with serial interfaces, so probably that assumption was wrong.

May I ask what kind of protocol you would suggest to use instead? SPI?

I'm not sure whether SPI is appropriate - simply because I don't know enough about it. Personally, I would just try reading A4 and A5 and see what you get.

Once you figure out the clock speed, you can write something that grabs the five bits and interprets the Gray code.

It is not I2C.
belanubis, can you go to your top-post and use "Modify" to change the title. Perhaps: "How to read pulses from wind sensor ?".

Data: Ausgangssignal
Clock: Eingangssignal

That is not hard to understand, aus = out, ein = in, gang = put, signal = signal :wink:

The Arduino should give the clock signal and the wind sensor returns the data.
Then I would use nothing fancy, just normal code with a for-loop and digitalWrite() and digitalRead().

The clock period is 0.2 to 10ms. For example 1ms low and 1ms high makes a clock period of 2ms.
The first clock pulse is 2 to 10ms. The clock is idle low, and the first clock pulse should be longer.
The maximum number of requests is 30 times per second.

The 5 bits plus 3 extra makes 8 bits. The data contains those 8 bits in a normal way and then again those 8 bits inverted. So you read 16 bits and comparing both parts is a nice test to check if the data is valid.

If i'm interpreting the data sheet correctly (I don't read German), then the AVR SPI Interface should be able to do this. However, I don't think you can get the SPI clock to go slow enough on a 16MHz Arduino to achieve the 5khz maximum clock speed the sensor can handle.

I suspect that you would have to write your own version of the shiftIn() function (sort of software SPI!) to bit bang the reading of the 16 bits of data from the sensor.

Thank you for your replies! I will do some research on those methods and try it out.
I have updated the title as suggested.

This is what I had in mind. Not tested, there might be a few bugs in it.

const int dataPin = 2;   // input
const int clockPin = 3;   // output

unsigned long previousMillis;

void setup()
  pinMode( dataPin, INPUT);
  pinMode( clockPin, OUTPUT);

void loop()
  unsigned long currentMillis = millis();

  if( currentMillis - previousMillis >= 200)   // 200ms = 5 times per second
    previousMillis = currentMillis;

    // See datasheet, 16 pulses of the clock, first pulse longer,
    // two bytes, lsb is first bit, read on falling edge.
    // Reading on falling edge means after the delay and just before the falling clock edge.

    uint16_t sensorWord = 0;
    for( int i=0; i<16; i++)
      digitalWrite( clockPin, HIGH);

      if( i == 0)      // first clock pulse ?
        delay( 5);
        delay( 1);
      int dataValue = digitalRead( dataPin);
      if( dataValue == HIGH)
        bitSet( sensorWord, i);
      digitalWrite( clockPin, LOW);
      delay( 1);
    byte sensorByte = highByte( sensorWord);
    byte sensorByteInverted = lowByte( sensorWord);
    if( sensorByte == ~sensorByteInverted)
      // Check the three highest bytes for 010
      // Check the five lowest byte for the real data