RF315 radio link - gibberish data

Hello all,

First, please be aware that I’m complete n00b when it comes to electronics (that’s why I choose Arduino) and also almost complete n00b when it comes to programming (did some asm on Atari 65XE, just a little bit of asm and C on PC in the old, DOS times). English is not my native language, so expect some mistakes…

Anyway, I’m trying to get seeedstudio RF315MHz http://www.seeedstudio.com/depot/315mhz-rf-link-kit-p-76.html kit to work on Arduino Mini (so Arduino should send and receive it’s own messages, or send with receiver wired directly to serial usb interface. At least that’s my plan).

I created simple sketch with LED connected to pin 13 and code looking like below:

int ledPIN= 13;
int outgoingPIN=11;
int incomingPIN=2;
volatile int LEDstate;

void setup()
{
  attachInterrupt(0, blink, CHANGE); 
  pinMode(ledPIN, OUTPUT); 
  pinMode(incomingPIN, INPUT);
}

void loop(){
    digitalWrite(outgoingPIN, LOW);
    delay(1000);
    digitalWrite(outgointPIN, HIGH);
    delay(500);
}

void blink()
{
  LEDstate = !LEDstate
  digitalWrite(ledPIN, LEDstate);
}

Receiver and transmitter are mounted on breadboard, around 100 milimeters apart. RF315 transmitter was connected to pin 11, receiver to pin 2, with function attached to interrupt looking for state change. BTW, when idle, receiver pin was always in HIGH state, is that correct behaviour? (Wikipedia claims that UART idle should be HIGH, so I guess it’s correct). This setup worked without problems, LED blinked as expected, so I moved to second stage…

I tried using NewSoftSerial library to create connection, with transmitter connected to Arduino and receiver connected to USB-TTL interface. Code looks like this:

#include <NewSoftSerial.h>

NewSoftSerial led(2,3);
int counter = 65;

void setup()
{
  led.begin(2400);
  delay(500);
}

void loop(){
  counter = 65;
  for (counter = 65; counter < 85; counter++); //this should start with letter a and go on
  {
     led.print(counter, BYTE);
     delay(1000);
  }
}

This caused of course lots of output in serial monitor, but it was almost all gibberish. Almost, because sometimes I could see what looked like series of letters I sent.

I’m puzzled. Seems that RF link works, but sending anything more than simple HIGH and LOW goes wrong. I have three theories:

  • there is something really important and needed for transmission to work, which I omitted
  • that’s how this simple link works, I’m just expecting too much
  • there is a lot of radio noise and my receiver is just getting them. Simple LED setup is getting it also, but long blinking times hides that.

Anyone tried using this RF link and succeeded? What did I wrong?

Regards
Kuba

I can't answer most of your questions, but I have used these devices, and I have one suggestion- try mikem's VirtualWire:

http://www.open.com.au/mikem/arduino/

It's designed for these type of devices. It is well documented and includes examples.

-transfinite

Thanks for posting about the VirtualWire library! I recently bought a 434MHz Rx/Tx pair from Sparkfun but couldn't get them to work. I tried using examples found on this forum and others through Google. The VirtualWire examples, on the other hand, worked straightaway.

Ver.

Thanks for the tip. I'll try to create loop connection, where Arduino will be sending and receiving data (thru VirtualWire) then putting it on serial monitor thru Serial library. Hope it makes sense :)

Kuba

Well, no progress with my project, because it seems that VirtualWire examples are not compiling properly. This is what I got trying to compile transmitter.pde:

In file included from /home/pooh/arduino-0012/hardware/cores/arduino/WProgram.h:4,

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:80: error: expected unqualified-id before 'int'

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:80: error: expected `)' before 'int'

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:80: error: expected `)' before 'int'

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:116: error: expected unqualified-id before 'int'

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:116: error: expected `)' before 'int'

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:116: error: expected `)' before 'int'

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:149: error: expected identifier before '(' token

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:149: error: expected `)' before '(' token

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:149: error: expected ',' or '...' before '(' token

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:149: error: expected initializer before ')' token

/usr/lib/gcc/avr/4.2.2/../../../../avr/include/stdlib.h:181: error: '__compar_fn_t' has not been declared

Couldn't determine program size:

Anyone has any idea?

Kuba

Well, I own this thread :)

Solution from #Arduino (thanks again, follower!): http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1222985221/2 Just #undefing int and abs helped.

Anyway, loop configuration did not work. I assume that two Arduinos are required to make transmission work.

Kuba

i'm trying with the virtual wire as well, i already figured out how to send char messages form one arduino to the other, which worked fine. but how can you send variables?? :-/

I am starting playing with this SeeedStudio RF device but using Arduino Oscilloscope I see a lot of, what seems to me, noise at the received even when nothing is being transmitted at the sender.

Is it normal? I mean, Should the received have activity even if no transmitter is used?

I have the same problems as Pooh using VirtualWire and the new Duemillanove and Arduino 015, I always get these erroe messages:

In file included from D:\Program Files\Arduino\arduino-0015\hardware\cores\arduino/WProgram.h:6,

d:/program files/arduino/arduino-0015/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected unqualified-id before 'double'

d:/program files/arduino/arduino-0015/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)' before 'double'

d:/program files/arduino/arduino-0015/hardware/tools/avr/lib/gcc/../../avr/include/math.h:439: error: expected `)' before 'double'

Did anyone found a solution for that? Arduinos are new to me so I wonder if there is a fix I can use without changeging the libraries manual, I do not realy dare this...

if there is a fix I can use without changeging the libraries

Unfortunately not, I think you will need to add this to the library: #undef round

Search the forums for a recent post from me detailing where you need to put it.

--Phil.

I was able to successfully compile the VirtualWire v1.3 examples by adding

#include <WProgram.h>

to the top of the sketches.

Thanks Phil, I found this while searching for your #undef post:

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round

and it worked, now it compiles.

Adding: #include <WProgram.h> on top of the sketches didn´t work
I will test the hardware later. Thank you all.