circuit_projects

Circuit Projects

Electrical/Electronics Blogger

Circuit's Projects :

Return to Projects

RS232 - RS485 Converter with Automatic RX - TX Control

Project Summary

Today, although the wireless technology grows very fast, the long distance funicular communication still keeps its popularity. The reason is obvious that cost and complexity is high at the wireless communication.

Project Description

RS232 is one of the most used, easy to develop and easy to apply communication protocol. We generally encounter to this standard at the MCU applications. But it has some restrictions. It allows us to use maximum 15 meters cable. Good wiring, low baud rates and less noisy mediums may allow us to exceed this limit a little more. The main problem here , when the distance increases, the noise at the common ground line also increases. Another issue, RS232 allows only two devices to communicate reciprocally. More than two devices can not communicate at this line and we need another solution for this situation.

RS485 is the standard that solves this problems. The main difference is, RS485 transfers the data depending on the potential difference between the two communication wires. The polarity defines the logic state of the signal. You can transfer data up to 1220 meters far away and with a rate up to 10 Mbs. 32 devices can join the RS485 network.

While transferring the data, MAX232 converts the signal coming from the DB9 connector to TTL/CMOS level. Then MAX485 transfers the input signal coming from the MAX232 to the RS485 line as a voltage difference. While receiving the data, MAX485 detects the data at the RS485 line and transfers it to MAX232 then output can be taken from the DB9 connector.

Converter controls the “Receive” and “Transmit” modes automatically.

R1, R2 : 1K 1/4W Resistor
R3, R4, R5, R11 : 2.2K 1/4W Resistor
R6, R7 : 560 Ohm 1/4W Resistor
R8, R9 : 47 Ohm 1/4W Resistor
R10 : 120 Ohm Resistor
C1 : 10uF 50V Electrolytic Capacitor
C2, C4 : 100n Polyester Capacitor
C3 : 10uF 16V Electrolytic Capacitor
C5, C6, C7, C8 : 1uF 16V Electrolytic Capacitor
D1 : 1N4007 Diode
L1, L2 : Red and Green LEDs
Q1 : BC327 PNP Transistor
U1 : MAX232N
U2 : MAX485CPA
U3 : LM7805
J1 : DB9 PC Mount Female Connector
U4, U5 : 2 Terminal PCB Terminal Block

The PCB file is provided in pdf format. You can apply it to the board by using the ironing method.

Figure:1

Figure 1 

Red LED indicates the transmitting and green one indicates the receiving process. When there is no data transfer, to keep the data line at a constant voltage leve , two 560 Ohm resistors are connected to the line. One of them is powered and the other one is grounded.

Figure:2

Figure 2 

The main advantage of this converter is, it can detect the incoming/outgoing data and switch the TX and RX modes of MAX485. It controls the DE and RE enable bits automatically. The RS485 lines A and B are taken from the screw terminal block. The connections are shown in the layout that is inside the downloadable zip package.

Project Files

File NameFile Size
PCB Layouts and Schematic232.12 KB
Tags: RS232, converter

Comments on this Project:

By Sergio Rodríguez 0Score: 

5 years ago:  Estimados Señores, he estado tratando de descargar el archivo que contiene PCB layouts and the schematic y siempre baja roto y luego no puedo abrirlo. Le agradecería si pueden verificar el estado de ese archivo para poder descargarlo.
Muchas Gracias
Sergio

By Sergio Rodríguez 0Score: 

5 years ago:  Hello Sirs, I have tried to download the file with PCB layouts and the schematic and all the times is broken. I hope that you can verify that file to make a satisfactory download.
Thanks and Regards.
Sergio

By jack 0Score: 

5 years ago:  Hi Sergio, I just downloaded the file and no problem occured. Please try again and if you still have problems please write with more detailed description. Regards.

By Sergio Rodríguez 0Score: 

5 years ago:  Thanks Jack, I have tried again and file has downloaded fine now.
Best Regards.
Sergio.

By Sergio Rodríguez 0Score: 

5 years ago:  Congratulations Sirs. It is a very goog and useful project.
Regards.
Sergio

By Sergio Rodríguez 0Score: 

5 years ago:  Hello Sirs.
I am here again. I have assembled this circuit and have a problem. When I try to send data, pin 3 of MAX485 (I have used SN76175) stay in low state (0.28 volt) and MAX485 don´t work.
I hope that you have any solution.
Thanks and Best Regards.
Sergio

