Go Down

Topic: Arduino and RF 433Mhz receiver (Read 7243 times) previous topic - next topic

Hello!

I'm trying to use an Arduino Mega 2560 with a RF 433Mhz receiver and VirtualWire but I have problems.
I have a working leak detection wireless sensor (433,92 Mhz). The sensor is working as I've sniffed the signal both with a soundcard and a DVB-T receiver.

When trying to use the Virtual Wire receiver example, I get nothing in the serial interface. The 433Mhz receiver is this one: http://hackspark.fr/en/433mhz-rf-link-kit.html and it's connected to Arduino's PIN 11.

I'm using the IDE v 1.0 and the receiver code is this:
Code: [Select]
#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600); // Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000); // Bits per sec

    vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
int i;

        digitalWrite(13, true); // Flash a light to show received good message
// Message with a good checksum received, dump it.
Serial.print("Got: ");

for (i = 0; i < buflen; i++)
{
    Serial.print(buf[i], HEX);
    Serial.print(" ");
}
Serial.println("");
        digitalWrite(13, false);
    }
}


What could I try in order to get the RAW data from the sensor?

Thanks in advance
http://www.ciproconsulting.it

CrossRoads

If the transmitter is not sending data using Virtualwire, then the data won't be encoded and will not pass the incoming data checks.
How do you know data rate is being used?
What formatting is being used?
I think you might have to start with just monitoring the data out pin on the receiver and see if anything recognizable is coming in at all.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#2
Jul 24, 2013, 03:57 pm Last Edit: Jul 24, 2013, 04:02 pm by H2SO4 Reason: 1
Thanks for your answer!

I already sniffed the signal using a soundcard. The leak sensor sends the same sequence, repeated 15 times.
I could measure the lenght of the pulses but I don't know how to make Arduino act when it receives that sequence.

Any hint on what to use?
http://www.ciproconsulting.it

CrossRoads

Do you have any timing information? Perhaps the data rata can be inferred from the timing, and then you can proceed from there.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#4
Jul 24, 2013, 04:20 pm Last Edit: Jul 24, 2013, 04:25 pm by H2SO4 Reason: 1
I could calculate the timings as I have a .WAV file as result of sniffing what the sensor is transmiting.
The sample rate of the file is 48000Hz; I could count the sample points for every pulse and divide by 48000 in order to get the timing in microseconds.

For transmitting the same signal it would be then very easy using the delay() function. It's just I only need to receive and, in case the sensor detects a leak, Arduino should be able to execute a defined action (email, SMS ... etc.)

The captured file is here: http://www.ciproconsulting.it/pdf/Soundcard_TEST.wav (used Audacity to record it)
http://www.ciproconsulting.it

CrossRoads

See the first couple of pictures here
http://www.gammon.com.au/forum/?id=10894
Look at the signal in oscilloscope mode (does Audacity let you look at the file like that?) zoomed in enough that you can determine where the 0s & 1s are that make up the bytes. If a data format of 8N1 is being used, you need to discern 10 bits/byte: 0 for start bit, 8 high/low data bits, 1 for a stop bit.
A sampling rate of 48000Hz may or may not be fast enough. If the data rate is 4800, then you have 10 samples per bit, might be discernible. If the datarate is 9600, then you only have 5 samples per bit and it could be harder.
On the other hand, you could just try different data rates with the serial port, and see if the hardware can sync up by itself:

in void setup():

Serial.begin(9600);

in void loop():

if (Serial.available()>0){
Serial.print(Serial.read(),HEX);  // or Serial.println, to get one character per line
}

Try 2400, 4800, 9600, 19200, see if anything recognizable comes out.
If not, you're stuck with trying to analyze the data.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

This is the begining of the wav file, magnified (not only the red circled zone but the other part too):

http://www.ciproconsulting.it

I can't figure which is "1" and which is "0":
http://www.ciproconsulting.it

roter45

i made a tutorial about this kits. It's post in my blog.

You should try first to connect the two arduinos trough wire using virtualwire. For more information see the blog, also for sending multiple variables using virtualwire

http://controlrobotics.rodrigomompo.com/
Visit my blog and leave some comments
controlrobotics.rodrigomompo.com

nightcrawler218


i made a tutorial about this kits. It's post in my blog.
You should try first to connect the two arduinos trough wire using virtualwire. For more information see the blog, also for sending multiple variables using virtualwire
http://controlrobotics.rodrigomompo.com/


Very very useful & detailed tutorial. Deepest gratitude for sharing this.
Cheers!
"Imagination is more important than knowledge."
-Einstein

Go Up