1
\$\begingroup\$

I need a wind direction sensor (not anemometer, which is a wind speed sensor) with a high resolution and I²C interface.

The only direction sensor I could find were magnetic compasses, that had a very low resolution (16 directions).

I'd like to stick to the I²C bus, since all my other sensors use that and it's quite easy to use.

It shouldn't be insanely expensive, as well...

\$\endgroup\$
10
  • 4
    \$\begingroup\$ "High" resolution is no spec at all, which should be obvious. \$\endgroup\$ Commented Feb 7, 2012 at 19:03
  • 2
    \$\begingroup\$ No it's not, but I was referring to common sense here, given that I mentioned 16 directions as very low resolution. 0.1° resolution would be awesome, 0.5°-1.0° would be very good. 1.4° would correspond to 8bit resolution, which would still be good enough for me. \$\endgroup\$
    – polemon
    Commented Feb 7, 2012 at 19:45
  • 1
    \$\begingroup\$ What am I missing. How does a magnetic compass provide wind direction? \$\endgroup\$
    – kenny
    Commented Feb 7, 2012 at 20:00
  • 2
    \$\begingroup\$ Alternatively, the compass could be stationary, and you could place a magnet in the rotating part. \$\endgroup\$ Commented Feb 7, 2012 at 21:40
  • 2
    \$\begingroup\$ Are you sure it makes sense to determine air flow direction so accurately? When I see a wind vane it turns around all the time. And even if it did not a tree or other obstacle 20 meters upwind can change your perceived wind direction considerably. \$\endgroup\$ Commented Feb 7, 2012 at 21:50

3 Answers 3

4
\$\begingroup\$

Do you really need to know wind direction to better than every 20 degrees?

OK, then; this can be accomplished using an incremental rotary encoder. Encoders are available in enough variety of resolution that you are sure to find one that fits your need. If you can't then investigate resolvers that will provide effectively infinite resolution.

Attach a flag/wind vane to the encoder shaft and it will turn to point into the wind. A small microcontroller with I2C output is then all you need as only two digital inputs are needed to read the encoder. Some mechanical design will be needed to ensure that water, dust, etc. are kept out of the electronics. A third digital input and a "home" sensor can be used to reset the position every time the wind goes through a certain direction. North would be a good idea.

An incremental encoder only tells you the angular distance from a certain point, hence the "North" sensor. You can dispense with this sensor by making sure that the circuit never loses power after it has been manually set to home. Designing a power system to ensure this is a separate task, or you can instead use an absolute encoder. However, absolute encoders of appreciable resolution are quite expensive.

\$\endgroup\$
1
  • \$\begingroup\$ I was advised that at some other location as well, I was told to take a look at the AS5043. Only problem is, it doesn't have I²C, which is kind of a bummer, since all other sensors work with I²C. \$\endgroup\$
    – polemon
    Commented Feb 8, 2012 at 6:50
2
\$\begingroup\$

"Perfect" solution

ST LSM303DLHC datasheet

  • 3D magnetometer

AND

  • 3D accelerometer

combined

$8.43/1 in stock at Digikey.
I^2C

Liable to exceed your accuracy or linearity or resolution needs.

■ 3 magnetic field channels and 3 acceleration channels
■ From ±1.3 to ±8.1 gauss magnetic field fullscale
■ ±2g/±4g/±8g/±16g selectable full-scale
■ 16 bit data output
■ I2C serial interface
■ Analog supply voltage 2.16 V to 3.6 V
■ Power-down mode/ low-power mode
■ 2 independent programmable interrupt generators for free-fall and motion detection
■ Embedded temperature sensor
■ Embedded FIFO
■ 6D/4D orientation detection
■ ECOPACK

The LSM303DLHC is a system-in-package featuring a 3D digital linear acceleration sensor and a 3D digital magnetic sensor. LSM303DLHC has linear acceleration full-scales of ±2g / ±4g / ±8g / ±16g and a magnetic field fullscale of ±1.3 / ±1.9 / ±2.5 / ±4.0 / ±4.7 / ±5.6 / ±8.1 gauss. All full-scales available are fully selectable by the user. LSM303DLHC includes an I 2 C serial bus interface that supports standard and fast mode 100 kHz and 400kHz. The system can be configured to generate interrupt signals by inertial wakeup/free-fall events as well as by the position of the device itself. Thresholds and timing of interrupt generators are programmable by the end user on the fly. Magnetic and accelerometer parts can be enabled or put into power-down mode separately. The LSM303DLHC is available in a plastic land grid array package (LGA) and is guaranteed to operate over an extended temperature range from -40 °C to +85 °C

\$\endgroup\$
1
  • \$\begingroup\$ is that the same device that comes with the $20 stm32f4 discovery board? (a microcontroller eval board) \$\endgroup\$
    – old_timer
    Commented Feb 8, 2012 at 1:49
2
\$\begingroup\$

Here a lib and a Wind Vane code sample based on Arduino & AMS AS5048B sensor which has an I2C interface

https://github.com/sosandroid/AMS_AS5048B

Hope this helps

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.