By bigmac 0Score: 

5 years ago:  Hi, are you sure that SN76175 is the equivalent of MAX485? I couldn't find any datasheets for SN76175.

By Sergio Rodríguez 0Score: 

5 years ago:  Sorry I have done a mistake.
I beg your pardon.
I have used SN75176 , not SN76175.
Thanks again.
Sergio

By jack 0Score: 

5 years ago:  Hi Sergio, I just checked the assembled circuit. When there is no transmit, the pin 3 keeps its high state (6.5V), when I transmit data it goes to low (2.3V). So it works properly. SN75176 can be used instead of MAX485 as you know. But are there any other difference in your circuit?

By Sergio Rodríguez 0Score: 

5 years ago:  The only diference I have is SN75176 and my LM7805 give me 5v like the most high tension. How do you have 6.5 volt.
The BC327 never change his state and pin 3 from SN75176 is ever low (0.28v). Pin 12 from MAX232 keep always BC327 in the same state.
I don´t know where is the problem.
Thanks for your answer.

By Sergio Rodríguez 0Score: 

5 years ago:  I have seen the tx led blinking.
But nothing in the out of SN75176
Thanks Jack.

By Sergio Rodríguez 0Score: 

5 years ago:  Wait a minute please.
I forget to wire TR emisor to Vcc.

By jack 0Score: 

5 years ago:  6.5V is the result of an input signal with a magnitude greater than 5V. It was only to show the toggle between the high and the low states. I am waiting the result after connecting the emitor :) I hope it will be ok this time.

By Sergio Rodríguez 0Score: 

5 years ago:  Well. It seems to be working now, may be fine.
I have not experience about this.
I think that have a weak signal level in the out of SN75176.
I have teste (pin 6-7) with a led and serial resistence (500 ohm) and blink.
In pin 3 I have 0.28v with no data and fluctuates between 0.34v - 0.56v with data trasmition. I just have a digital multimeter. 8-))
I beg your pardon again.
Best Regards.
Sergio.

By Sergio Rodríguez 0Score: 

5 years ago:  Hello Sirs.
I am working in a develop to connect the computer with my car.
I have a Ford car with ECC IV DCL ECU (not OBD2) that has a RS485 communication balanced lines D( ) and D(-). But my assembled circuit has between A-B 1.49V , A-Ground 3.2v and B-Ground 1.73v and the ECU has between D( )-D(-)4.53v D( )-Groung 4.77v and D(-)-Ground 0.24v
What do you think about that tensions levels.??
Could this assembled circuit work whit my ECU. ??
I have tryied to establish communication with ecu but nothing happend.
Thanks and Best Regards.
Sergio

By Sergio Rodríguez 0Score: 

5 years ago:  Hello Sirs.
I am working in a development to connect the computer with my car.
I have a Ford car with ECC IV DCL ECU (not OBD2) that has a RS485 communication balanced lines D( ) and D(-). But my assembled circuit has between A-B 1.49V , A-Ground 3.2v and B-Ground 1.73v and the ECU has between D( )-D(-)4.53v D( )-Groung 4.77v and D(-)-Ground 0.24v
What do you think about that tensions levels.??
Could this assembled circuit work whit my ECU. ??
I have tryied to establish communication with ecu but nothing happend.
Thanks and Best Regards.
Sergio

By Sergio Rodríguez 0Score: 

5 years ago:  Thank you Sirs.
I can do it work, with a few changes.
Best regards and Merry Christmas.

By jack 0Score: 

5 years ago:  Hi Sergio,

I couldn't write for a few days sorry. Did you change the output resistors to set the line voltage level?

By Sergio Rodríguez 0Score: 

5 years ago:  Hi Jack. Yes, I did it.
You can see that here
http://www.postimage.org/image.php?v=PqQCgbA
It´s the Ford way.
Regards.

By Jorge G. Toral 0Score: 

5 years ago:  Hello. What could happen if there is no resistor array on the MAX485 bus output/input? I mean, if the A-B terminals is taken directly to the bus. Is there an advantage?

Thanks in advance.

By Z.R. 0Score: 

5 years ago:  Hello,
I want to design a component to connect 2tx signal from 2 RS232 port to a RX of a RS232 port for communication.Can you help me?
Thanks.

