# ultra simple rf communication

**URL:** <https://community.sparkfun.com/t/ultra-simple-rf-communication/18239>\
**Category:** Wireless & IoT\
**Created:** [November 18, 2010, 8:12pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239 "2010-11-18T20:12:30Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikethe1wheelnut](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mikethe1wheelnut](https://community.sparkfun.com/u/mikethe1wheelnut)\
**Post date:** [November 18, 2010, 8:12pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/1 "2010-11-18T20:12:30Z")

</div>

hello 🙂

just a quick question: I tried to get wireless communication going with two arduinos and this dude: [http://www.sparkfun.com/products/8945](http://www.sparkfun.com/products/8945) and it’s mate, with input from a potentiometer. Here is my code:

```auto
/*
* Simple Transmitter Code
* This code simply counts up to 255
* over and over
* (TX out of Arduino is Digital Pin 1)
*/
byte counter;
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin 

void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
counter = 0;
}
void loop(){
    val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) 
  val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) 
counter = byte(val);
//send out to transmitter
Serial.println(val, DEC);
counter++;
delay(10);
}

```

reciever:

```auto
/*
* Simple Receiver Code
* (TX out of Arduino is Digital Pin 1)
* (RX into Arduino is Digital Pin 0)
*/
int incomingByte = 0;
void setup(){
//2400 baud for the 434 model
Serial.begin(2400);
}
void loop(){
// read in values, debug to computer
if (Serial.available() > 0) {
incomingByte = Serial.read();
Serial.println(incomingByte, DEC);
}
incomingByte = 0;
}

```

output transmitter:

```auto
113
113
113
113
113
113
113
113
113
113
113
113
113
113
113
113
113
113
113
113

```

output reciever:

```auto
51
49
10
13
78
49
10
166
49
49
13
51
49
10
166
49
49
225
13
51
49
10
166
51
76
76
248
13
163
49
49
106
49
49
225
51
49
49

```

the two are only exerts, they are not supposed to match line for line, but even so, it is clear to see that what comes out the end is pure gobldy gook… here is the tutorial I used: [http://www.sparkfun.com/datasheets/RF/K … hrough.pdf](http://www.sparkfun.com/datasheets/RF/KLP_Walkthrough.pdf)

is this normal? I can’t quite believe the wireless link is -this- bad… am I just in an area of high interferance? also, the transmitter is powered with only 5V… the two devices are ~1 ft appart, 1 ft from this computer.

-mike

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [November 18, 2010, 8:17pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/2 "2010-11-18T20:17:29Z")

</div>

You might need to use Manchester code.

---

<div class="post-metadata">

**Author:** ![thebecwar](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@thebecwar](https://community.sparkfun.com/u/thebecwar)\
**Post date:** [November 18, 2010, 8:22pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/3 "2010-11-18T20:22:50Z")

</div>

Since there’s no protocol stack running here, you probably want to implement some kind of parity across your link to make sure the data is coming across correct.

---

<div class="post-metadata">

**Author:** ![languer](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/languer/32/2998_2.png) [@languer](https://community.sparkfun.com/u/languer)\
**Post date:** [November 19, 2010, 5:42am UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/4 "2010-11-19T05:42:00Z")

</div>

First; yes, the link can be that bad. This is an ultra-simple receiver. no protocol, packets, error correction, etc.

Second; make sure your receive has an antenna.

To make the communications more robust, consider sending two sequential (back-to-back) characters. The first one is a LAM (look-at-me) qualifier, and the second one is the one you want. You will not look at the second character until the first character is received and accepted (matched against the LAM).

For example (pseudo-code, LAM-\>0x81):

```auto
***TX***
(1)send LAM
(2)send VAL

***RX***
(1)receive CHAR
(2)If CHAR == LAM Then receive next CHAR, and print
(3)Else goto (1)

```

A better option; send three sequential characters. First is LAM, next is the one you want, third is checksum or crc. You do not “accept” the second character unless it is preceded by the LAM, and followed by the checksum/crc.

---

<div class="post-metadata">

**Author:** ![follower](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@follower](https://community.sparkfun.com/u/follower)\
**Post date:** [November 19, 2010, 9:54am UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/5 "2010-11-19T09:54:29Z")

</div>

Save yourself some hassle and check out if [[VirtualWire](http://www.open.com.au/mikem/arduino/) supports this particular module–it’s a great library that handles the special needs of these types of modules well.

–Philip;]([http://www.open.com.au/mikem/arduino/](http://www.open.com.au/mikem/arduino/))

---

<div class="post-metadata">

**Author:** ![otherguy](https://avatars.discourse-cdn.com/v4/letter/o/bc8723/32.png) [@otherguy](https://community.sparkfun.com/u/otherguy)\
**Post date:** [December 5, 2010, 11:04pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/6 "2010-12-05T23:04:15Z")

</div>

I used these modules in an RC car for a senior design project a few years back.

My memory is a little fuzzy as to the details why, so forgive me for not backing up my claims… But I recall coming across some documentation stating that these modules require (or work best) with fairly neutral disparity (equal number of 1’s and 0’s being transmitted).

Bandwidth wasn’t a huge concern in my application (which is why i chose these), so I simply transmitted the desired byte of data followed by its inverse. On the receiving end I compared them to verify everything was transmitted properly.

This is the quick and dirty method that worked reliably with these modules, I’m sure there are more efficient ways of encoding the data, but I never got into optimization.

---

<div class="post-metadata">

**Author:** ![leon\_heller](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/leon_heller/32/7602_2.png) [@leon\_heller](https://community.sparkfun.com/u/leon_heller)\
**Post date:** [December 5, 2010, 11:10pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/7 "2010-12-05T23:10:24Z")

</div>

That’s basically what the Manchester code I suggested does.

---

<div class="post-metadata">

**Author:** ![otherguy](https://avatars.discourse-cdn.com/v4/letter/o/bc8723/32.png) [@otherguy](https://community.sparkfun.com/u/otherguy)\
**Post date:** [December 5, 2010, 11:18pm UTC](https://community.sparkfun.com/t/ultra-simple-rf-communication/18239/8 "2010-12-05T23:18:20Z")

</div>

Good to know.

Don’t know if this will be useful, but here’s some documentation on the wiring and communications protocol I used for the project.

There’s a bunch of stuff specific to the project, but you might be able to get some info out of it that’s relevant:

[http://edge.rit.edu/content/P08027/publ … essTesting](http://edge.rit.edu/content/P08027/public/References/Robot/wirelessTesting)

and there’s some wiring info on this page:

[http://edge.rit.edu/content/P08027/public/RC%20Vehicle](http://edge.rit.edu/content/P08027/public/RC%20Vehicle)
