[Uaflug] [OT] Looking for a serial level converter
Orion Sky Lawlor
ffosl at uaf.edu
Mon Aug 13 17:27:57 AKDT 2007
On Mon, 13 Aug 2007, Joshua J. Kugler wrote:
> I'm about to buy one of these:
>
> http://www.ftdichip.com/Products/EvaluationKits/TTL-232R-3V3.htm
I've been hacking away with USB-to-serial-to-microcontroller
stuff this summer for robotics, and I've been quite
surprised to find that standard RS-232 (the usual PC serial
protocol) actually both sends and receives from TTL
microcontrollers without any problems.
Officially, RS-232 serial voltages are -12V to +12V bipolar,
and TTL is 0V to +5V, so you wouldn't think this would work.
But it *has* worked fine on the half-dozen PC serial ports,
and three different USB-to-serial converters I've tried--
this makes me think some nonzero fraction of RS-232
peripherals actually use TTL voltages, so ports secretly
all accept them. The only gotcha to watch out for is to put
a little resistor (like 1Kohm) on the big computer's TX line,
since the -12V from there can freak out your TTL input port
(a few protection diodes shunting to ground and +5V wouldn't
hurt either, but I haven't needed them on PIC microcontrollers).
So if you're willing to build a 6-pin harness yourself, you
could just use your motherboard's builtin serial port, or
buy a $9 USB-to-serial converter from newegg:
http://www.newegg.com/Product/Product.aspx?Item=N82E16812188102
Locally, Geek City has a basically identical USB-to-serial converter,
but it's $40. Both of them just plug-and-play under Ubuntu 6,
showing up as /dev/ttyACM0. You set the baud rate, parity,
and so on with stty:
stty raw clocal 57600 cs8 -parenb -cstopb -echo < /dev/ttyACM0
Now you can fling bytes out the parallel port with:
echo "Wazzup?" > /dev/ttyACM0
and read them back with:
cat /dev/ttyACM0
(Replace ttyACM0 with ttyS0 to use your motherboard's serial port)
> http://www.futurlec.com/Connectors/IDCMH10.shtml Got a good source for them?
I'd go ghetto-style and saw a 16-pin socket down to 10 pins:
http://www.goldmine-elec-products.com/prodinfo.asp?number=G16033
(Electronic Goldmine is my favorite component supplier.
They're insanely cheap, and ship USPS here in under a week.)
--
-Orion Sky Lawlor
http://lawlor.cs.uaf.edu/~olawlor/ ffosl at uaf.edu
More information about the uaflug
mailing list