Problem with Wind Speed sensor
-
@rnollen take care.. This is how it should be (with the anemometer) I will post the MySensors version tomorrow (need some sleep now)
-
@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
-
@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
@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.
-
@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.
-
@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:)
@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 ;-)
-
@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?
-
@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?
@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.
-
@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 ;-)
@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.
-
@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.
@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.
-
@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?
@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 -
@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 :) -
@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 :)@rnollen My theory for calculating they outcome of your sensor is the following. All you need to know is the distance it takes from the pulse going from LOW (leaving the hall sensor) to HIGH triggering the hold sensor. If that's for instance 10 cm. Than the distance traveled by one full turn is 10cm. Let's say the wind will cause your windsensor to travel exactly once every second, the speed would by 600 cm's in 60 seconds. That's 1 meter per minute. So the wind speed would be 60 meter per hour which is known is 0 Beaufort.
If however the wind causes the sensor to turn exactly 3 times per second, that would be 30cm which is 0.3 m/s. Then the wind speed would be 1 Beaufort. Since 12 Beaufort starts at 32.6 m/s it would mean that your wind sensor would turn 3260 cm per second divided by 10 is 326 turns per second. which is roughly once every 3 millisecond.
But I'm hoping that someone can verify this theory ;-)
-
@rnollen My theory for calculating they outcome of your sensor is the following. All you need to know is the distance it takes from the pulse going from LOW (leaving the hall sensor) to HIGH triggering the hold sensor. If that's for instance 10 cm. Than the distance traveled by one full turn is 10cm. Let's say the wind will cause your windsensor to travel exactly once every second, the speed would by 600 cm's in 60 seconds. That's 1 meter per minute. So the wind speed would be 60 meter per hour which is known is 0 Beaufort.
If however the wind causes the sensor to turn exactly 3 times per second, that would be 30cm which is 0.3 m/s. Then the wind speed would be 1 Beaufort. Since 12 Beaufort starts at 32.6 m/s it would mean that your wind sensor would turn 3260 cm per second divided by 10 is 326 turns per second. which is roughly once every 3 millisecond.
But I'm hoping that someone can verify this theory ;-)
@TheoL In essence you are right but you need to get some more variables in the equation. It is a rotating sensor with (probably non linear) losses. Best solution in this case is to calibrate it with a known value. @mollen bought himself a quality sensor which is supposed to be calibrated. 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." which should make the calculation pretty easy: either divide the pulses per second by 12 (or 10).
Line 68: float windSpeed = frequency / meterPerPulse ; // calculate m/s for pulses per secondand the calibration value (to be adjusted)line 39: const int meterPerPulse = 10 ; // number pulses/s for each m/sI am still working on a whole different approach for measuring wind parameters with the help of an acceleration sensor. I looks very promising.
-
@TheoL In essence you are right but you need to get some more variables in the equation. It is a rotating sensor with (probably non linear) losses. Best solution in this case is to calibrate it with a known value. @mollen bought himself a quality sensor which is supposed to be calibrated. 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." which should make the calculation pretty easy: either divide the pulses per second by 12 (or 10).
Line 68: float windSpeed = frequency / meterPerPulse ; // calculate m/s for pulses per secondand the calibration value (to be adjusted)line 39: const int meterPerPulse = 10 ; // number pulses/s for each m/sI am still working on a whole different approach for measuring wind parameters with the help of an acceleration sensor. I looks very promising.
@AWI Thanx for the explanation. I just have to build the sensor with as much precision as I can. All will of course depend on things like the quality of the ball-bearrings that I use e.t.c. And of course in the quality of the electronic parts. And I have to calibrate it despite of my theory. What I didn't take into account is the minimum force that is needed for the sensor to start rotating.
Your approach sounds very interesting. I've recently found a sensors that measures the angle movement of a magnet. My theory is, that by probing each angle movement within a couple of ms would end up in a very precise wind sensor. Problem is that I wasn't able to find a breakout board. I can only buy the sensor as an SMD IC. And soldering SMD is just not a skill I have found time to master yet.
Also this sensor would make a perfect wind direction sensor, which is far more precise than using 8 reed relays or hall sensor that most of these wind direction sensor do. The IC cost around 7 dollar if I remember correctly.
-
@AWI Thanx for the explanation. I just have to build the sensor with as much precision as I can. All will of course depend on things like the quality of the ball-bearrings that I use e.t.c. And of course in the quality of the electronic parts. And I have to calibrate it despite of my theory. What I didn't take into account is the minimum force that is needed for the sensor to start rotating.
Your approach sounds very interesting. I've recently found a sensors that measures the angle movement of a magnet. My theory is, that by probing each angle movement within a couple of ms would end up in a very precise wind sensor. Problem is that I wasn't able to find a breakout board. I can only buy the sensor as an SMD IC. And soldering SMD is just not a skill I have found time to master yet.
Also this sensor would make a perfect wind direction sensor, which is far more precise than using 8 reed relays or hall sensor that most of these wind direction sensor do. The IC cost around 7 dollar if I remember correctly.
@TheoL I use an acceleration sensor which makes is easy to calculate angle and direction with respect to gravity. Problem is more in the mechanics to make it reliable and damped.
I will publish in a few weeks and discuss in a separate thread -
@TheoL I use an acceleration sensor which makes is easy to calculate angle and direction with respect to gravity. Problem is more in the mechanics to make it reliable and damped.
I will publish in a few weeks and discuss in a separate thread@AWI Looking forward to that thread. Would love to team up with you on this on. This is the sensor I was talking about. Just posting it hear so I'll remember it
-
@AWI Looking forward to that thread. Would love to team up with you on this on. This is the sensor I was talking about. Just posting it hear so I'll remember it
-
@TheoL A compass sensor will probably work just as fine, is a lot cheaper and comes as a module!
Just use a weak magnet (no neodimium :skull: ) -
@Yveaux True. But I think it's much easier to epoxy a magnet under an rotating axis. Let's see what we can come up with saturday.??
-
Hello I bought a TX23 and wanted to integrate it into FHEM.
Could anyone look over the scetch if it is correct?/** # Arduino-LaCrosse-TX23-Library LaCrosse TX23 is a wind speed and direction sensor. It uses 3 wires for communication and power: Pin1 - Brown(Black) - DATA Pin2 - Red - Vcc Pin3 - Green - N/C Pin4 - Yellow - GND DATA pin is to be connected directly to one of Arduino ports. */ // Enable debug prints to serial monitor #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <MySensors.h> #include <SPI.h> #include <LaCrosse_TX23.h> #define CHILD_ID_WIND 1 //DATA wire connected to arduino port 4 LaCrosse_TX23 anemometer = LaCrosse_TX23(4); // standard messages MyMessage msgWSpeed(CHILD_ID_WIND, V_WIND); MyMessage msgWDirection(CHILD_ID_WIND, V_DIRECTION); void setup(){ } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Wind Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID_WIND, S_WIND); } void loop() { //String dirTable[]= {"N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"}; String dirTable[]= {"0","22.5","45","67.5","90","112.5","135","157.5","180","202.5","225","247.5","270","292.5","315","337.5"}; float speed; float a = 22.5; int direction; if(anemometer.read(speed, direction)) { send(msgWDirection.set(direction*a ,1)); send(msgWSpeed.set(speed, 1)); Serial.println("Speed = " + String(speed,1) + " m/s"); Serial.println("Dir = " + dirTable[direction] + " Grad"); } else { Serial.println("Read error"); } //delay between succesive read requests must be at least 2sec, otherwise wind speed will read 0. delay(2000); }Thank you