Running this code with an RXB6 receiver I can successfully capture the binary data and decode the data (manually). What I am trying to accomplish is to take the binary data that I currently am receiving and pull specific bytes from the binary string, then create variables for each weather feature, then calculate it from BIN to DEC. If I could get it to this stage I would then be able to merge it into my current self-watering garden project and use the values for calculations.
RF Message 1
Example: BLUE is Currently Humidity, Red Temperature
00011100,11101110,01111000,00000000,00000110,00111010,10111110
RF Message 2
Example: Green Wind Direction and Pink Rain Bucket, Wind Speed is in there somewhere also.
00011100,11101110,01111000,00000000,00000110,10110001,11000000
If someone could help me, it would be greatly appreciated.
Paul_KD7HB:
I love it when self described newbies jump right into working with binary data. Please tell me the commas are not part of the"binary " data.
Paul
Thanks, Paul_KD7HB for proving that there is always a person like you on these forums. Oh, mighty master of code writing, I didn't see you ask and or provide anything useful that would help me so please don't comment anymore if you don't know. I spent a number of hours (days) doing my time, researching all over the internet. Trying to self-teach myself through my issue but got nowhere. Believe me, not, coming here and asking for help was the last thing I wanted to do.
Paul_KD7HB:
Here is help. The temperature appears to be a 16 bit integer, not two 8 bit bytes. Could all the values be 16 bit integers?
Paul
Hey Paul,
Sorry, frustrated. Trying my best here.
Below is a screencap that shows the RF protocol for my weather station (AcuRite VN1TX). Not sure about the 16-bit integers. It looks like a total of 8bytes sent between the 2 messages.
I removed the "," for you now. The code had them in there to separate out the different bytes.
Idahowalker:
Looking at the Weather Sensor RF Protocol seems to be a guide for message parsing. Quite doable.
After looking at the link you, OP, provided, what's the problem you are having?
Post the code you have wrote in code tags, post what it is supposed to do and what it does.
Study up on parsing comma delimited data.
Thanks for the reply.
I tried posting my code but it exceeds the 9000 character limit for this site. The link I posted takes you directly to the code I'm using. The code is doing everything I need regarding sniffing the RF data and outputting it to serial. I would like to use that data in my garden project and need to mask parts of the 32 bit (64 bit total) binary string. Once I get these bits, I would then convert them to decimal and send to my Blynk project.
Looking more into the code I'm currently using I see a part where the temperature data is being extracted from the binary data and converted to decimal, just as I would like it to do. The problem is, it's for another weather station transmitter so the data isn't exactly lining up with mine. If I could understand it a little more I might be able to figure my issue out on my own which would be great.
Could someone just read over the code below and try breaking it down for me? It would be greatly appreciated.
unsigned int startIndex, stopIndex, ringIndex;
unsigned long temperature = 0;
bool fail = false;
// extract temperature value
unsigned long temp = 0;
fail = false;
// most significant 4 bits
startIndex = (dataIndex + (4*8+4)*2) % RING_BUFFER_SIZE;
stopIndex = (dataIndex + (4*8+8)*2) % RING_BUFFER_SIZE;
for( int i = startIndex; i != stopIndex; i = (i+2)%RING_BUFFER_SIZE )
{
int bit = convertTimingToBit(pulseDurations[i], pulseDurations[(i+1)%RING_BUFFER_SIZE]);
temp = (temp<<1) + bit;
if( bit < 0 ) fail = true;
}
// least significant 7 bits
startIndex = (dataIndex + (5*8+1)*2) % RING_BUFFER_SIZE;
stopIndex = (dataIndex + (5*8+8)*2) % RING_BUFFER_SIZE;
for( int i=startIndex; i!=stopIndex; i=(i+2)%RING_BUFFER_SIZE )
{
int bit = convertTimingToBit( pulseDurations[i%RING_BUFFER_SIZE],
pulseDurations[(i+1)%RING_BUFFER_SIZE] );
temp = ( temp << 1 ) + bit; // shift and insert next bit
if( bit < 0 ) fail = true;
}
if( fail )
{
Serial.println("Decoding error.");
}
else
{
Serial.print((int)((temp-1024)+tempOffset10th+0.5)); // round to the nearest 10th degree integer
Serial.print(",");
Serial.print((int)(((temp-1024)+tempOffset10th+0.5)*9/5+320)); // convert to F
Serial.print(",");
Serial.print( millis() );
Serial.println();
Example output from the older weather transmitter and the one that does work with the above code. (Model 00592TXR, Acurite temp and humidity only)
BLUE = Humidty
RED = Temp
10011100,11010010,01000100,00011011,00001001,01000010,00011000,194,670,723179