Help with 433mhz receiver

Hi, for my first arduino project I am trying to do something like http://www.practicalarduino.com/projects/weather-station-receiver but with a different weather station I have. At the moment I am just trying to get the 433mhz receiver to work.

I have used the code from that page and bought a 433mhz receiver and connected it up in the same way as the schematic in the above link:

I have commented out all the code in the ISR(TIMER1_CAPT_vect) function and just made the LED on pin 13 blink (I put pinMode(13, OUTPUT) in Init_Ports()) when that interrupt happens. I just want to see when I receive some data and not do any decoding yet. My problem is that the LED is blinking constantly (it looks dim) so it looks like I'm receiving 010101010... constantly. I have tested the exact same code with a button connected to input 8 instead of the 433mhz receiver and the LED flashes properly when the button is pressed/released - so it seems the code/interrupt is working properly.

I then had a good look at the receiver and found it has RXN3-b printed on it, so I think it's this http://www.spiriton.com.tw/download/RXN3-b-s.pdf rather than the rxb1 (data sheet) which I thought I had bought. Comparing those two datasheets it looks like there might be a difference in the output current (but this is the first time I'm looking at datasheets so am not too sure). Does this make a difference for the schematic? If not, where else might I have gone wrong?

(yes I have turned off the weather station transmitter just to make sure it's not sending 010101010... when idle :))

These types of receivers are extremely simple amplitude modulated types which produce "data" all the time
on their output data port,even with no signal being received.
The "data" is simply the digital component of the noise input when there is no Rf signal present.
You have to use them with some kind of data decoding logic to separate the real data from the noise.
Most weather station sensors send a long sequence of alternating bits at the start of the transmission
to allow the receivers AGC (auto gain control) , to adjust , and they also usually use some kind of Manchester coding
to ensure a 50% logic level.

This behaviour is common to most RF (and IR) links - in the absence of a transmission the receiver increases its sensitivity until the noise floor is detected. This is why there are preambles and CRCs on radio packets, so that the receiver can filter out the noise efficiently. Preambles are usually a burst of 010101010101 at a known rate - the longer the preamble the more reliable the recognition of packet v. non-packet.

One common technique used in receivers is a clock-detection circuit, using the transitions to try and recover the transmission bit clock - such a circuit (or software) can also discriminate between signal and noise. Using manchester encoding and variants allow particularly simple clock recovery as a valid transmission has transitions at every clock (as well as some in-between clocks).

Thanks guys that's been very helpful. I've figured out when the transmitter is sending packets of data now, every 8 seconds 7 times when the transmitter is first powered up then every 48 seconds after that. Now I just have to fiddle with filtering out what is real data and what isn't. I am receiving a bunch of 10101010 at the beginning of the burst of data but what I get after that doesn't seem to make any sense yet, I think I have to play with the "period width filter" until I get what looks like sensible data - and then figure out what it means. Cheers.

What sort of weather station sensor are you using.
The trick with these things is figuring out where the data starts and what it means.
They generally also send some kind of sync bytes and some kind of CRC.
The sync bytes come straight after the flag sequence, and then usually the data, followed by the CRC.
An easy way to look at the data is to download a PC oscilloscope program which allows you to see
whats coming out of the receivers data port using your PC sound card as an input.

Model is "WS1150" - a very cheap one I bought off ebay a year or two ago. The outdoor/transmitter part is only humidity/temp so it's not sending heaps of data like some more expensive ones with more sensors.

That trick with the sound card sounds handy, I'll look up how to hook that up. I've been trying different things for a couple of hours now but haven't really gotten anywhere besides figuring out when data is transmitted.

Cheers.

Ok so here are two captures just using sound recording software (audacity), I couldn't figure out how to make xoscope do what I want, not sure that it even does what I want. As you can see, the first one happened at around 1:00, the next at 1:48, so 48 second intervals as I mentioned previously.

First:

Second, 48 seconds later, annotated with what I think it's doing...

So it sort of looks like it is doing a bunch of 010101, then a bunch of 0s, then.... maybe some data?

sound card not up to this task I think! Your analysis seems sound though (no pun intended) - the sound card is heavily low-pass filtering the signal though, hence the big dip - that's obscuring things.

Can you save just the section you show and attach it to a post. The big dip could be when the transmission has finished and the AGC is ramping up.

The big dip is because the signal is low-pass filtered - this is the receiver output logic level being sampled, remember - it should be a rectangular waveform without the distortion.

When using the oscilloscope idea to capture the data you need to know exactly when the sensor is transmitting
as the transmissions are very short, usually 100 milliseconds or less.
This means that you will need some kind of way of determining electrically when the sensor is sending
and then gating the data from the receiver to the oscilloscope.
Also, the data pin on the receiver is designed for driving a high impedance load so it needs to be connected
to something that wont load it , like a hi impedance cro probe.
You should be seeing on the oscilloscope a rectangular waveform toggling between 0V and Vcc, which will be there all the time.
Have a read of this

Whilst its not for your sensor, it will give you some understand of how these sensors work and how they transmit and what you should be looking for.

Thanks guys that's helpful again (though much of what you're saying is going over my head, I'm beginning to think this might be a bit of an ambitious first project, I'm a software engineer, never done this sort of thing before)

