RS-485 Interface


I am new to TinyCLR and FEZ, but not to programming. I apologize if this is too basic, but I have (what I hope is) a rather simple question:

I am looking at getting a device which communicates using RS-485, and would like to connect to it and query data using a Panda II. In speaking with GHI, I learned that the Panda II natively communicates using TTL and needs either a TTL adapter or a serial protocol shield to speak to other devices. So far, the approaches that we found to have a Panda II talk to this device are:

Use the GHI RS-232 shield and then an RS-232 to RS-485 converter, or

Use a direct RS-485 to TTY converter.

The TTY to RS-232 to RS-485 is the more complicated of the two routes, but may also have the simplest API and the easiest power issue since TTY to RS-485 converters I have found require external power.

So my question is, are there any other alternatives out there? I am looking for a way to connect with this device which is A) programmer friendly, B) simple (fewest parts and no external power), and C) least expensive. What is out there? I have seen a few references to RS-485 communication with the Panda/II, but not details on how it was achieved. One person just mentioned that he moved from Panda to Cobra. Another references an RS-485 driver with code using RLP, but the project is tagged specifically for the Cobra. It looks like I can run RLP on Panda II. Can any one comment on this or another means communicate between the Panda II and an RS-485 connected device?

Thank you,


yes and yes. it is up to you really.

have you seen this

I referenced that project specifically, but did not post the URL. Does your answer imply that

  1. The RLP driver in that link is compatible with Panda II?

  2. Using that driver and a managed class I can hard wire the terminal blocks of the RS-485 device to the header on the Panda II and go to town, or is there still required hardware?

If that is all I need, great info! Next will be learning how to deploy RLP on Panda II, but I have time for that.

Please let me know, and thanks.


You’ll need level converters regardless, because the Panda II works at 0v-3.3v and RS-485 (and RS-232, for that matter) work at -7v-12v.

So can I use the RS-232 shield as a level converter with the RLP for RS-485 protocol? If so, sounds like that would be my easiest approach for me to prototype. If I want more of these, I can buy cheap RS-232 data cables that might do the trick in the future, or look at breaking out the soldering iron.


My answer was too short I guess :slight_smile:

Basically, you can do it the easy way or the cheap way or the right way! My answer is different depending on your level of experience and your goal, commercial volume or jut one for now.

surly, the easiest way is to just use RS232 shield and add a RS232 to RS485 converter.

I’ve been around on lots of forums over the years, and I know that when a “newbie” first asks questions there always appears to be a naivete about him and a silliness to his questions. I’m trying to ask as concise questions as possible, not wasting any one’s time, but feel that I am not getting answers to them all. I know that some people respond to a lot of posts and taking the time to fully explain (or worse yet repeat) simple details can be painful, but I didn’t ask about the RS-232 shield connected to an RS-485 converter in my last post. I mentioned that in my first post and said I was trying to find alternatives to it. In my last post, I asked about using the RS-232 shield as a hardware level converter, but using the RLP RS-485 driver to perform RS-485 communications directly through the RS-232 shield, without further hardware. Is that possible?

If not, I’d buy (or build with MAX3232) a TTL to RS-485 converter and use the RLP driver there. I understand the difference between easy, cheap, and best ways to do things. I have to fight for and make decisions among them every day, but like I said, I’m looking for a combination of the three right now rather than one over the other two. I’m looking to use the RLP RS-485 driver going forward at this point. The real question is how do I convert from TTY to RS-485? MAX3232? Serial Data Cable? RS-232 Shield? or Specialized hardware?

I’m sorry if I come off as being a rude know-it-all in my post. I am very aware that I don’t know everything, which is why I am asking questions at all. I’m just trying to help every one get my questions answered so that none of us have to deal with frustration going forward. The best way I know to do that is to ask as detailed questions as I can with as little ambiguity as possible.



Do you have a link for the RS-485 device you are talking about?

Actually no, I do not. It is itself a prototype. One of two made, and I am considering getting the spare. The goal is to see if I can query data from the device over RS-485, store them, and then expose them over an HTTP interface for query, all within a Panda II. They told me they might be able to go analog, my preferred format, but that would require them to use a DAC, which isn’t really worth it to me. Next preference is RS-232. They said they may be able to do it, but it would require more R&D, and thus more $ for the prototype. I am considering getting the RS-485 prototype and seeing if I can communicate with it, if the community here thinks that it is possible “reasonably.” I put reasonably in quotes because $30 more for an RS-485 converter isn’t a ton of money, but it could be enough to make the whole issue moot.

Back to your question, I don’t know much about the interface at this point except that there is a read-only interface to the device over RS-485. I asked them for their documentation and code samples and hoped to have gotten it by now, but have not. I am going to guess that it is based on MODBUS, which could be good since I have a C# MODBUS library I can try to port down to MF if needed.


Maybe I am not understanding your questions correctly, so lets try again please :slight_smile:

