PDA

View Full Version : RS232 to Propeller Interface from Portable GPS



wjsteele
05-25-2010, 06:47 AM
Hmmm... I'm pulling my hair out on this one.

I've got a Garmin 72 Handheld GPS. I've connected the NMEA output to Pin 7/8 (TX/RX) on the propeller through a 2.2k resistor (on both.)

I can read the data perfectly when the GPS is running on battery power, but when I plug the GPS into the 12 volt accessory outlet of my car, the propeller dies. (It's actually not damaged, because I didn't let it sit there and cook... thank you, Parallax, for making a robust little chip!!!) I might add, the propeller is running on my 12 volts system as well, through the 5.0 and 3.3 regulators.

Anyway, I've looked everywhere in the forums and have found the sticky talking about converting 5v to 3.3v, but this seems to be more than 5v. Also, it seems that the voltage swings from -5.5 to +5.5 as far as I can tell, which seems to make sense, since the GPS is actually RS232 and not TTL, right?

What have others done here?

Bill

JonnyMac
05-25-2010, 07:50 AM
If it has a true RS-232 converting in it you could be seeing swings +12ish to -12ish when plugged in. You might try changing the resistor (connected to your RX pin) to 22K -- this is typically used with "true" RS-232 levels going into a micro.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA

Peter Jakacki
05-25-2010, 08:17 AM
MAX232'ish chips never really attain +/- 9V (never 12) and it is not uncommon to measure around +/-6V without load in many production runs (why bother!). If you use 1uf caps on the chip in place of 100nf then the outputs hold up better. So Bill, I'm glad you haven't fried your Prop but you know that running Prop I/O direct to external devices is asking for trouble. If it's internal then it's a known quantity but to be on the safe side with external connections it is always wise to use current limit resistors. For an output I would use something in the 100R to 220R range and for the input in the 1K to 100K range along with a pullup/pulldown. For serial inputs there is absolutely no problem with using a 100K series resistor and it will certainly protect against much higher voltages too.

BTW, there is always a problem as well with ground potentials between units that have mains supplies. Many switch-mode PSUs will even "bite" you if you touch the DC leads.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

wjsteele
05-26-2010, 11:17 PM
Ok, I've put in a 10k pull-up resistor between the pins and 3.3v as well as a 100k resistor between the pins and the TX and RX of the GPS pins, which are the only two pins connected.

It still works perfectly when I plug in my GPS running on battery power... but again, as soon as I plug the GPS into the 12volt accessory outlet, the prop shuts down.

I really don't understand what I'm missing here. I've tried the above on just the Rx line of the prop and get the same thing. Even if there was a 25 volts swing between 0 and 1 on the RS232, the resistors I have in there should be enough to prevent this, shouldn't it? One other thought... it seems to be some "difference" between the tx and rx that is causing the problem... should I pull the tx (which I don't actually use) to ground instead of to 3.3v? (I've also tried using a common ground, but get the same thing.)

BTW... I'm using the GPS_IO_Mini.spin file for my i/o with Rx on pin 7 and Tx on pin 8.

Bill

max72
05-27-2010, 07:20 PM
Try to operate the propeller from the battery, and the GPS from the 12V supply, connecting together the two grounds.

Massimo

wjsteele
05-28-2010, 05:37 AM
Massimo, that actually worked. So, I tried to run them both at the same voltage, 12v with the common ground and it still died.

So, that means that I guess my resistors at 100k are not big enough, huh?

I think what I'll do to insure they are protected is use a transistor in there as well... that way, regardless of what comes in, the pin will only get 3.3v. The worst thing that'll happen is that I'll fry the transistor that way.

Thoughts?

Bill

max72
05-29-2010, 04:23 AM
If your 12V operated GPS works with a battery operated Propeller the problem is not on decoupling resistors. The GPS signal is already generated using your 12V supply, and the propeller still uses 3.3V.
This problem arises often with servos. If you have a servo and the propeller using the same power source you can have voltage drops, resetting the propeller. So using two independent battery set with common ground solves everything.
Your set-up behaves in the same way, even if cannot understand the reason, and only using your car 12V. It looks like from the battery you have an unstable power supply, and the Propeller suffers it.
A possible solution, that sometimes works, is to add a big capacitance between the 3.3V and the ground. A big fat electrolytic capacitor could be able to help the propeller when the power is not stable. Somewhere on the site someone suggested also to use a supercap... Being biased at 3.3V the capacitor voltage rating is not an issue..
Massimo

David B
05-29-2010, 05:00 AM
I have no idea what would make the propeller shut down, but why stress it unnecessarily?

Why not feed the RS232 signal through a resistor to a pair of clamping diodes, arranged so one conducts to ground when the input falls below ground and one conducts to 3.3v when the signal exceeds 3.3 volts. Then your signal should fall pretty much between ground and 3.3 volts.

Feed that signal through another resistor to the input pin. That might help take some of the stress off the propeller.

Or maybe just use an optocoupler.

SkyKit
05-29-2010, 07:37 AM
I used to resolve the issue of adapting RS232 to TTL levels using an NPN transistor and it worked nice always. Never fried. In this case, you'll get out of levels bet. If the problem continues beyond this ( and I afraid it'll do) explore other solution like Massimo suggested. For example, did you checked the voltage at VDD and GND pins of the Propeller when shutdown?

Post Edited (SkyKit) : 5/29/2010 2:21:48 AM GMT

max72
05-30-2010, 03:06 AM
If you are connecting the Propeller to the same GPS pins, when connected to a battery or your car 12V, I expect the serial signals levels will not change. Obviously an oscilloscope would settle the matter, but a set of serial pin in my mind should send the same signal level, either TTL or RS232, independently of the voltage supply. So my educated guess is the serial data levels are not changing, and the cause is elsewhere.

Can you operate the propeller alone from the 12V battery, maybe blinking a Led?

Massimo

wjsteele
05-30-2010, 04:27 AM
Massimo, the propeller works perfectly whether running from battery or the 12 volts... same thing for the GPS. If the propeller is using 12volts and the GPS using battery or vise versa it works perfectly. It's only when both are plugged into 12 volts that the problem appears.

I've tried this with two different propellers (Parallax Scmartboard and Gadget Gangster's Propeller Platform SD board) and both do the exact same thing.

Max72, I have an LCD display on the propeller and it's just running the GPS VGA test, so I know when it's working.

I've checked the voltage of the prop while it is running and the power level is stable at 3.3v. The 5.0v regulator on them both are right on as well. When I plug the GPS in, it stays the same.

BTW... I've tried supplying the propeller everywhere from 4.5v to 12v all with the same problem. The propeller will run for hours without any issue if the GPS is on battery power. (The battery lasts about 4 hours in the Garmin that I have.) The data is perfectly stable... right until I plug it in. Also, I've confirmed that the GPS is working becuase the computer's RS232 shows the data just fine, even when plugged in to 12 volts.

I'm going to try and isolate everything and start from scratch. I must be overlooking something, but I just can't imagine what.

Bill

mctrivia
05-30-2010, 04:55 AM
It seems strange that surge current would be an issue from a car battery which can often put out 1000A but max72 sugestion of placing a super cap(1F is overkill) in parallel with the 3.3V rail is good thing to try.

Hope you figure it out as I want to hook my garmin 60CSX up to a prop.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lots of propeller based products in stock at affordable prices. (http://propmodule.com/catalog/ref.php?refid=c81e728d9d4c2f632)