Anyway, I decided to make it print out data to serial and monitored what was coming in, using 300uS as a minimum period filter for the time that the ISR(TIMER1_CAPT_vect) interrupt was fired, so printed out 0 if it was low for 300uS or more and 1 if it was high for 300uS or more.

Each line here is a capture with the same data (55% humidity, 13.9 degrees C) sent by the transmitter (with a bit of noise on either end, just happened to be what I copied/pasted):

11111111111111111111111111111111111111111111111111111111111111111111111111111111111011011010101010010101001010101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000110101111011101111111101111101111001100110111011111111111111111011111111111011111011111111111111111111111101111101111111111111111111011111111111110111110111111111111111101
1111111111111111111111111111110111111111111111111111111111011111111111111111011111111101101101001001001010101010101010101010101010101010101010101010101010101010101010101010100000000000000000000000000000000000000000000000100000000000000001100001111111111011111111111111110011111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111110111
111111110101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000000000000000110101010011111111111111111111111111111111111111111111111111111011111011111111101111111111111101011111111111111111111110
1111111111111111110101011100111111111111010101101011011010101010101010101010101010101010101010101010101010101010101010101010100000000000000000000000000000000000000000000000000100010101100110111111011111110111110111111111111111111011111111111111111111111111111111110111111111111011111111110110111111111111111111111111111111111111111111111111111111001111111111111101111111

So each one has the 10101010.. then a bunch of 0s then.. something I can't make much of. The noise is mostly 1s but the section after the 0s has a few 0s, I'm not sure if that's noise or data, maybe because of the AGC I'm getting more 0s there than in the normal noise while it's adjusting - but if so, where's the data part! Is it possible that 300uS is too long and I should be filtering from a lower value?

ah-ha! After reading that oregonscientific pdf I realised I wasn't quite going far enough and that I needed to look at the timing of the highs/lows in the transmission period. I now know that the highs in the high/low period are either very close to 372msec or 130msec (all low periods are about 255msec). So, on to the next step of decoding the long/short highs.

Figured it out :smiley: After the above post I just captured a bunch of transmissions and recorded the long/short highs. Guessed that a long high = 1 and short high = 0. Found that there are 12 bits that equal the temperature and 8 bits that equal the humidity, bingo! Just need to figure out what the other bits are now, I'm guessing perhaps a station id (I think this changes when I replace the batteries in the transmitter) and a checksum. Will write up the protocol when I've got it all sorted.

If your weather station caters for more than one temperature sensor, there will be some kind of sensor ID code to differentiate between them.
Its also fairly common for there to be some kind of logic to differentiate between sets of sensors, to prevent the problem of you having a weather station and a nearby neighbour also having one and the sensors interfering with each other.
Reverse engineering wireless weather stations sounds simple, but its quite often fairly complicated.
Im currently trying to do the reverse of what you are doing, making my own sensors for an existing weather station.

Ok I'm having trouble trying figure out how to determine where the transmission starts. Here are a bunch of captured transmissions, using long high = 1 and short high = 0. The blue columns add up to the temperature (x10) and the red columns add up to humidity (so first row, temp = 14.6 degrees, humidity = 51%). I'm sure I've got that right because I've checked with different figures over a day now and it's always correct.

The second block was a) when I brought the transmitter inside and b) when I took the battery out/in to see what would change.

111111111111 1100 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0011[/color] 1010 0001-
        1111 1000 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0011[/color] 1010 0001---
  1111111111 0100 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0011[/color] 1010 0001----
 11111111111 1100 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0011[/color] 1010 0001------
        1111 1010 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0011[/color] 1010 0001---
     1111111 0100 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0011[/color] 1010 0001---
          11 1000 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0100[/color] 0011 0110-----
         111 0100 1110 0101 [color=blue]0000 1001 0010[/color] [color=red]0011 0100[/color] 0011 0110----
      111111 0100 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011---
         111 1100 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011------
       11111 1010 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011--
  1111111111 0100 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011--
        1111 1100 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011--
          11 0100 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011------
         111 1010 1110 0101 [color=blue]0000 1001 0001[/color] [color=red]0011 0100[/color] 0001 1011----