By jitender 0Score: 

5 years ago:  Hi,
I have assembled two rs232-rs485 converter as in the circuit.
Two rs485 lines are cross connected and two rs232 ports are connected to pc.Red, Green LED's are blinking but I am not receiving any data.
I have not changed anything. any solution?
TIA.

By jack 0Score: 

5 years ago:  Cross connection is not the proper connection for the RS485 network. You must connect all the A outputs together and all the B outputs together. How many converters you use doesn't matter.

http://www.st.com/stonline/products/families/analog_and_mixed_signal/interface_ics/related_info/images/typhalf.gif

By jitender 0Score: 

5 years ago:  Hi,
I did what jack has said, but now neither led's are blinking nor I am receiving any data. this is tha connection I am using...

http://www.postimage.org/image.php?v=Pq1RHcc9

TIA

By Sergio 0Score: 

5 years ago:  Hi jitender. Connection seems to be OK, if your converters has no troubles when was ensambled, I think you have to review your soft.

By Dilip Vora 0Score: 

5 years ago:  yes i have commeted

By Siddharth 0Score: 

5 years ago:  Sir can we use the circuit for RS485-RS232 converter, or is it can work only as RS232-RS485 converter. Please do clarify it
Regards

By Siddharth 0Score: 

5 years ago:  Can the circuit given work as a RS485-RS232 converter?
Regards

By Jack 0Score: 

5 years ago:  Hi it is both RS485 to RS232 and RS232 to Rs485 converter. Working bidirectional.

By Nischay Kumar 0Score: 

5 years ago:  Hello author,

i'd like to do RS485 comm. between micros only (no PC) and since the logic high is 5+V and logic low is 0V, do i still need Max232in the above circuit ?

By Hello Friends 0Score: 

5 years ago:  I have tried this smart project, it is working fine for receving message from my 89S52 uC based device but i could not broadcast the msg to that device.

I have tried 00abc

my device is supposed to send back the data once received.

will there anything i need to do with uC to make it slave to lisent?

Thanks

By Sebastian 0Score: 

5 years ago:  In the photo te resistors color indicated that:
R1 and R2 are 10K
R3 to R4 are 33K
Please Check this values.
The color in the photo is orange, not RED. Somebody test and use this circuit?

Best Regards!

By jack 0Score: 

5 years ago:  They seem orange in the photo but they are red in real. Sure many people built this circuit and using it.

By Sergio 0Score: 

5 years ago:  To see if interface is working, anybody can add some leds over RS485 line like above in picture.
Best Regards

http://www.postimage.org/image.php?v=PqFvZur

By Babak 0Score: 

5 years ago:  Hi dear.
I want connect modbus with rs485 to micro.can i use this project with auto rx/tx beacuse my modbus is 2 wire.

By Babak 0Score: 

5 years ago:  Hi Dear.
Please send final circuits with last changs.i want build this project but i cant find last version of circuits,PCB and components list beacuse in each comment its change.

By Sergio 0Score: 

5 years ago:  I have tried the original circuit and think that work very very good.

By babak 0Score: 

5 years ago:  Hi Dear.
I have try to do this and work probably

By rudy fernandez 0Score: 

5 years ago:  What I like the most from this circuit is its flexibility to use the two types of communication ports. At least I won't have to rely on RS232 alone if the network equipment has only RS485 port. Thanks!

By MANU 0Score: 

5 years ago:  SN75176 is equivalent to MAX485 ?

By Andy P 0Score: 

5 years ago:  Tried to download the circuit, got the file downloaded by when trying to extract the jpg file nothing happens.

By ary 0Score: 

4 years ago:  can you give me information all about instalasi all component to PCB, for example Base,emiter,colector to PCB

By Roel 0Score: 

4 years ago:  Can I swap out the Max232 for a max3232 and the Max485 for a max3471? I want to run this off A 3v psu? Or would there be more changes?

Thanks,

By j. johnson 0Score: 

4 years ago:  wow! this sounds an interesting circuit. thanks for all your recommendations :)

By amer 0Score: 

4 years ago:  when the circuits is done, what is the baudrate of the serial com?

By typhoon 0Score: 

4 years ago:  the baudrate depend on you cp and mcu decide.

By Tsog 0Score: 

