1
\$\begingroup\$

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.

\$\endgroup\$
  • 3
    \$\begingroup\$ The cheapest way is a few wires. Can you clarify if you want this communication to be wireless? \$\endgroup\$ – Connor Wolf Jul 27 '12 at 4:15
  • \$\begingroup\$ 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. \$\endgroup\$ – Olin Lathrop Jul 27 '12 at 11:18
  • \$\begingroup\$ See this question electronics.stackexchange.com/questions/3203/… \$\endgroup\$ – Toby Jaffey Jul 27 '12 at 14:21
4
\$\begingroup\$

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:

enter image description here

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

\$\endgroup\$
  • \$\begingroup\$ +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. \$\endgroup\$ – milesmeow Jul 28 '12 at 2:28
  • \$\begingroup\$ @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. \$\endgroup\$ – stevenvh Jul 28 '12 at 4:48
3
\$\begingroup\$

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.

\$\endgroup\$
2
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ 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())! \$\endgroup\$ – JustcallmeDrago Apr 26 '14 at 22:39
1
\$\begingroup\$

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.

https://www.sparkfun.com/products/10534 https://www.sparkfun.com/products/10532

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.

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.