# What is the cheapest way for two devices spaced less than 10 feet apart to communicate wirelessly with each other?

I'm building a musical instrument that comprises of two separate devices...one device is the master...has an accelerometer and a speaker. The master's buddy device also has an accelerometer.

When the buddy tilts, the buddy device interprets the accelerometer data and then sends a note to the master. The master plays the note using instrument voice 1.

The master, at the same time is processing it's own accelerometer information. Based on accelerometer data, it will play other notes using instrument voice 2.

If the user moves device one and then moves device two in special ways, a flourish will play.

My question is...taking into account the type/amount of data that I'm sending...essentially short control bytes, what would be the cheapest way for the two to communicate wirelessly?

--CLARIFICATION-- These devices ideally would be wireless and not tethered to each other. Also, these devices will be moved around freely so any line of sight method is less than ideal.

• The cheapest way is a few wires. Can you clarify if you want this communication to be wireless? – Connor Wolf Jul 27 '12 at 4:15
• Three wires: ground, receive, and transmit, using UARTs at each end is the obvious answer. You can eliminate one of the wires if communication only needs to be in one direction. Nothing in your spec says this isn't a valid solution. – Olin Lathrop Jul 27 '12 at 11:18
• See this question electronics.stackexchange.com/questions/3203/… – Toby Jaffey Jul 27 '12 at 14:21

I'll assume you want to do this wireless, otherwise the solution is obvious.

I would go for infrared. The transmitter can be a small microcontroller sending a pair of bytes to an IR receiver module.

These receiver modules are tuned to a particular protocol. You can use an RC-5 module; RC-5 transmits 14-bit at a time using Manchester encoding. You can easily add a pair of bits to it, and define your own codes.

A 3 m range should not be a problem. I've used Vishay RC-5 receivers at 15 m range. At shorter distances you probably won't even have to direct the LED to the receiver. In a normal size room the signal will reflect off the walls.

A cheap RF solution is the RFM70:

Less than 5 dollar at Digikey. That's far less than an Xbee.

• +1 for rec of cheap RF transmitter...If IR the emitter and receiver have to be lined up right? I should clarify that the devices need to move around freely, so I can't count on line of sight alignment. – milesmeow Jul 28 '12 at 2:28
• @milesmeow - The RF will work more reliably then, but IR doesn't necessarily have to be lined up. Like I said it bounces off the walls too, but for some angles you may miss a code. So RF is probably best here. – stevenvh Jul 28 '12 at 4:48

Cheapest is wires.

Cheapest wireless is probably Infrared. You don't say what the physical distance is but unaimed IR can work over 10's of feet / say 10 metres within a room due to IR bouncing happily off surfaces which are visually non reflective. This can get unreliable and if lower range and/or a degree of rough aiming is possible then IR is liable to be a good fit.

IR transmission can be digital or analog. Analog data rates of some kilobaud are easy enough [tm] with available tx/rx modules working at a carrier frequency of about 30 kHz and higher rates are possible.

A packet of data with say 8 data bits and some start + stop + error checking for say 20 bits total will take 20 mS to send at 1 kb/s (1000 bits/second) and 2 mS at 10 kb/s. If this is received correctly on the first transmission a "latency" of about the packet transmit time exists. You can judge if this is fast enough. This assumes that the data link is synchronised and does not need a "preamble" to be sent to persuade the receiver data slicer to find the proper DC levels of the oncoming signal. This can take significant time but is overcome wither by mumbling quietly to the other ened when there is nothing useful to send (system stays synced) or by using some other system. Not hard. Commonly done. ICs exist that do most of the work.

Very low cost RF TX & RF modules exist that cost far less than XBEE and are easier to use. These lack the addressing and general security sophistication of XBEE but are liable to do just fine. Costs may be about $US5/end and maybe less. More and much more if you agree to pay it. You can also try 2.4 GHz wireless technology. It's quite cheap, and will have excellent range. I just bought a pair of transceivers for about$2.00 each from eBay.

The NRF24L01 is quite popular too, so I am sure you will be able to find some really great tutorials to follow.

For example, if you are using the Arduino, then check out this link.

• If you are using an MSP430, github.com/spirilis/msprf24 is a great library that I have used (with MSP430G2553s in my case). I cannot speak for maximum data rate, but in my project I was sending 32 bytes around 100 times per second and it had no problems. I had to flush the transmit buffer after each send though (flush_tx())! – JustcallmeDrago Apr 26 '14 at 22:39

The Xbee is great, but is relatively expensive (\$30 per unit?) It is also a transceiver meaning that it transmits and receives. It sounds like you only need one end to transmit and one end to receive. I have never used these, but I have seriously considered using them on several projects due to how simple they are.

They way I understand that they work is that whatever(digital) signal you input onto one, will be seen on the other. So they are really simple too compared to the Xbee.

Do you want it to be wireless? If so, I would look into an Xbee. That is a link to Sparkfun's introductory tutorial and buying guide on them. Xbee provides for easy point to point configuration which seems ideal for your application.

If it does not need to be wireless, then just use some sort of serial protocol. Some of the simpler ones with plenty of documentation on the net include UART, SPI, and I2C. Googling any of those terms combined with the microcontroller of your choice will definitely find you a good starting point.

Best of luck.