4 years ago:  Hi

This converter's schematic ?

By synyuno 0Score: 

4 years ago:  Hi friends,
I want to connect between microcontroller and PC with this converter. the converter responses receive or transmit data, but data is not correct. Example : when i send 'ABCD', another converter would received '????>~'.

Can anybody help me
This is my project
http://www.postimage.org/image.php?v=Ts1cxBhJ

By synyuno 0Score: 

4 years ago:  Hi friends,
I want to connect between microcontroller and PC with this converter. the converter responses receive or transmit data, but data is not correct. Example : when i send 'ABCD', another converter would received '????>~'.

Can anybody help me
This is my project
http://www.postimage.org/image.php?v=Ts1cxBhJ

By Hexathlon 0Score: 

4 years ago:  Hi Sir,
I have built the circuit with all connections as shown.
But it is working good in uni-direction only.
If i give some data from 485 to 232 it receives but don't work for reverse.I have used BC557 in place of BC327.

Please suggest me solution.

Regards,
Hexathlon.

By Cassandra 0Score: 

4 years ago:  Hi,

May I know what is the purpose of R10?

Thanks & Regards
Cassandra

By Cassandra 0Score: 

4 years ago:  Hi,

What is TR emisor that Sergio was talking about? I've built my circuit and seems like not working. Pin 3 from Max485 is always low and no outputs from Max 485. Please help me.

Thanks & Regards
Cassandra

By alex 0Score: 

4 years ago:  Buenas, realice el circuito pero no entiendo como probarlo. Alguien puede ayudarme?
Que se supone que debo hacer con U4 y U5? porque hay dos?
Muchas Gracias

Hi, I have donde the circuit but now i dont know how to test it. Can someone help me?
What am i suposed to do with U4 and U5? why are too of them?
Thanks

By Dhaval 0Score: 

3 years ago:  Hi,
Sir i am using the same circuit as shown in figure but only uni-directional communication is taking place(i.e. transmitting).Actually i have done two changes 1. i have used Transistor 2907 in place of BC237 and given supply voltage of 3V in place of 5v.

Am i doing something wrong please help me out.

Regards,
Dhaval

By saif 0Score: 

3 years ago:  hi can u plz explain the mechanism f how the auto data transmit detect works?

By sam 0Score: 

3 years ago:  Is it possible to directly connect the RS-485 lines RX,TX & GND to RS-232 RX,TX & GND ?????

By Robert 0Score: 

3 years ago:  Is the photo on this site the right side up???
I have produced the board exactly as it is in the PDF File.
Unfortunately it doesn't work and the LM7805 becomes very hot and it is pulling almost 1 Amp.
Is the PDF-File wrong side up???
My board looks like you put your board on the pictures above next to a mirror and look at it in the mirror.

Please help me with the answers fast.
please mail me: .(JavaScript must be enabled to view this email address)

kind regards
Robert from Austria

By Alexander 0Score: 

3 years ago:  Hi guy

I have built the device but this is not working anybody help me why no function??

By Alexander 0Score: 

3 years ago:  Hi guys,

Again me, I was testing the converter for a long time and after a lot of mistakes, I check and the converter works very good, I just changed a couple of resistors. If you want you can check out in link.

http://www.postimage.org/image.php?v=PqQCgbA

By gokkul 0Score: 

3 years ago:  Thanks for the circuit it works great. How long do you think i can run the wire (i tested it with a short cable and it works), will any modification be needed if i run the AB wires for a few meters.

By Angel 0Score: 

3 years ago:  Hi gokkul, RS-485 standard allows wires to be up to 1200 meters, depending on speed (115200 kbit/s on 1200 m is okay). On long distances and high speeds termination and must be provided. Shielding must also decrease noise. Read here for example: http://www.maxim-ic.com/app-notes/index.mvp/id/763/CMP/WP-1

By syavash 0Score: 

3 years ago:  hi dear sir
i have assembed and tested your board (with special thanks)
i have designed a circuit that has rs485 data output . when i connect it to your board it works well but if i connect more than 4 nodes, none on them work
when we use your board in the place of the server (computer) then the client circuits must be in which shape of below?
1- no pull up / pull down resstor for the A and B points of slaves
2- we should pull them up/down via a greater resistor such as 4.7k
3- or can we change the 560ohm resistors of your board to 4.7k and then use 4.7k in all the nodes too?
thanks

