Author Topic: Emulating the ISS to add Solar and UV sensors to a Vue Console  (Read 19016 times)

0 Members and 1 Guest are viewing this topic.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #50 on: January 23, 2015, 06:33:06 PM »
IIRC 2555 was a good guess based on previous timings. There's like 200 ms of tolerance in that code so it's catching what it needs to. No newer public code from DeKay that that I know of. I added a few things to it but haven't published it yet. I want to make the RFM69 transmitter robust enough first.

A hint: you're using the Arduino millis(). It's affected by interrupts and is generally considered imprecise. Not ideal for these precise timings. I'd suggest using micros() which is always correct ad is a lot more precise, down to a few micros. Measuring with millis() can also lead to false results.

Offline Scott216

  • Senior Member
  • **
  • Posts: 62
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #51 on: January 23, 2015, 06:44:11 PM »
I added a few things to it but haven't published it yet. I want to make the RFM69 transmitter robust enough first.
I look forward to seeing your changes once you get them finalized.

Quote
A hint: you're using the Arduino millis(). It's affected by interrupts and is generally considered imprecise. Not ideal for these precise timings. I'd suggest using micros() which is always correct ad is a lot more precise, down to a few micros. Measuring with millis() can also lead to false results.
Thanks!  I'll change my sketch to use micros().


Offline DeKay

  • Forecaster
  • *****
  • Posts: 399
    • Mad Scientist Labs
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #52 on: January 23, 2015, 07:40:45 PM »
Yes. Or as I've written here multiple times too, just use the formula for the packet interval as T=(41+ID)/16 seconds, where ID is the station ID from 0 to 7.
I wonder where dekay gets 2555 mS. 

dekay didn't get that number.  kobuki did   :-)

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #53 on: January 24, 2015, 02:49:18 AM »

Uksa007:

Try this formula:


word rawDirection = (radio.DATA[2] << 2) | (radio.DATA[4] & 0x02)  // Using DeKay's numbering scheme
float windDirection = rawDirection * .3515625;

if (windDirection > 360.0 || windDirection == 0.0)
    windDirection = 360.0;


Are you sure that formulae works? It seems to make fairly large changes to the values?

Wind data byte2 and 4: 5C81
rawDirection : 368
windDirection: 129 I' m guessing this is in Degrees?

Old Formulae used for VP2 and 5C = 135 Degrees?

I'm also trying to put it back into byte 2 and 4, should I use the old formulae to convert this back? Hmm old way doesn't seem to take into account Byte 4?
PS Code is a WIP and I don't have quite right yet.

Code: [Select]
     Serial.print("Wind data byte2 and 4: ");
     printHex(RadioDATA[2]);
     printHex(RadioDATA[4]);
     Serial.println(); 
     word rawDirection = (RadioDATA[2] << 2) | (RadioDATA[4] & 0x02);  // Using DeKay's numbering scheme
     Serial.print("rawDirection : ");
     Serial.println(rawDirection);
     word windDirection = rawDirection * 0.3515625;
     Serial.print("windDirection: ");
     Serial.println(windDirection);
     RadioDATA[2] = (windDirection >> 2);
     RadioDATA[4] = (RadioDATA[4] | (lowByte(windDirection & 0x02)));
« Last Edit: January 24, 2015, 03:35:37 AM by Uksa007 »
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline rdsman

  • Senior Contributor
  • ****
  • Posts: 249
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #54 on: January 24, 2015, 07:53:44 AM »
Quote
Are you sure that formulae works? It seems to make fairly large changes to the values?

Wind data byte2 and 4: 5C81
rawDirection : 368
windDirection: 129 I' m guessing this is in Degrees?


You said that you had a Vue console.  Use the STRMON command to get raw bytes out of it and compare what the Vue displays with what you calculate with either formula...........

Ray

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #55 on: January 24, 2015, 09:19:53 AM »
Hi rdsman,

Say I do that, and the formelua you provided matches the vue console, what then?
eg how would I convert it into VP2 data for byte 2 and 4? do I use the old formula reversed?

Code: [Select]
   (9 + RadioDATA[2] * 342.0f / 255.0f);

Thanks for your help.
« Last Edit: January 24, 2015, 09:32:00 AM by Uksa007 »
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #56 on: January 24, 2015, 09:35:05 AM »
I'd suggest reading all threads related to dissecting the radio protocols and the reverse engineering topics. This formula is for the VP2 wind vane that has a dead zone since it uses a pot for direction sensing. The Vue on the other hand uses a hall sensor to sense a precise rotation angle, no dead zone and thus another formula is required. You're constantly asking question that have been answered elsewhere. So if you receive Vue direction data and try to act as a VP2 ISS by relaying, you need to translate between the numeric representations of the vane angle.
« Last Edit: January 24, 2015, 09:37:29 AM by kobuki »

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #57 on: January 24, 2015, 10:53:17 AM »
I'd suggest reading all threads related to dissecting the radio protocols and the reverse engineering topics.

I have spent a lot of time reading posts.
I could spend all my time trying to find and read every post, or I could spend my time actually doing something.

