"CES155" anemometer [solved]

I got a "CES155" anemometer made by Cimel, The sensor has 3 wires: Power, GND, and Output

The illustration document of the sensor says: "Counting by optical fork. The emitting diode (1) receives pulses of 50 μS at a frequency of 256 Hz. Sensor pulse height connected: 1.2 Output on phototransistor (2), Level 5V generation of pulses drawn to the mass of height ≈ 500mV"

after contacting CIMEL, they told me that i have to use synchronous detection at 256Hz. and i didn't understand how to do this. (according to them it is not obligatory to use it so as the sensor works).

they also told me that it is necessary to enter a Schmitt trigger circuit to have frank transitions. so i used MC14093bcp, i put 5v to in1A and pin-14, and in in2A i put the output of the sensor in serial with a 1kohm resistor, and in the 7th pin i put GND. (is this right?)
and with the below code i always get 0 in serial monitor.

#define sensor 2
unsigned long startMillis;  //some global variables available anywhere in the program
unsigned long currentMillis;
const unsigned long period = 1000;  //the value is a number of milliseconds
long freq = 0;
int state = 0;
int lstate = 0;

void setup() {
  Serial.begin(115200);
  pinMode(sensor, INPUT);
  startMillis = millis();  //initial start time
}

void loop() {
  currentMillis = millis(); 
  state = digitalRead(sensor);

 if (state != lstate) {
  freq = freq +1;
  lstate = state;
  }
   if (currentMillis - startMillis >= period)  //test whether the period has elapsed
  {
  Serial.println(freq);
  startMillis = currentMillis; 
  freq = 0;
  }
  
  }

i hope that you can help.
[solved]

CES155_Anemometer.pdf (520 KB)

Seems your anemometer uses an opto "break-beam" sensor instead of the reed switch on the Davis unit, we need to know the power supply voltage and the number of pulses per m/S of wind speed, did you get an "owner's manual"?

outsider:
Seems your anemometer uses an opto "break-beam" sensor instead of the reed switch on the Davis unit, we need to know the power supply voltage and the number of pulses per m/S of wind speed, did you get an "owner's manual"?

The only information i have is this and the picture i've attached.

Is "Comptage par fourche (fork in English) optique" the same as "opto break-beam sensor"?

In this link i find this:
"In another design, known as optoelectronic, spinning cups turn a kind of paddle wheel inside the metal canister underneath. Each time the paddle wheel rotates, it breaks a light beam and generates a pulse of current. An electronic circuit times the pulses and uses them to calculate the wind speed. The anemometers shown in our photos up above, made by Ames of Slovenia, work in roughly this way"

edit: I've added a PDF file of the sensor (and it's content is the same as in their website, but in English)

I guess you could call this a "fork":

Have you examined your anemometer closely for a data plate that might show the operating voltage? Without knowing that, I cannot make any recommendation.
Can you contact cimel?

outsider:
I guess you could call this a "fork":
https://www.amazon.com/FemiaD-Slotted-Optical-Switch-HY860H/dp/B0768SCJ9C/ref=sr_1_9?ie=UTF8&qid=1528959610&sr=8-9&keywords=IR+gap+sensor
Have you examined your anemometer closely for a data plate that might show the operating voltage? Without knowing that, I cannot make any recommendation.
Can you contact cimel?

I had another sensor from CIMEL before that one, and i tried contacting them but they did not reply.
i found a PDF file in this link for an Opto-electronic wind senor that seems like the CIMEL one, and in the PDF they have mentioned that the input voltage is between 9 and 30 V.

I've attached the PDF file.

Anemometer_ThiesCompact_S12100H.pdf (814 KB)

Edit2: After adding a 170 ohm resistance (inspired from this) and with this code:

#define sensor 2
unsigned long startMillis;  //some global variables available anywhere in the program
unsigned long currentMillis;
const unsigned long period = 1000;  //the value is a number of milliseconds
long freq = 0;
int state = 0;
int lstate = 0;

void setup() {
  Serial.begin(115200);
  pinMode(sensor, INPUT);
  startMillis = millis();  //initial start time
}

void loop() {
  currentMillis = millis(); 
  state = digitalRead(sensor);

 if (state != lstate) {
  freq = freq +1;
  lstate = state;
  }
   if (currentMillis - startMillis >= period)  //test whether the period has elapsed
  {
  Serial.println(freq);
  startMillis = currentMillis; 
  freq = 0;
  }
  
  }

I get always: 100 in Serial, even when turning the cups of the sensor.
and when i remove the resistance, i always get 0 at Serial output.

If you KNEW FOR SURE that it is rated for 9 to 30 VDC you might try this, it would drop 12V to 4.3, and try your program, which I hacked a bit. :slight_smile:

#define sensor 2
unsigned long startMillis;  //some global variables available anywhere in the program
unsigned long currentMillis;
const unsigned long period = 1000;  //the value is a number of milliseconds
long freq = 0;
int state = 0;
int lstate = 0;

void setup() {
  Serial.begin(115200);
  pinMode(sensor, INPUT);
  pinMode(LED_BUILTIN,OUTPUT);
  startMillis = millis();  //initial start time
}

void loop() {
  currentMillis = millis();
  state = digitalRead(sensor);
  digitalWrite(LED_BUILTIN,state);
 if (state != lstate) {
  freq = freq +1;
  lstate = state;
  }
   if (currentMillis - startMillis >= period)  //test whether the period has elapsed
  {
  Serial.println(freq);
  startMillis = currentMillis;
  freq = 0;
  }
 
}

img1.pngimg2.png
One other thing, the anemometer MIGHT have an open collector output which would need a different circuit.

i got a reply from them, they told me that i have to use a "synchronous detection at 256Hz" but i did not understand how to make this?

also they told me that it will be necessary to put another resistance in series to limit the current to approximately 3mA ,1 kohms if one working with 5V.
after adding the 1k resistance, now I'm getting strange results (attached).


and it seems that turning the the cups of the sensor doesn't affect those results.

they also told me that It will be necessary to enter a Schmitt trigger circuit to have frank transitions. and I'm not familiar using those circuits, how to choose the proper one?

I used MC14093bcp, i put 5v to in1A, and in in2A i put the output of the sensor in serial with a 1kohm resistor, and i always get 0 in serial monitor.

Edit:
I used the interruption method (with Arduino) to measure the frequency, when I put the output of the anemometer in serial with 1kohm resistance the frequency feels good (I get 2 frequencies on each 1 tour => 2 freq for 1m => number of freq in 60 sec / 2 = x m/min), but when I use the trigger Schmitt it does not work.

this is my code:

const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
volatile long freq = 0;

unsigned long startMillis;  //some global variables available anywhere in the program
unsigned long currentMillis;
const unsigned long period = 60000; 
long windspeed;

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), count, CHANGE);
  startMillis = millis(); 
}

void loop() {
  currentMillis = millis(); 
  if (currentMillis - startMillis >= period)  //test whether the period has elapsed
  {
  windspeed = freq /2;
  Serial.print(windspeed);
  Serial.println(" metre/minute");
  startMillis = currentMillis; 
  freq = 0;
  }

}

void count() {
  state = !state;
  freq=freq+1;
}