By Jensen 0Score: 

3 years ago:  
Thanks a lot! Usually I buy RS232 to RS485 converter, now I will make my own!

By Rangel 0Score: 

3 years ago:  I rode the board, but it can only receive data from RS-485 network. I tried to send data to the network RS-485 and failed. I noticed that the green did not rise.

Jonathan Gowar

2 years ago:  I've built this circuit, with the intention of communicating with an RS485 device.

I am using Linux and am using modpoll, in conjunction with the circuit.

The device in question has GND, A(+) and B(-), which I've wired to the block contacts. There is nothing to wire in to the +7-30V terminal -- perhaps that's an oversight on my behalf and this does actually require an external power source?

Upon connected the converter to my laptop, and configuring modpoll with communication options applicable to my device I get nothing. The console saying "Response time-out" and neither of the LEDs show any sign of communication.

The only alteration I noticed on the board was that C5-8 and NP, not polarised; I don't know if this would make a difference.

Are there any tests I can run on the board, to ensure basic operation?

Jonathan Gowar

2 years ago:  An external 5V 250mA PSU seemed to give me some results, with both TX and RX LEDs flashing, I did not connect the GND from the device to the converter. Only now, using modpoll, I don't get any returned values.

Jagdish G
By Jagdish G (0) 0Score: 

1 year ago:  Hi Can any one Help in solving issue in working with this circuit.

I am able to receive the my Board which sends data "TEST" in response to that i will be giving command "OK" in hyperterminal.

I verified Scope traces of logic RE DE A B didnt get any clue...

MCU board is also having 485 Line receiver with 3.3V operated Chip.. i am using same circuit which is in post.

yogesh Iggalore

1 year ago:  hello sir,

yogesh Iggalore

1 year ago:  hello sir,
i have problem in getting BC327 transistor can you please help me out on this, and also i need circuit explanation , working in detail ,,,,,
thanks in advance ,,,,,

ion George
By ion George (0) 0Score: 

1 year ago:  I am sorry but i cannot make it working
The two green leds are ON.
When i send , i get an echo on the same port, but it is not data i send. It is always the same , but not my data.
Please sugest what to do
I tried to eliminate the rs 485 and just connect the two max and i can send from one port to other, so the max232 works correctly
When i caoonect the rest of the circuit, the Green led gose steady ON.
The red, flash on when i send data
Please help
Ion

yogesh Iggalore

1 year ago:  hi ion George ...
Good morning :)

yogesh Iggalore

1 year ago:  Same problem i faced , you just reverse the pullup and pull down connection , it will work ,,

ion George
By ion George (0) 0Score: 

1 year ago:  hello yogesh
no luck
let me explain
when i do not conect the transistor and rs485 chip the green and red lights are OFF
when i connect the transistor circuit and the 485 chip both green leds are ON ( i build two circuit to test first between them)
When i send, i always get an echo on the side i transmit, but it is not the data sent. It is always the same but not what i send.First let' s solve the receive led to be OFF in idle.
What are the voltages i am supposed to read at transistor, and at leds in idle state ?

ion George
By ion George (0) 0Score: 

1 year ago:  Hello yogesh, which pull up and down ?
For transistor or for line A and B
Please reply to .(JavaScript must be enabled to view this email address)
Thanks

chintan Raval
By chintan Raval (0) 0Score: 

1 year ago:  i have made RS 485 to RS 232 converter and interfaced it to comm port .the data at 485 comes from plc ...
can you please post approx circuit for this converter...
as mine circuit is not receiving data from plc....

Fernando Mazzaferro

1 year ago:  Is just what I was looking for! I want to add a TTL header, I connect to R1OUT and R2OUT directly? or I need to put a jumper selector TTL-> TTL-232 or> 485? thanks from Argentina :)

Adri Garcia
By Adri Garcia (0) 0Score: 

1 year ago:  Hi everybody!! I have made the circuit and i have communication between RS485->RS232 but not in the other direction. Can somebody help me with that?? Is there any solution?

Thanks in advance from Spain.

Login or Register to post comments.
x
Like free stuff?
EEWeb Weekly Giveaway Sponsored by Mouser This Week: TI Low Profile NEXFet power supply dev kit!
Enter Here
Login and enter if you're already a member.
Click Here