I apologise if some of questions have already been answered somewhere.
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #58 on: January 24, 2015, 10:59:16 AM »

You said that you had a Vue console.  Use the STRMON command to get raw bytes out of it and compare what the Vue displays with what you calculate with either formula...........

OK now I'm more confused that ever..lol

I logged some packets from my Vue as you suggested.

Take this packet
0x80, 0x00, 0x36, 0x2d, 0x6b, 0x00, 0xcc, 0x17

At the time the Vue console was reading
TEMP 22.6
Wind 0
Direction 257deg

This was the output I got:
Wind Speed: 0
Wind Direction: 84.49  --This is using the VP2 Formula
Battery status: 0
Outside Temp: 22.59
rawDirection : 218
Vue Wind Direction: 76.64 -- This is using your Formula

Both are wayyyyyyy off... I must be missing something here!

VP2 Code
Code: [Select]
   Serial.print("Wind Direction: ");
   Serial.println((9 + RadioDATA[2]) * 342.0f / 255.0f);


rdsmand Code
Code: [Select]
     word rawDirection = ((RadioDATA[2] << 2) | (RadioDATA[4] & 0x02));  // Using DeKay's numbering scheme
     Serial.print("rawDirection : ");
     Serial.println(rawDirection);
     float windDirection = rawDirection * 0.3515625;
     if (windDirection > 360.0 || windDirection == 0.0)
       windDirection = 360.0;
     Serial.print("Vue Wind Direction: ");
     Serial.println(windDirection); 
« Last Edit: January 24, 2015, 11:09:18 AM by Uksa007 »
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #59 on: January 24, 2015, 05:12:56 PM »
I have spent a lot of time reading posts.
I could spend all my time trying to find and read every post, or I could spend my time actually doing something.

I apologise if some of questions have already been answered somewhere.

No need to apologise. But without research there's no result... It's true the info is scattered around and sometimes a bit hard to find. But it's there. We don't know everything from memory either, and don't expect us to find the existing threads or information you need for you. But I think you're progressing nicely.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #60 on: January 24, 2015, 05:41:15 PM »
About the wind vane direction 2 posts earlier: the contents of the packets don't necessarily match exactly the direction displayed on the console. It's necessarily delayed a bit and it's probably using a running average or some other simple algorithm calculated on a few values to smoothen out the natural randomness of the direction (I think rdsman has more info on that). I think it's best to do such a test under calm conditions or lull.

Offline DeKay

  • Forecaster
  • *****
  • Posts: 399
    • Mad Scientist Labs
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #61 on: January 24, 2015, 06:34:29 PM »
It's true the info is scattered around and sometimes a bit hard to find. But it's there. We don't know everything from memory either, and don't expect us to find the existing threads or information you need for you.

Definitely.  And today I took a shot at trying to fix that.

Offline rdsman

  • Senior Contributor
  • ****
  • Posts: 249
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #62 on: January 24, 2015, 06:49:37 PM »
Quote

Take this packet
0x80, 0x00, 0x36, 0x2d, 0x6b, 0x00, 0xcc, 0x17


If I turn my wind vane until I get a wind direction 0f 257, I get 0xB6. 

Code: [Select]

50  00  B6  A8  61  00  87  B8 
80  00  B6  2E  B9  00  36  78 
90  00  B6  00  01  00  26  9F 
E0  00  B6  85  01  00  B3  A9 
50  00  B6  B2  61  00  03  1A 


My ISS is in my workshop, not outside blowing in the breeze.  I can turn the wind vane and lock it in place.  The display changes from one direction to another instantly

 
Ray

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #63 on: January 24, 2015, 06:59:23 PM »
Piecing it together:

windDirection = ( (RadioDATA[2] << 2) | (RadioDATA[4] & 0x02) ) * 0.3515625 = (182 * 4 + 0) * 0.3515625 = 255.94°

It's the same for all 5 packets you pasted. Rounded it's 256 and it's pretty close but not exact. I remember rdsman having the same problem. Try to look for his tread or he might chime in when he's around.

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #64 on: January 24, 2015, 07:24:25 PM »
Aha the penny has Dropped!!!!

I'm in the Southern Hemisphere, so I had to mount my ISS so the solar cell points North.
So in the console I had to offset my wind by 180 degrees!

76.64 + 180 = 256.64

Mystery solved!!!!!
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #65 on: January 24, 2015, 07:37:29 PM »
LOL, great it's solved. It seems few people visit these forums from the other side of the Earth.

But could I see how you arrived at 256.64? I've calculated it as you see and it has come out a little less, 255.94. Either of us is doing something wrong.

EDIT: never mind. Your previous example had the extra bit set at byte offset 4. If I count that in, it's coming out OK.
« Last Edit: January 24, 2015, 07:42:00 PM by kobuki »

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #66 on: January 24, 2015, 07:58:08 PM »
I just let the formula work it out

Take this packet
0x80, 0x00, 0x36, 0x2d, 0x6b, 0x00, 0xcc, 0x17

Eg

