I've run into a bit of a dilemma here. I needed to communicate with an Diecimila that is going to be flying in the air at some point so I got these radio transmitters and receivers (from Digi). Problem is, I can only connect to them by serial while my Diecimila has at most only 2 pins I can connect RX and TX to.
I found some websites saying that I need hardware to convert my TTL signal from the Arduino into a RS-232 signal but I found something about my radio's that may bypass all that with a little bit of soldering...maybe.
There's a dipswitch on both radios that I can change so that the "serial interface" is different. In particular, I can set the radios to communicate on RS-232, RS-485 (2-wire), and RS-485 (4-wire).
I saw somewhere that the Arduino could have something to do with "2-wire" and was wondering if I can do anything with my RX and TX pins on the Diecimila to get it to communicate with the radios on 2-wire instead of going through the trouble of voltages and RS-232.
...I can set the radios to communicate on RS-232, RS-485 (2-wire), and RS-485 (4-wire)...
...I saw somewhere that the Arduino could have something to do with "2-wire"...
Sadly the Arduino and your radios have different definitions of "2-wire". The Arduino is referring to the Phillips I2C standard while your radios are selecting between 2 and 4 wire RS485 serial.
You will need to convert the serial signal from TTL/5V to RS232 levels. There are a number of ways to accomplish this:- A max232 (or similiar). This is pretty much guaranteed compatible and it's easy enough to do (or some people sell kits)
- If you don't need strict compliance, you can bodge some transistors into working. uC hobby explains and sparkfun sells
- You could use an Arduino that speaks RS232 natively, like the official single sided board or my MaxSerial.
As a final point, I suspect your radios are 'DCE' type serial connections as are all of the above solutions, so you will likely need to cross the TX and RX lines between your solution and radios. If that doesn't work, try the other way.
If your modules speak trues rs232 voltages, you'll need some level conversion as spiffed says. If they are TTL signals, you can hook 'em directly to the decimilla's pins 0 and 1, after disabling the USB device (and getting power elsewhere).
There's only one hardware serial port on the Arduino, so if you need one arduino to talk to more than one device, you'll have a bit of a challenge. SoftwareSerial works great for writing from the arduino; reading isn't always so fun.
spiffed didn't play up his board, but I think it's a great solution if you need true rs232 and don't need USB. I've been looking at his web page for a couple of days trying to decide how many to order, so I can convert my home-etched single-sided serial arduinos (that use the transistor trick) to smaller max232 enabled boards.
I just recently did the same thing with a ELM323 for my car. I recommend a MAX232 or the MAX233. Both can be ordered as free samples from Maxim-IC. They were extremely easy to wire up and function very reliably.
Alright, this all makes sense now.
So in the meantime, I've been scrounging around for parts and apparently we have an old MAX202 lying around here. I'm gonna start testing with it tomorrow, but just as a precautionary measure I want to make sure that the MAX202 is even capable of doing my "conversions"...which is if anyone knows anything about this ancient chip.
Here's the datasheet: http://www.datasheetcatalog.org/datasheet/maxim/MAX200-MAX213.pdf
I could probably figure out if all this works by looking on the diagrams in the datasheet but unfortunately I'm still trying to learn the ropes of deciphering these electrical schematics.
Why would there need to be all these different versions of these IC's anyway? they seem like they all do the same things.
The 202 is fine, and still in production (by others if not by Maxim).
As for the variety, well, that IC family solves a very common problem, but that problem occurs in a lot of different scenarios. The 232 covers the basics, 2 in 2 out. The 233 will do the same, with no external caps, if you want to spend a bit more $$. Some have a lot more inputs and/or outputs that the 2 provided by the 232, so you can do full rs232 handshaking for a modem or something. Others run on 3.3V instead of 5V (and some run on either). Some have an enable/disable for power saving. IIRC some have rs422 modes. Some will operate at higher speeds, some use less power.
The MAX232 is like the #1 phillips screwdriver in your toolbox - it's the one you'll use the most. All the others are like the rest of the torx/hex/etc drivers - you need 'em every once in a while.