I have a PIC24F based device that normally connects to a PC via USB. The device can be controlled through PC software this way. I want to add an optional hand control box that can also be plugged into a separate connector on the main device and can be used to control the device and read/display data from the main device. This hand control box will also be PIC based. I am trying to decide which communication technique to use between the main device and the optional hand control box. I like the idea of SPI but I know that is not intended to be used over long distances. Do you think my best option would just be to use the UART modules with RS-232 line tranceievers to boost the signal to +/-12 volts? Are there really any other options?
One option (assuming your desired device supports it... many Microchip PIC's do) is a CAN messaging system. It's extensively used in automobiles, e.g. so a tire rotation speed sensor and an accellerometer can communicate with the airbag computer. The protocol is designed such that you can have an unlimited number of devices communicating on one bus without collisions.
I use it at my company to communicate up to about 200 feet between a product and a controller. Highest standard baud rate is 1Mbit/s. It's fairly easy to implement in C. You'll need a CAN transceiver if you choose to do this; something like Microchip's MCP2551.
RS-485 will work well, but you will need to add a RS-485 transceiver between your UART and the RS-485 bus. There are many software protocols that use this physical layer. Modbus is one of them that I've used in the past. It's very simple to implement and there are lots of industrial controllers out there that support it.
I've implemented the DMX protocol used for theatrical lighting systems which is a flavour of RS-485, and this worked in a noisy environment at least as far as 100ft. This was using a PIC16F877A and a RS-485 line driver to transmit, and several other receiver units with the same microcontrollers, daisy chained together along the 100ft line with a terminating resistor at the end.... it worked well.
Microchip actually has a very good datasheet on the subject with some circuit diagrams and example assembler code.
Yes, RS232 will work. Keep the baudrate nice and low, and 30 feet is no problem. But long cable runs are a hassle, so wireless seems attractive. Especially since a quality 30' RS-232 cable costs some money.
Other ideas to consider:
if one way communication is acceptable, put an IR receiver on the box and program it to listen to a consumer IR control. Use a popular remote's codes so that an $8 universal remote will work.
if you control the host software on the PC, have it open an ethernet port and serve web pages with the desired functions and controls on them. Any wifi-enabled iPad or smartphone becomes a remote control, and remote monitoring is easy. You could even replace the USB with an ethernet port, but that will add some complexity to the box.
Look at the ISM-band wireless modules like the 24L01 stuff from Nordic and the CCxxxx parts from TI. Sparkfun sells some on modules. If this is for a real product, using FCC precertified modules can save some money because FCC cert is expensive. I would say modules make sense in product volumes up to 5000 pieces.
i have 2 different frequencies one for send and one for receive. I have successfully used them up to 30 feet using 5v to power them. Sparkfun has other wireless communication devices as well.
There are various ZigBee devices that can be used just like a UART and should be simple to control from a PIC device. For example, the XBee is quite easy to use and is very affordable. In my experience I've been able to transmit and receive data in a crowded office at distances greater than 100 ft, and in a wide open space we could do much better, especially with good antennae. In my opinion wireless is much preferred to a 30-ft. long cable!
The MIDI interface was designed to reliably communicate over 50 feet. The hardware required (an optoisolator and a diode and a few resistors and an IC or transistor inverter) costs less and has better performance over long lines than the hardware required for +/- 12 V RS232 communication.