windDirection = ( (RadioDATA[2] << 2) | (RadioDATA[4] & 0x02) ) * 0.3515625
                Byte           (36 << 2) OR (6b AND 0x02) * 0.3515625
                Decimal      (216) OR (2) * 0.3515625 = 76.64°


« Last Edit: January 24, 2015, 08:10:56 PM by Uksa007 »
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #67 on: January 24, 2015, 08:37:47 PM »
Ok now to convert the Vue Wind direction in degrees to VP2 data for byte 2. 

windDirection = (9 + RadioDATA[2] * 342.0f / 255.0f);

So we know windDirection and we need  RadioDATA[2] so:

RadioDATA[2] = (((windDirection * 255.0f) / 342.0f) - 9)

So when I convert it to VP2 format in hex (in byte2) and then run the VP2 formula  to convert it to degrees I get the following?

Vue Wind Direction: 76.64
VP2 Wind Direction: 76.45

Do we call this close enough?
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #68 on: January 24, 2015, 09:08:12 PM »
I'd probably look at converting values at the extremes and check with the other 3 main directions and a few random ones. You might need to adjust the values with a magical constant you work out. Take note that the VP2 vane has a dead zone and you need to account for that. It means that near 0/360 there are about 20 values missing - you cannot convert 355° directly, for example. Sucks, BTW.

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #69 on: January 26, 2015, 06:21:09 AM »
Take note that the VP2 vane has a dead zone and you need to account for that. It means that near 0/360 there are about 20 values missing - you cannot convert 355° directly, for example. Sucks, BTW.

Yea was aware of that, I have some code that takes 8 to 352 (inclusive) and sets the wind to 360.

Ok so I reckon I have sorted out the wind direction issue.

Hope that my module arrives on Wednesday, where I can test it out!
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #70 on: January 29, 2015, 08:02:38 PM »
My ISS is in my workshop, not outside blowing in the breeze.  I can turn the wind vane and lock it in place.  The display changes from one direction to another instantly

Ok so I have received the Anaren module and connected it up.

I'm running your example program "Davis_Receiver" I seem to get a few packets, normally like three, and then it stops, sometimes I might get a few more some 60 seconds later, more than likely I don't get any more.

With a RSSI of around -60 is this ok?
Frequency error of 15 is this normal?

Seems to me that it is loosing connection, either RF or frequency hopping.
Any Suggestions?

Here is what I received.

00  50  03  60  FF  71  06  53  59  FF  FF  -64  15 
01  80  03  5E  33  1B  0A  0F  A5  FF  FF  -60  15 
02  70  03  6A  B5  C1  8F  CA  3A  FF  FF  -59  15 
03  E0  03  61  10  03  0C  9D  30  FF  FF  -58  15 
04  50  03  62  FF  71  0A  7F  BD  FF  FF  -60  15 
05  80  04  62  33  1B  03  9A  83  FF  FF  -63  15 
« Last Edit: January 29, 2015, 08:23:48 PM by Uksa007 »
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #71 on: January 30, 2015, 05:07:49 AM »
IIRC you're in Australia. Are you using the freq. table for your country? Or at least one that matches your ISS?

Offline rdsman

  • Senior Contributor
  • ****
  • Posts: 249
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #72 on: January 30, 2015, 06:53:39 AM »
If you have a serial or usb data logger, set up your favorite method of communicating with it.  Then type the following:

TEST<enter>

You should get:

TEST

sent back to you if you are set correctly.

Then type:

TST 1<enter>

You should get:

OK

Then type:

BAND<enter>

You should get some number, if its 1 then you are set for USA hopping.  If you get some other number, you have more work to do.

Type:

TST 0<enter>

This will get you out of all of this.

Ray

Offline Uksa007

  • Need a Logger board?
  • Contributor
  • ***
  • Posts: 106
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #73 on: January 30, 2015, 07:11:46 AM »

BAND<enter>

You should get some number, if its 1 then you are set for USA hopping.  If you get some other number, you have more work to do.


Ok I get 00

I bought it from the USA model 6250M (metric)
00 is not USA frequencies?

Ok since my last email I seem to be having more success, I left it go for a few hours and it seems to have come good? Weird!
Maybe there was some interference around, Vue console was working ok though...

Just trying to work through the issues, e.g. when I loose a packet, do I need to manually increment the Radio.Hop, or is it just a packet counter? Seems to get upset and looses connection for about 2 mins when it misses a packet. any advice on how to deal with this?
« Last Edit: January 30, 2015, 07:14:54 AM by Uksa007 »
Need a green dot compatible Data Logger Board for your Davis VP, VP2, Vue or Weather Envoy?
USB Version uses genuine FTDI USB chip, includes 2m USB Cable $79.99 USD order here
RS232 Version uses genuine MAX3221E chip, includes 1.5m DB9 Cable  $89.99 USD order here
See here for more info.

Offline kobuki

  • Forecaster
  • *****
  • Posts: 838
Re: Emulating the ISS to add Solar and UV sensors to a Vue Console
« Reply #74 on: January 30, 2015, 07:17:09 AM »
Yes, first check what I suggested and rdsman helped with. You must use the correct hopping sequence. From memory, the US and AU sequences do not match.

 

anything