Shop OBEX P1 Docs P2 Docs Learn Events
Looking for Recommendation :: RS-232 to RS-485 adapter for PC — Parallax Forums

Looking for Recommendation :: RS-232 to RS-485 adapter for PC

JonnyMacJonnyMac Posts: 8,957
edited 2007-09-20 16:25 in General Discussion
Looking for a RS-232 (prefer DB-9 connector) to RS-485 adapter for a Christmas lighting control project. Thanks for any suggestions.

Comments

  • StarManStarMan Posts: 306
    edited 2007-09-12 00:39
    I have limited experience (and knowledge) of serial communications but I did a fairly large project last year with RS-485 that was ethernet to RS-485.· I ended up using some units by Comtrol but I found ATEN during my search.· They have a lot of data communications stuff.· Here is a link to something that might·get you closer·to what you want.· http://www.aten.com/products/productItem.php?pid=20050224145727005&psid=20050117105110002&pcid=20050107104648001&layerid=subClass8

    Chris I.
  • kelvin jameskelvin james Posts: 531
    edited 2007-09-12 05:16
    www.commfront.com/CommFront-Home.htm


    Not cheap, but specs look pretty good.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-09-12 10:10
    You need to consider more detail.

    Do you want Half-Duplex or Full-Duplex?
    Do you want to include other control/handshaking signals?
    Do you want electrical isolation?
    Do you need nearly +12/-12 swing or can you get buy with far less?

    Do you want to make your own boards or buy a packaged deal?

    There are some good DIY projects, but FULL-Duplex really requires two pairs of RS-485 wire, not one pair.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • pwillardpwillard Posts: 321
    edited 2007-09-12 17:40
    Odd, I thought everyone just built their own since it's just a DB-9, MAX232 <-> SN75176B and a RJ50 (10 Pin). I was surprised though to see how many vendors sell these. If this what we are talking about, I mean?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    There's nothing like a new idea and a warm soldering iron.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2007-09-12 19:46
    Hi Jon,

    Will that be connected to a Stamp or SX at 0--5 volt levels? Or to a PC?

    Another parameter to consider is whether you want your software to control the direction on the RS485 buss, or whether it will happen automatically. For automatic, activity on the transmit line forces the RS485 chip into transmit mode, and it stays there until the activity ceases for some interval that you can set, and then the chip goes back to listening. That's nice because one uP pin can handle both directions. Software has to manage the delays and the who-talks rules. It can same some trouble because PC serial ports can be kind of dicey in controlling the handshaking lines.

    Or maybe the lighting control is one direction only?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-09-18 07:17
    Tracy,
    I suspect that the Christmas lighting project merely has to Transmit in one direction to a dedicated listening device - the simplest of Master/Slave relationships. This would not even require duplex and RS-485 would be excellent for long distances. You could broadcast to several recieving nodes over 'fire safe' low voltage wire and each node could activate or blink power available nearest its site [noparse][[/noparse]using a solid state relay] .

    But since it is so easy to get 4-wire telephone wire with RJ-45 solderless connectors, I prefer to go to full duplex with a dedicated line in each direction if at all possible. This is an excellent way to avoid handshaking and a lot of additional protocol thought. I think it is the best approach for a first device to connect to a PC.

    Automated direction control has to make assumptions about default directions. When the assumptions are wrong, collisions occur and confusion results. At times it can be hard to restart the system's communication if a remote node has stuck in transmit when it should be in receive.

    Alternately, if half-duplex is truly desired, 2 wires can share Rx and Tx, but again the second 2 wires are quite useful and available for several hardware handshaking schemes. The second pair can indicate that another node is waiting to send or might be reserved to reset the whole system.

    But, I am not sure how it might handle more than one node simultaneously trying to get online. CANbus is a RS-485 set up that resolves such problems.

    In sum, I have given up on the minimal 2 wire setup in most cases and gone to 4 wires when using RS-232 over RS-422/485. You really can do a lot more with the 4. A PC can be wired full duplex at one end and the BasicStamp can be half-duplex at the other end. Or two half duplex devices can more easily operate over dedicated directions.

    If two wire RS-485 is a must for some reason, having a CANbus controller with all its features [noparse][[/noparse]buffer, error correction, broadcast to multiple nodes, etc.] allows the microprocessor to be free for local control and sensor routines. Incoming messages in packets of 8 bytes are filtered for priority. You can even have a emergency overrides broadcast to all or certain nodes. But of course, this is a huge learning curve and not really appropriate to a small project.

    I have set up a 2 wire CANbus with the other 2 wires providing 9 volt power to remote nodes. Any that can be quite handy instead of worrying about lots of batteries.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • JonnyMacJonnyMac Posts: 8,957
    edited 2007-09-18 14:02
    I am in fact building a network-able lighting controller board, so the communication is from the PC (master) to the network nodes -- one direction only.
    Tracy Allen said...
    Hi Jon,

    Will that be connected to a Stamp or SX at 0--5 volt levels? Or to a PC?

    Another parameter to consider is whether you want your software to control the direction on the RS485 buss, or whether it will happen automatically. For automatic, activity on the transmit line forces the RS485 chip into transmit mode, and it stays there until the activity ceases for some interval that you can set, and then the chip goes back to listening. That's nice because one uP pin can handle both directions. Software has to manage the delays and the who-talks rules. It can same some trouble because PC serial ports can be kind of dicey in controlling the handshaking lines.

    Or maybe the lighting control is one direction only?
    Post Edited (JonnyMac) : 9/18/2007 4:10:32 PM GMT
  • skylightskylight Posts: 1,915
    edited 2007-09-19 16:45
    RS 485, Lighting Project, perhaps DMX is involved? if so then because of the high transmission speeds you may be better off using the ethernet port and using an ART Net device to convert ethernet to DMX.

    There are several free lighting consoles on the web such as Magic Q from Chamsys which will drive ART Net

    http://www.chamsys.co.uk/default.asp?p=downloads.asp

    an Artnet project?

    http://www.artisticlicence.com/dwnart.htm


    Post Edited (skylight) : 9/19/2007 4:56:46 PM GMT
  • JonnyMacJonnyMac Posts: 8,957
    edited 2007-09-19 19:00
    Not DMX -- my device (custom, multi-drop dimmer for N&V) communicates at the VERY TAME rate of 38.4K. I found an adapter from a company called MOXA.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2007-09-20 16:11
    JonnyMac,
    Well if you only want RS232 to RS485 TX to RS485 RX to BasicStamp, it is quite simple.

    You need an RS-232 level shifter such as the MAX-232 to adapt from +12/-12 to 0/+5 logic level. It uses only a +5 volt power that can come through a 7805 regulator. You will have to prove a wall wart or a greater than 7.5volt battery pack to power the end connected to the computer. Then you need an RS-485 {try an LTC485 or similar chip} transciever chip tied to transmit only. If you have a choice buy low power chips as you can run longer on batteries.

    At the other end, you use a similar transciever chip, but tied to receive only. It needs to have +5 volts to power it - maybe the BasicStamp can afford to supply it. That goes into the Stamps Rx. Make sure that you are not inverting the logic of the signal to the BasicStamp. If that is a problem, you can have the BasicStamp receive an inverted signal by changing a PBasic command for Serial In.

    I'd like to mention that the MAX-232 has 4 channels and you are only using one. Many people never use more than two of channels - one for TX and one for RX as handshaking was provided for slow machines that are no longer in use. If you can avoid handshaking, do so whenever possible. It just adds software headaches.

    If you were to use two channels[noparse][[/noparse]One for RX and one for TX, double up on the trancievers; you can easily provide a 4 wire duplex setup. As I mentioned above, telephone wire easily and cheaply accommodates this setup.

    Just consider that you can have the remote BasicStamp provide intellgent feedback. Also, you will have an adaptible system that will be useful for other things beside lighting control. Adding the second line is not going to add a lot of labor or cost to the whole project and cheap telephone 4-wire line that crimps RJ-45 connectors on the end will likely cost the same or less than 2-wire line.

    Though there is mention of twisted pair wires and active termination, you will find that short distances and slower speeds can often ignore these requirement. I usually include the active termination because it is just providing a few 1/4 watt resistors, but generally run 100' of wire without the twisted pair.

    By the way, if you really are lazy....
    People have run RS-232 directly to the BasicStamp over 100' of wire. If you have trouble, just reduce the Baud rate. But, the RS-485 can extend your lines to miles ! ! ! with the same software.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "Everything in the world is purchased by labour; and our passions are the only causes of labor." -- David·Hume (1711-76)········
    ···················· Tropically,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • JonnyMacJonnyMac Posts: 8,957
    edited 2007-09-20 16:25
    I'm fairly capable and could have designed my own adapter, but for my article (November) I wanted an off-the-shelf solution so that I could focus on the dimmer part of the project. Because of potential distances involved I wanted a true RS-485 system; that said, I also dropped a 3-pin servo header onto the board (downstream of the LTC485) so that I can connect a BASIC Stamp, SX, or Propeller uC right to it for short-distance control.
Sign In or Register to comment.