111111111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0100[/color] 0110 1100----
     1111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0100[/color] 0110 1100----
       11111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0100[/color] 0110 1100---
    11111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0100[/color] 0110 1100-
      111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0101[/color] 0101 1101---------
     1111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0101[/color] 0101 1101----
      111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0101[/color] 0101 1101-
     1111111 0100 0111 0110 [color=blue]0000 1001 0010[/color] [color=red]0011 0101[/color] 0101 1101----
    11111111 0100 0111 0110 [color=blue]0000 1001 0100[/color] [color=red]0011 0101[/color] 0000 0111-----
      111111 0100 0111 0110 [color=blue]0000 1001 0100[/color] [color=red]0011 0101[/color] 0000 0111------
  1111111111 0100 0111 0110 [color=blue]0000 1001 0100[/color] [color=red]0011 0101[/color] 0000 0111-----
     1111111 0100 0111 0110 [color=blue]0000 1001 0100[/color] [color=red]0011 0101[/color] 0000 0111-----
        1111 0100 0111 0110 [color=blue]0000 1001 0101[/color] [color=red]0011 0110[/color] 1010 0000-------
     1111111 0100 0111 0110 [color=blue]0000 1001 0101[/color] [color=red]0011 0110[/color] 1010 0000-----
  1111111111 0100 0111 0110 [color=blue]0000 1001 1000[/color] [color=red]0011 0111[/color] 1101 0001------
        1111 0100 0111 0110 [color=blue]0000 1010 1000[/color] [color=red]0011 0111[/color] 0110 0011------
         111 0100 0111 0110 [color=blue]0000 1010 1001[/color] [color=red]0011 0111[/color] 1001 0111----
         111 1100 0111 0110 [color=blue]0000 1010 1010[/color] [color=red]0011 0111[/color] 1011 1010-
          11 0100 0111 0110 [color=blue]0000 1010 1010[/color] [color=red]0011 0111[/color] 1011 1010--
1111111 1111 0100 0111 0110 [color=blue]0000 1010 1010[/color] [color=red]0011 0111[/color] 1011 1010---

So I can't make out what the first 4 bits are, they change a fair bit especially when the transmitter was outside (maybe took longer for the AGC to do something because of a weaker signal so those get mixed up?). The next 8 seem to be the station id as those are what changed when I took the batteries out. The last 8 bits are probably a checksum? But I'm not too familiar with different checksum techniques, I've tried a couple of things but haven't been able to work that out.

At least I know I'm on the right track because I've got the temp/humidity! But my main problem now is determining where the transmission starts. It doesn't seem to send any sort of start sequence (the preceding 1s are noise/indistinguishable from noise).

Agrajag:
using long high = 1 and short high = 0

Oops sorry other way around, long high = 0, short high = 1.

There should be a a sign bit for the temperature to indicate whether its above or below 0C.
Sometimes also, there is a battery sense bit , to allow the indoor unit to indicate when a sensors battery needs changing.

mauried:
There should be a a sign bit for the temperature to indicate whether its above or below 0C.

Heh this might be a bit hard for me to find, it very rarely gets to below 0 where I am. I suppose I could put it in my freezer for a short time.. not sure if it would be happy with that though

mauried:
Sometimes also, there is a battery sense bit , to allow the indoor unit to indicate when a sensors battery needs changing.

I don't think my weather station has this feature - the indoor part doesn't display that anyway.

Finding out how to determine where the start of the transmission is doing my head in at the moment, all other protocols look like they do something like send a few long highs (0s) to start off with but this one doesn't seem to. :~

Does the Wireless Station support more than 1 wireless sensor.
Does it support other types of sensors like rain or wind.
If so, then there have to be fields in the data transmission to identify sensor ID and sensor type.
Usually at the start, there is a long row of 1-0-1-0-1-0 transitions to
a/ Give the receivers AGC time to adjust to the incoming RF signal.
b/ Provide the receivers data slicer with the halfway point of the 1-0 transitions.

Its normal for the next data field to be static as an indication of the start of the valid data, and its normally a
value with an equal number of 1s and 0s .
You sometimes cant figure out what everything means , as the manufacturers allow room for expansion and put data fields
in the transmissions that currently have no use.

Ultimately, you may have to test your decoding skills, by making yourself a small transmitter using the companion 433 Mhz transmitter module
and hooking it up to a microcontroller programmed to send a data stream , and see if the weather console responds to your transmissions.