Anemometer, ADS1115 and ESP

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Anemometer, ADS1115 and ESP

#1 Post by budman1758 » 12 Jun 2017, 04:59

I am trying to setup a wind speed reader and so far after bouncing all over the web I believe I am more confused now than when I started. This is probably not the "best" place for all the questions I have but because I am using ESPEasy I hope this isn't too far off topic.

I have one of these anemometers http://www.ebay.com/itm/New-Wind-Speed- ... 2f04adec80 and I am using an ADS1115 to connect to an ESP-01 module.

Questions. Apparently the ADS cannot measure more than .3 volts above the voltage used to power it. So in order to measure the possible 5 volt output of the anemometer I suppose I need to power it with 5 volt. Do I now need level shifters on the I2c connection?
What determines the I2c voltage? The controller (in this case the ESP) or the ADS module? Is it just whichever voltage is higher? Would a voltage divider on the analog input be a better solution?

Also having difficulty understanding the gain setting. Then there is the question of the formula needed to convert the voltage to an output that makes sense. I would like it to be in miles per hour. Sorry but most metric measurements don't "hit" me the same way as imperial. Its what I grew up with. :mrgreen:

This project has a very practical purpose. I live in an RV full time and it has an electric awning. I want the ESP to fire a relay to roll the awning up when the wind reaches a certain speed. I can do that fine when I am home but hard to do if I'm not. It's pretty easy to forget to roll it up when I leave. At my age its actually pretty easy to forget what I walk into a certain room for. :roll: :roll:

Any and all help would be most appreciated.
"The glass is twice as big as it needs to be".

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Anemometer, ADS1115 and ESP

#2 Post by Shardan » 12 Jun 2017, 15:18

budman1758 wrote: 12 Jun 2017, 04:59 Questions. Apparently the ADS cannot measure more than .3 volts above the voltage used to power it. So in order to measure the possible 5 volt output of the anemometer I suppose I need to power it with 5 volt. Do I now need level shifters on the I2c connection?
What determines the I2c voltage? The controller (in this case the ESP) or the ADS module? Is it just whichever voltage is higher? Would a voltage divider on the analog input be a better solution?
The voltage on I²C depends on two simple factors. I²C should have some pullup resistors at one end of the line.
These pull the lines to 3,3V or 5V, depending to which voltage the resistors are connected.
Even the connected I2C circuits may bring their own resistors and voltage - in case of doubt use a digital voltmeter to check before connecting to the ESP.

Alternatively you can use a voltage divider to reduce the voltage.
A divider of 4,7KOhm and 2,2 KOhm will give an output voltage of 1,6V at "full speed" instead of 5V.
So you can cover full range without level shifter.
Also having difficulty understanding the gain setting.
Gain can be set to different values. The given value, for example 6.144V, is the maximum you can measure in that configuration.
So if you connect your wind sensor directly (5V output max), 6.144V is the correct one.
If you use a voltage divider as described above, set it to 2,048V

Remember: An AD-converter does not give back a voltage reading. It gives back "ticks".
At this setting the ADS works from -6.144V to +6.144V, it has a resolution of 16bit for that. So the positive voltage spans "ticks" from 0 (0V) to 32767 (6.144V).
5 Volts will read of 26667. (26667 ticks * 187,5µV/tick).

With the second setting (Voltage divider and gain setting to 2.048v), full speed will read 25600 ticks.
Then there is the question of the formula needed to convert the voltage to an output that makes sense. I would like it to be in miles per hour. Sorry but most metric measurements don't "hit" me the same way as imperial. Its what I grew up with. :mrgreen:
A bit difficult to answer as the ebay page isn't really clear.
"Wind Speed: Output voltage /5*32.4"
I'm not sure, i assume this means (Vout/5) * 32.4. Or is it Vout / (5*32,4) ??
It's not too difficult to change this if i guessed wrong :)
The ebay offer does not say if this is meters or miles per second.

As we have ticks, not volts you will have to calculate that into the formula to get to a real value.

Then we get a formula:

(ticks from ADS * 0,0001875 *32.4) / 5

If that returns results in metrical you may change it to

(ticks from ADS * 0,0001875 * 32.4 * 0,621371) / 5

for imperial.

For the secondary setting with voltage divider you have to change the formulas to:

(ticks from ADS * 0,0000625 *32.4) / 1,6 (metrical)

(ticks from ADS * 0,0000625 *32.4 * 0,621371) / 1,6 (imperial)
Regards
Shardan

User avatar
budman1758
Normal user
Posts: 301
Joined: 15 Apr 2017, 05:13
Location: Riverside CA USA

Re: Anemometer, ADS1115 and ESP

#3 Post by budman1758 » 13 Jun 2017, 06:39

You are DA MAN!!!! SHARDAN!!!. :D :D :D

Thanks for all the pointers. Really appreciate it. After pounding my head against the wall you really helped me start looking at this correctly.
The 32.4 spec on the eBay listing stands for meters per second and that's the most its supposed to measure. That's 5 volts. Does anybody measure wind that way??? I would think kilometers per hour would be easier to understand. :roll: Anyway the first thing I did was convert that to miles per hour which is 72.4 and some change.

I don't know the math to get the total number of "ticks" in the 2x range but when I read that the lite bulb went on in my head. I set up the input with the voltage divider as you suggested. Then I just divided the total ticks at 5 volts by 72.4 to get the voltage per tick. So the formula became %value*.002832 which appears to be pretty close. Also because even with the anemometer at rest the ADC was showing a value of about 160. Because I have the value display at 1 decimal I was getting as much as .5 "wind" with no movement. So after messing around with the formula for a bit I came up with the final formula of (%value%-160)*.002832. Seems to work pretty well comparing it to my Acurite sensor in the yard.

Now its just a matter of a rule to fire the relay when the wind is above a certain yet to be determined value. :mrgreen: :mrgreen:

Thanks again Shardan for your detailed help and Kudo's again to the Devs for this great piece of software. With ESPEasy I can finally do a bunch of stuff I could not otherwise do. While I'm fairly adept at bashing hardware together my programming skills are completely non-existent. ESPEasy makes it easy!! :D
"The glass is twice as big as it needs to be".

pisti81
New user
Posts: 1
Joined: 30 May 2019, 21:51

Re: Anemometer, ADS1115 and ESP

#4 Post by pisti81 » 15 Jun 2019, 17:38

Hi Budman!
I have the same anemometer and ESP 8266 with ESP Easy on it. I tried the thing on raspberry pi and I have had readings all over the place. I found some forums and others has the same experience with this type of anemometer.
At the moment I connect the power wire to 12v psu, the ESP is 5V and the 5v pin on my ESP base board is connected to a 4.7K resistor then the other end of the resistor is connected to the signal line. The signal is connected to the onboard analog input. I have readings from the unit, but something is not right.
My reading is wandering in between 735.0000-734.7000
Not sure what am I doing wrong but the readings are not right. There is definitely a link between the ESP and the sensor, so wiring should not be an issue. As soon as I remove the signal pin the value drops, also if I turn the psu off the value drops.

Any idea? Would you mind to share how is yours operates?
Thank in advance.
Best wishes,
Pisti,

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 36 guests