• 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.

CMOS/RS-232 Signaling

Status
Not open for further replies.

Noggin

Member
I have a GPS that uses RS-232 signaling that I need to communicate to a microcontroller. According to the specs, the inputs are compatible with a 0 to 5v signaling (though it can accept -15 to 15v) and the outputs swing from -5 to +5 volts.

The +5 isn't a problem, but the -5 is as my microcontroller can only handle down to 0v. Since the microcontroller can drive the input but can't take a -5v signal (rated for a minimum voltage of -0.5v) would it be safe to use something like in the drawing below?

The leakage on the MCU is about 8 uA... I don't know how much the GPS unit can source/sink though, but it does say in the paper that an "output driver is available."

I'm not sure exactly what type of diode I'd need, I just need something that can switch faster than a 4800 baud (which I don't think would be a problem). Schottky has low forward drop right? I'm looking on digikey and there are a LOT of packages... what kind of package is a through hole with two leads like just a run of the mill diode? Or does a schottky need more connections? I've never used one before.

I think we can ignore the MCU input current, so I'd need to find a diode with V(forward) drop of about .5v or less, then the resistor would be (5v-V(forward))/I

Edit: And of course the GPS and MCU share a common ground
 

Attachments

Noggin

Member
After checking this thing with an o-scope I see that under no load it actually swings from -7.6v to +7.6v. If I were to continue with the design in the drawing above I'd need to add a 5.1v zener and then worry about the resistance also working out for it... still without knowing how much current the GPS can source/sink.

I think it would be extremly wise of me to go with a line driver made for this application. While I'm searching digikey, does anyone have a suggestion for a line driver?

Has to operate off of 5v and 0v rails, any input from about 4v to 7.6v will need to output 5v and an input of 1v to -7.6 volts needs to output a 0v.

Sounds kinda like a transmission gate or SSR...
 

panic mode

Well-Known Member
I would use MAX232 or similar, you can achive same using one more resistor and one transistor.
 

Attachments

Noggin

Member
I'm looking at the spec sheet on that device, http://www.electro-tech-online.com/custompdfs/2003/11/MAX232232I.pdf

Page 2 at the top says that the driver ranger is -0.3v to Vcc+0.3v. My input will be as low as -7.6 volts... won't that exceed specifications? I don't think this is right because then you couldn't use a RS-232 signal as an input...

Futher down on page 6, it shows a diagram. Would I put inputs on 10 and 11, tie 14 and 7 to 13 and 8, then use 12 and 9 as my outputs?

Edit: Actually, I guess I could just hook they GPS output (-7.6 to +7.6) to Pin8, which would make pin9 a CMOS output... I am not sure what the terminology Driver and Reciever means, I'm thinking that the "driver" is maybe the CMOS/TTL inputs, and the receiver is maybe the 232 inputs?

I'd be hooking up the GPS to the pin8, which if its the receiver, can handle +/- 30v. Pin 9 would then swing between 0 and 5v (Vs- to Vs+). I think I would then hook up the microcontroller to pin11 and then pin14 would output 0 and 5v (again Vs- to Vs+). That would take the current load off of the microcontroller, and the GPS can accept a 0 to 5v input for signaling.

Vcc = 5v
Vs- = 0v
Vs+ = 5v
gnd = 0v
Pin8 = GPS Tx
Pin9 = MCU Rx
Pin10 = MCU Tx
Pin7 = GPS Rx
And caps...

What are C1 and C2 for? Just for cleaning up internal signals maybe? I'm going to go ahead and lay this out, thanks for reading this. My design project is OOOOHHHHH so close to being finished. Its completely my fault for not having caught this problem sooner. Garmin makes a CMOS in/out GPS and I thought that is what I had, but worry got the better of me before I hooked it up to my microcontroller (thankfully). If we in fact did have the CMOS GPS unit then I honestly believe it would be done by now.

As soon as I lay this thing out and someone confirms (confidentally ;)) that this should work, I'll lay down my $100 and order my boards :D

Edit2: Ordered the board yesterday after I REALLY figured out how to wire up that MAX232 (for note, what I have above is wrong and will not work)
 

Noggin

Member
Crapola... got my MAX232's in today. They're too wide, gotta overnight ship some smaller ones. Anyone wanna buy some wide body SOIC MAX232 for $1 each shipped?

I'm not really worried about the $2, but I know if someone here was selling the smaller ones for a buck each I'd jump at the opportunity to pick em up.
 

panic mode

Well-Known Member
You are right about using pins 8 and 9. Max232 is handy chip. Note that some versiond require 0.1uF capacitors instead of 1uF.

Explanation:
Max232 only takes 5V power from the circuit. Other voltages are generated in the chip using the 4 capacitors:
First the supplied 5V is doubled to roughly 10V (well 8-11V based on
my observations), then this is inverted to -10V. The +/-10V (or +/-8.5 in
the datasheet you have) is used to generate RS232 levels.
Chip *drives* the RS232 communication line (hence DRIVER). It also
recives from the communication line (and converts into signal level
readable by common computer devices). Communication lines are
normally VERY long and signal quality varies in pretty wide range.
Now you can say some 30-50meter doable by RS232 is not
exactly 'long' distance. Terminology like 'driver', 'receiver', 'line' etc. came from guys who were developing circuits and even tiny 30-50m
is much longer than 2-20cm trace length between two TTL or CMOS chips.
 

Noggin

Member
panic mode said:
You are right about using pins 8 and 9. Max232 is handy chip. Note that some versiond require 0.1uF capacitors instead of 1uF.
Yeah, I have the 1uF cap version. I'm not really worried about that though. The major cost of all of this was the overnight shipping on these parts... I need them tomorrow for field testing over the weekend. Over $27 for overnight delivery on these two items cause I didn't know what the DW means on TI's naming convention. Size isn't listed in the spec sheet, my fault though I should have called to confirm.

Intersil makes the .1uF versions, I would have liked to go with one of those, but digikey doesn't stock them. Just TI and Maxim... and WHY the heck are the maxim ones $4 to $5 while the TI's are under a buck?
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top