What I understand so far is that you need RS485 and not sure what way to accomplish your needs. What I also see is that we have very very limited info what you are trying to do or what you have on a high level so I can’t give you good answers…or I didn’t see where you explain your system.

You are also asking if the 232<->485 converter will handle everything (I think this is the question) and the answer is really dependent on the converter you are using and the system you are hooked to.

Now for RLP, yes this is the best way if you have enough experience about it if you can add RS485 level converter (you can solder and you can compile C code into RLP)

What I suggest is you ask a simple and direct question in a post and we will do our best to try to answer it. If you have more than one question then wait for the response before asking the next one. As you said, we answer hundreds of emails/posts daily so we have to move quickly in order to keep up.

I see you posted while I was posting. please read last answer and I will answer the new post (please try to keep posts short next time)

Easy to do on Panda

FEZ already have analog



Reverse engineering is not simple and I haven’t seen modbus lib for NETMF yet.

I tried to go through your entire post in details but I am not seeing your question and so I am not sure how to help :slight_smile:

This sounds to be for commercial application? If so then why not call GHI? I think the problem is you are not sure exactly what you need and a phone call may clear things out much more.

Sorry, short posts is not my strong point. I wrote this while you were replying, so some of it may not apply, but for the record, I did call GHI first, and they didn’t know the answer. They told me to ask here!

Okay, so I think we are in agreement that the RLP driver is the way to go to get RS-485 support on the Panda II. I can compile C/C++ using various compilers, so I’m sure I’ll figure that one out directly (maybe with more help:) That solves the software driver side of things for reading and writing values to a “COM” port which is RS-485 underneath.

My outstanding question right now is how to convert or translate on the physical layer (think OSI) from the TTY spoken natively by the Panda II to the RS-485 spoken to my external device. What is the “best, easiest, cheapest” way? The “simple” answer seems to be that I need a “level converter” between TTY and RS-485. One example of that would be a soldered MAX232 type component. There are many of those out there, including plans to make my own DIY. Another example would be to use a serial “data cable” which will have much of the same conversion built in. As of right now, with no other options, I will likely use one or the other of those choices. Just to be clear though, am I mistaken that I can use one of these components to get RS-485 communication out of a Panda II? It’s completely possible that I’ve taken something not true for granted, so feel free to correct me there.

Before I make that decision, I am wondering if the RS-232 Shield can be used as a TTY to RS-485 bridge. Put differently, I’m sure that the shield uses a driver. If I don’t use that driver and use the above mentioned RLP driver with that hardware, will it work? Could I say that the RS-232 shield is effectively just a MAX232, or is there more to it? Is that possible to answer?

Thank you all. I’m really trying to be as clear and concise with my questions as possible. “Commercial” is a loaded term here. Sure this would be replicated and sold to other people, but not really at a profit to me. Just to help the community.


Just for the record, the fact that FEZ has analog inputs is why I prefer it, but again, it reqires a DAC on the other end. The MODBUS lib I have is open source, and I have MODBUS documentation, so it shouldn’t be too difficult to do what I need one way or the other, but first things first. How to talk to the thing over RS-485:)


I got some documentation on the protocol today, and it is not MODBUS. Very simple ASCII based protocol. Should not be a problem.

The big question is how do I best convert the line levels from TTY on the Panda II to RS-485? MAX232, Data Cable, RS-232 Shield, or something else?


Thanks for calling in and talking on the phone. To clear this out to anyone else reading this in future, no you can’t write software that converts RS232 to RS485. The difference in the physical connection not in the software.

So to connect a micro (FEZ or anythign else) to RS485, you can connect RS232 shield and from there add RS485 converter, like this one

Or connect RS485 transceiver chip directly to FEZ, like this one

I think the confusion happened when you saw the RLP code for RS485. I will explain. On RS485, you may need to disable receive when you transmit or disable transmit when you receive. This has to happen very fast and so RLP driver is needed. What I recommend is you use RS232-RS485 converter because the converter does this internally automatically.

Thank you. One more question: The RLP code for RS-485 that has been mentioned and posted. What hardware have people been using with that driver? Looks like the Arduino shield you posted is one option.

Thanks again,


I would not convert to RS-232 and then back to RS-485…

I am using MAX1487. But there are better drivers that have better ESD and voltage protection. F.e.: LT1785 works much better in industrial environments because it has 60V fault protection:

Also read these tips when using RS-485:

Available drivers on RS:

I’ve attached the schematic of my Cobra extension board. Note that I’m using RS-485 in half duplex mode.

Note that standard RS-485 drivers only allow 32 nodes on a bus. Since the MAX1487 is a 1/4 load driver, it allows 128 nodes on the bus. Don’t mix different load types!

Thanks. I agree on not wanting to convert twice. There’s a lot of good information in your post, and I appreciate it, but cutting to the chase, I am going to have one device and a Panda II. I am looking now at the Arduino 485 shield posted earlier. Will that work with your driver, and is there anything of which I should be aware when using that?

Thanks again!


Do you have a link of that shield?

@ Wout - Gus had it in reply 14… [url][/url]