GPS compass/heading for "apparent wind" direction?

Requests for future functionality

Moderator: Mattk

Post Reply
mikeo
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: Thu Jan 07, 2016 11:03 pm

GPS compass/heading for "apparent wind" direction?

Post by mikeo »

First, let me start with the statement that I'm a total "noob" here, so if this is answered/documented somewhere please send me the memo and I'll go back and hide under my rock.

Here's the summary statement:
I'd like to create a virtual sensor from my existing wind vane & anemometer to report "apparent wind direction".

I've seen the documentation and I'm fairly sure I can write the code to accomplish this, but I'm not sure how to get the GPS compass (heading) data in to meteohub.

Here's the long version of why I want to do this:
I have a boat that is moored in a single-point rotating configuration; The boat's bow is tied to a mooring bouy and it rotates depending on the wind direction. The boat becomes a giant wind vane, because the boat rotates I have no way to align a wind vane to North and have it report with any accuracy to meteohub. I'd like to combine input from a GPS with the wind vane & anemometer data so I can see an accurate report on wind direction.

The *much* easier way to solve this problem would be to find a wind vane that contains an electronic compass and reports apparent wind direction instead of relative wind direction. I haven't been able to find such a windvane, but if you know of one please let me know!

Can anyone suggest a way that I could input GPS data in to meteohub to accomplish this?

netsigi
Senior Boarder
Senior Boarder
Posts: 74
Joined: Wed Aug 05, 2009 7:27 pm

Re: GPS compass/heading for "apparent wind" direction?

Post by netsigi »

GPS is IMHO not usable here. I have a big wind vane where i added a solar powered arduino and a electronic compass.
Something like here: http://www.instructables.com/id/Arduino ... -2-displa/
LowPower, accurate, cheap....

mikeo
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: Thu Jan 07, 2016 11:03 pm

Re: GPS compass/heading for "apparent wind" direction?

Post by mikeo »

@netsigi I agree in principle, but many GPS units have "bearing" as well as "heading". The difference being heading tells you what direction you're looking (relative to North), and heading tells you where you're going... If the GPS has a heading function, then it IS a good candidate. In my situation the weather station is remote, on a boat, and I have to use a MiFi for data transfer and the MiFi has a GPS built in to it. Further research has shown that the GPS does NOT include heading, so I'm back to something like what you suggest.

Since I've decided to use a Raspberry Pi for MeteoHub, I'll take advantage of the I2C bus and attach a magnetometer to get the data I need.

Thanks for the feedback, it appears that I came to the same conclusion you suggested, it just took me a while to figure it out.

netsigi
Senior Boarder
Senior Boarder
Posts: 74
Joined: Wed Aug 05, 2009 7:27 pm

Re: GPS compass/heading for "apparent wind" direction?

Post by netsigi »

mikeo wrote:I agree in principle, but many GPS units have "bearing" as well as "heading".
Yes, i know what this is. But many (most) GPS calculate heading (and bearing) out of movement. A fixed boat turning into wind is way too slow for this. A good gps-module with magnetic compass costs around 10 times more than the compass module itself...
If you have Mifi, then i think you get a solar powered compass for maybe €40 (ESP8266/HMC5883L based). Raspberry will empty your battery quick.
Ok, i do not know your boat ;-)

mikeo
Fresh Boarder
Fresh Boarder
Posts: 12
Joined: Thu Jan 07, 2016 11:03 pm

Re: GPS compass/heading for "apparent wind" direction?

Post by mikeo »

I bought a MPU-6050 off ebay for $3 (USD) ~€1.5 to hook to the Pi; I should have it tomorrow. I checked the Pi and it's drawing a constant .4A @ 5VDC = 2W. I've got a camera and MiFi on the boat that are drawing more than that and the solar system is able to keep the battery system charged. I'm not worried about power, I've got multiple 300Ah batteries on board; It's a big boat...

Now I just need to find someone who knows awk better than I do. I know how to write the GPS heading to a file, but now I need to read that in to a virtual sensor. I'm using Boris' example code:
awk ' { printf "%d %d %d %d", ($3 + 180)%360, $4, $5, $6 }'

but I need to figure out how to replace ($3 + 180)%360 with "cat /var/local/heading"

or more accurately, replace ($3 -- 180)%360 with "cat /var/local/heading"

I really don't want to do this in Perl, but I'm thinking I might have to.

Post Reply