Shop OBEX P1 Docs P2 Docs Learn Events
Easiest way to get serial in — Parallax Forums

Easiest way to get serial in

lockburnlockburn Posts: 6
edited 2005-08-14 20:27 in General Discussion
I have an SX Tech Tool kit, as well as a few SX52 proto boards.

What's the easiest way to get serial in? The chip will need to read the serial input, but won't transmit anything back.

I'm assuming I need to use a 232 to TTL converter. I've used a MAX232 in the past, just checking if there was an easier way.

I just bought a USB to serial adapter (new laptop is legacy-free). Would be so much easier if this thing had an option for TTL outputs, vs converting it to +/- 12 V.

Comments

  • BeanBean Posts: 8,129
    edited 2005-07-25 14:47
    Lockburn,
    For getting serial into the SX chip, I always just use a 22K resistor to one of the SX I/O pins.
    The SX has protection diodes that will clip the +/- 12Volt signal to TTL levels. The resistor justs limits the current.
    Now for getting serial OUT of the SX you need to get fancy with level shifters or MAX232 and the like.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    Product web site: www.sxvm.com

    "One experiment is worth a thousand theories"
    ·
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-07-25 15:54
    Hi,

    for one system, I used photocouplers to interface the SX to an RS-232 port. Although this may be not cheaper than using a MAX232, it has the advantage that the PC and the SX side are electrically isolated. This is important in industrial applications.

    The approach is a bit "tricky" because on the PC side, it is important that the RXD input is switched between say +9 and - 9 Volts. As I did not need handshake, I "mis-used" the RTS and DTR lines of the COM port as "supplies" for the positive and negative voltages. OK1 pulls RXD up to +9V when SX_TXD is low, and OK2 pulls RXD down to -9V when SX_TXD is high, where Q1 is used to invert SX_TXD for OK2.

    To make sure that the RXD part works correctly, it is important that the software controlling the COM port sets RTS and DTR to the required levels.

    The COM port's TXD signal is directly connected to pin 1 of OK3, and pin 2 goes to signal ground of the COM port. SX_RXD is pulled low then the TXD line is at +9V, and it will be pulled up to high via R4 when the TCD line is at -9V.

    Lockburn, when you only need serial in, OK3 and D1 are the only components you need. Maybe, it's a good idea to put another resistor (say 220 Ohm) in series with the TXD line for current limiting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
    910 x 1144 - 81K
  • lockburnlockburn Posts: 6
    edited 2005-07-27 13:27
    Thanks, I'll give these a shot!

    Bean, that sounds pretty easy to get serin. Have you had any problems with this (ie, high baud rates)?

    Guenther, sounds like a good idea as well. I have a few photocouplers from a project I did a few years back (connecting a VW-Audi to a PC).

    -Warren
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-08-06 17:17
    This is excellent for several reasons.

    Living in Taiwan, I find it really hard to buy some 'state-of-the-art' parts, such as the MAX 232 and the shipping cost to order just one are murder.

    I suppose all the manufacturers have them, but they are sitting in duty-free zones while the electronics shops sell surplus from yester-year.

    But, I can get some more generic parts such as these.

    Also, I was thinking of building a weather station that would use an RS-232 link to send info into·a BasicStamp Station with LCD·from a BasicStamp module with Temperature, Humidity, Wind Direction, and Wind Speed.

    For a long time, I thought it would be safer to go with radio data transmission because of lightning strikes. This is far less expensive and adds an interesting twist that certainly is useful in many hostile, industrial environs.

    Incidentally for the newbies,
    ONLY one port of the BasicStamp requires a true RS-232 inferface [noparse][[/noparse]and it is important and useful if you are using RS-232 serial LCD, to connect to your PC, and such], the rest of the serial i/o is TTL that can go farther and faster with the RS-485 standard and the 75176 [noparse][[/noparse]but not in full duplex].

    This is another alternative to purchasing the MAX 232. Additionally, you can build a whole network on 3 wires! Twisted pairs are better, but telephone wire can work up to a point. (RS-232 is good for about 50 feet while RS-485 is good for 1000 feet).· It may also be easier to start programing with half-duplex projects rather than full duplex projects.

    Again,·the 75176 chip·is easier and cheaper to get here, so I am using it to experiment.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan

    Post Edited (Kramer) : 8/6/2005 5:23:51 PM GMT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-08-07 06:12
    Having just come back from walking the dog, it occured to me that this configuration is not limited to SERIAL IN. B&B sells RS-232 to RS-485 converters for about $75USD! By using this to convert RS-232 SERIAL OUT from the BasicStamp to TTL, you can then hook up to a 75176 chip to drive RS-485 WITH ISOLATION. The cost are less than $8 for chips plus a 5volt wall wart.

    In fact, it may be a simpler design and with only two Optoisolators. It is really a winning situation for long lines and possible shorts or insertion of high voltages. It can be done at both ends so that the wire is completely isolated from devices. If some incident hooks up 110VAC to your cable, you limit damages to about 4 chips and your power supply. Very robust, easy to configure.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-08-14 10:02
    Anyone using an LT-1032 as a RS-232 TX line?

    I just found this chip in The Art of Electronics and it transmits at +5/-5 from a +6/-6 voltage supply. It seems a useful alternative if isolation isn't needed.

    The problem with isolation is that you must also isolate the power supplies. Without cheating power from other RS-232 lines, you must provide +9/-9 on one side of the isolation and another +5 on the other.

    Obviously the reason the MAXIM MA-232 is so popular is that it just does it all for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • kjennejohnkjennejohn Posts: 171
    edited 2005-08-14 20:27
    I'd like to recommend two other possible MAX chips for serial conversion, the MAX231 and 233. The 231 is the same price; the 233 is twice as expensive.

    The 231 uses two capacitors to derive a negative 9 volts. The positive level comes from an existing DC supply. Since most development boards use a 7.5V to 9V wall wart supply to feed a +5V regulator, the higher RS232 voltage is already available at the DC in jack or input of the regulator. The highest DC you can feed into this is 12V.

    The 233 has all caps internal, so you don't need to supply anything to the chip beyond the +5V and ground.

    Neither have matching pinouts for the 232, so you're stuck using these on a breadboard or designing them into your project for later use.

    Here is the page at Maxim with data for all there chips in the RS232 MAX-series:

    www.maxim-ic.com/quick_view2.cfm?qv_pk=1798

    Later!
    kenjj
Sign In or Register to comment.