easiest long length arduino/PC interface

hello
I need my arduino (atmega1280 USB) to communicate with a PC 20m (65ft) away

I'll use a very low transfer rate (something like 50 bps), simplex (arduino -> PC)

is there any way to do that without needing to plug another board, capacitors, etc?

maybe using MIDI?

thanks

Well, rs-232 serial was invented just for that, well more than that as it can cope with pretty high baud-rates, you would only need a pc with an serial port and one max232 in the arduino side.

isn't it possible to connect a few digital I/O directly directly to RS232 and use some kind of arduino library (or even code it if it isn't too difficult)?

the PC will be running a custom software which I will code

it's a new PC, I didn't see it but I believe it has ethernet, rs232, usb
I said MIDI because I though it could be easier, so I'd have no problem buying a MIDI board

in fact, I'm good at software, but bad at hardware, so I was trying to avoid having to make a new board (with MAX232 for instance)
and I can't use the arduino board serial because it's USB (and I need a 20m long cable)

so do you also think MAX232 is my best bet?

If your pc has a standard serial port, then you might not need much more than an NPN transistor, two resistors, 65' of four conductor cat3 phone wire, and a DB9/25 serial connector.

no
actually not sure, but I could buy a pci rs232 controller anyway

if that's the easiest way to do it, I think it will worth it
(it's for a single personal project, I won't be selling or having to do it multiple times)

but I could buy a pci rs232 controller anyway

Or a USB-to-232: those are available really cheap these days. And easily portable to laptops or other PCs when needed.

Because you're driving a 20m cable, be sure you put a real RS-232 adapter at the Arduino end. I use one of these for connecting to TTL-only gadgets like my RBBBs, and it's a great little device, but it's only reliable for shorter cables. Verify that you're getting an adapter with a MAX232 (or similar) chip on it, not just a simple CMOS inverter like the P4 uses.

Or a USB-to-232: those are available really cheap these days. And easily portable to laptops or other PCs when needed.

Be advised that some of the inexpensive USB to serial adapters only output 0-5v instead of the expected +-12v.

I successfully use standard arduino (ttl) serial over 50m of cat 5 cable at 9600 baud through a less than pristine electrical environment - the cable runs over several florescent light fittings . A whole lot easier and cheaper than any other solution. It may be way outside the specs but it works reliably for me.

The serial port is well and truly dead in laptop land, many modern desktop PCs still have serial (and parallel) ports.

If your not up for playing with hardware, something like this would likely be your best bet.

Will also allow you to power it over USB as well.

Personally, I'd bite the bullet and just put together a TTL to RS485 (RS422) adapter and buy a USB to RS485 adapter.
That would give you about 1200' of range (at least in theory).

Current mode using two optos is pretty cheap and easy, too.

Take the USB chip and leave it near the computer. Use its TX line to run one opto, and use the ATMEGA328 TX line to run the other one. This makes both of the signals going through the cable current loops. It's hard to induce noise into a current loop :wink:

I've successfully used two cheap P2501 optos to send 9600 baud serial over a 400ft cable using this method. Better optos would let you transmit faster, the P2501 is limited to about 19200 baud.

If you want to be able to update firmware over this cable, you'll also need to send the DTR or RTS signal, so that would take another opto, although it could share one of the return lines with the USB TX. If you're powering the Arduino over the same cable you'll need 5 wires to do the whole job. My application has isolated power and ground for the Arduino, so I use 6 wires.

I can give you a schematic if you'd like - PM me.