Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

RS232 to TTL

Status
Not open for further replies.

Marks256

New Member
This topic probably has been discussed plenty of times, so i am sorry. I tried to search for it, but apparently "TTL" is too short to be considered a search word... :(

I want to convert RS232 to TTL. How would i do this?

I heard that RS232 can be anywhere from +30 to -30 volts. I don't think TTL would like that much power... Is there a chip that can convert this to TTL? I think there is something called a "MAX232", is that the chip?
 
I did a search for RS232 in Google abouit 4 years ago. One of the hits was www.arcelect.com/rs232. It states that the 0 state is between +3 and +12 Volt and the 1 state is between -3 and -12 Volt. So your 30 Volt is wrong. (by the way, voltage is not power).

I used the ST232, but I expect the MAX232 is equivalent.

I don't have a data sheet but I think, from memory, they are compatible with TTL.

Why use TTL? CMOS is more convenient.

I just found this https://www.electro-tech-online.com/threads/rs232-on-pic-16f877a.25738/
 
Last edited:
Marks256 said:
I heard that RS232 can be anywhere from +30 to -30 volts. I don't think TTL would like that much power... Is there a chip that can convert this to TTL? I think there is something called a "MAX232", is that the chip?

You won't get ±30 V from your computer because the voltages are limited to ±12 V. I understood that you only need to receive data? if this is the case, you need just a MOSFET to convert RS-232 levels to TTL levels.
 
Or a bipolar transistor - but a lot depends what you're trying to do - if it's for a PIC you can use just a single current limiting resistor, but you can't use the hardware UART if you do, because that requires the inversion of a MAX232 (or transistor).

My tutorial hardware pages have a MAX232 board.
 
Some amateur radio transceivers connect to a PC by means of an RS-232 to TTL interface. A friend asked me to assist him in troubleshooting a relatively simple "convertor" so I reviewed the schematic. Even at my level it was obvious that the circuit could not develop what I'd call real RS-232 from a TTL input. I eventually learned that the circuit would work on many PCs because the serial port/PC was happy with what is saw - which was more or less 0 volts and +6 or 7 volts. We did get the convertor working and it worked quite well. Authors of several articles warned that not all PCs will work with the convertor. It also only works in one direction - in that you send until you are done or you signal the TTL device and then the TTL device dumps everything. Not great but sufficient for the application.

Advise if this is something that might work and I'll see what I can find.
 
Ok, i just figured out how the com(rs232) works. Now, how would i change it to ttl(±5vdc)? I would like to transmit and receive data.
 
Hey Marks,

The MAX232 is the IC that does the job, check out the datasheet (page 17)

Code:
http://datasheets.maxim-ic.com/en/ds/MAX220-MAX249.pdf

Maxim also gives out free samples of 2 ;)

I have used the MAX232 in designs before, and its quite simple to use, just connect the TTL RX/TX to your Microcontroller's UART.

Hope that helps

Bizzareo.
 
A couple of transistors and or diodes work just as well if you don't want to buy a MAX 232. The transmit of 5 volt TTL is compatible with RS232 signal levels so you don't have to do anything for that unless you're going more than a couple of feet, in which case you'll want to feed the TTL signal into a transistor with a current limiting resistor to switch a 12 volt line. The RS232 receiving port should have some kind of pulldown resistor so you don't need a totem pole driver unless you're transmitting high data rates. Receiving can be easily filtered using a clamp diode to ground to make the negative voltage equal zero volts, and a zener diode to clamp the +12 volts to 3 or 5 volts.

I know that sounds a lot more complex than 'just use a max232' but understanding how to convert data signals between different voltage levels is also a good learning experiance in electronics.
 
Last edited:
Sceadwian said:
Receiving can be easily filtered using a clamp diode to ground to make the negative voltage equal zero volts, and a zener diode to clamp the +12 volts to 3 or 5 volts.
You don't need both a Zener and a diode since the Zener will clamp negative voltages to about -0.6 Volt since it will conduct in its forward direction.
 
Ok, so what would that circuit look like?
 
My personal favorite RS232 level shifter circuit is this one, which I originally found at sparkfun:
https://www.sparkfun.com/commerce/product_info.php?products_id=133 (commercial board)
https://www.electro-tech-online.com/custompdfs/2006/12/RS232-Shifter-v2.pdf (schematic)

nothing but a couple transistors, some resistors, diode and a cap. I'm sure 90% of us could build a dozen of these things out of our parts bin, no problem! The advantage of the MAX232 circuits are that they are better about meeting the actual RS232 specifications for voltages and all that... whereas the cheaper ones (like this one) usually don't... however, I've never had a single problem using the cheaper version, most modern serial ports are pretty flexible.
 
looks pretty easy. i will build one when i get some time
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top