SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By colinb
#132409
UhClem wrote:One feature common to both of those RS-232 converters is that they are absolutely dependent on the computer end providing a good negative voltage on its RS-232 output.
This is exactly what I meant when I said the SparkFun RS-232 level converter he is using is an ugly kludge and has proven generally unreliable. Any RS-232 “power stealing” is unacceptable in my book, since it depends on the PC's RS-232 transceiver's unpredictable performance.
fll-freak wrote:I was aware that the the level converter steals power to generate the signal. Since it worked on talking to one computer, I assumed it should work on others as well. The proof will be in the scope traces I will collect.

But the strange thing is the EXACT same RS-232 converter with the EXACT same cabling and nearly identical routing but on different computers behaves differently!
Yes, this is because the “power stealing” depends on nonstandard and unpredictable aspects of the RS-232 transceiver on the computer. Use a MAX232 or a proper USB-UART converter to get from the PC to the 5 V logic TTL levels, or better yet, use differential signaling with RS-485.
fll-freak wrote:Yes indeed. When I first saw this problem I immediately looked for a RS-422 transceiver chip on Sparkfun. I did not see any. B&B has 232-422 converters, but the price was more than I could stomach.
RS-485 will be MUCH more reliable than RS-232 or any single-ended signaling method at ranges of over 15 feet. I recently designed a simple but robust USB to RS-232 converter board.

I'm planning to assemble a few more, and if you're interested I can send you one free to play with in a couple of weeks.
fll-freak wrote:I do not want to spend much money on this solution as it will only be temporary. My overall goal will be to go wireless with Xbee modules as I plan to place the detector in my attic and the computers I am protecting are in the basement and routing that much RS-232 cable would be difficult (and stupid).
Hopefully the wireless connection would be robust... I am somewhat skeptical of wireless communications for any critical system. It would be a shame if the shutdown message was missed and the computer got zorched by lightning. But, I know it is a pain to cleanly run cables through a house. You could run CAT5 UTP for RS-485, or even cheap 2-pair twisted pair wire, if that's any easier than the shielded RS-232 cable you're using -- you don't need shielding if you use RS-485.
By fll-freak
#132411
@Colinb:

Nice post. Thank you.

For the moment, I am logging RF data as fast as my 9600 baud connection can handle. If the current sample is the same as the last it is not sent. The receiving PC can put the data stream back together.

The PC is currently also performing the detection algorithm. Once I have refined the algorithm, that code will be pushed back into the detector. The only signal comming out of the detector would be a "Warning" and a "OMG Shutdown Now!" message. Both of these messages I would sent multiply reduntantly to avoid the issue with one lost byte.

Thank you for the offer of hardware, but I will ley you find another beta tester. My needs are short term (thunderstorm season is coming to a close) and in the long run non-existant (migrating to Xbee).

I like your idea of cat5/6 cable. In fact, when I ordered the RS-485 Sparkfun boards, I purchased the optional RJ-45 connectors for just that purpose.
By UhClem
#132418
I just remembered that I have used one of the power stealing SparkFun RS-232 converters. It was the one for the Logomatic programming but it was handy so I grabbed it.

I had it connected to a MSP430F149 and I was using a long cable. Somewhere near 100' I think. I can think of two differences from your configuration:

1) hardware MSP430 UART
2) "real" PC serial port
By Mee_n_Mac
#132419
I wonder if stealing current to make the negative swing isn't the root problem and the reason one USB works and another doesn't isn't because of some small voltage difference btw the two, but because one can supply the peak current needed and the other can't. Trying a powered USB hub would be a good experiment (though there's no guarantee that it will work). Since the system works except for some cabling you won't be using in the final configuration, perhaps it's time to get the XBees up and running. You've got until Sunday afternoon. :wink:
By colinb
#132420
UhClem wrote:I just remembered that I have used one of the power stealing SparkFun RS-232 converters. It was the one for the Logomatic programming but it was handy so I grabbed it.

I had it connected to a MSP430F149 and I was using a long cable. Somewhere near 100' I think. I can think of two differences from your configuration:

1) hardware MSP430 UART
2) "real" PC serial port
You didn't mention whether it worked for you, but obviously these crufty power-stealing RS-232 converters work in some cases. The problem is that they are not robust and may or may not perform with integrity depending on the precise situation.

Kludges like this are just not worth dealing with. A real RS-232 converter chip is so cheap ($1.05 in singles from Mouser; $0.53 from Future; only 30 cents in moderate volumes) and would work so much better.

I am surprised if you get reasonable signal integrity from RS-232 over a 100 foot cable... you are just lucky. I would certainly use RS-485 instead; it would have better integrity while *also* allowing far greater speeds.
By UhClem
#132421
colinb wrote: I am surprised if you get reasonable signal integrity from RS-232 over a 100 foot cable... you are just lucky. I would certainly use RS-485 instead; it would have better integrity while *also* allowing far greater speeds.
As I said, it was handy and worked adequately. But this was a temporary lashup on a solderless breadboard. If it hadn't worked I would of course have dug out a MAX232. Laziness triumphs.

I would always use a real RS-232 interface chip in a finished design.
By fll-freak
#132424
So I have been slaving away in my home lab and have found what most of you suspected. It was not so much a matter as to why the Linux box and Windows desktop did not work so much as how did the Windows Laptop work.

Although the digital signal from my micro are faultless, the RS-232 side (on either end of the cable) is simply awful.
FromPC.png
The above image shows a good healthy swing around zero volts. This is the signal generated by the USB-RS-232 converter on its way to the detector. This signal is not used, but is quite the centerfold for EE geeks.
FromDetector.png
The above image is the output of the Sparkfun level converter. Both images are at the same time and voltage scales. You can see the amplitude is tiny (about 2 volts at best) and is not centered around zero. There is no negative swing. All in all its a wonder any UART could see this signal.

So thank you all for this fascinating experience in Yak Shaving. What was going to have been a quick simple temporary serial implementation to get me through algorithm development has lead me places I did not know existed and wasted time I did not realize I had.

What I do know is that the Sparkfun converters I have will be pushed to the back of the parts drawer with a "There be dragons here" sign. I am now on the lookout for a nice breakout board that is not signal powered and may use a Maxim chip or similar and will work at 3.3V. Any suggestions?

<Rhetorical question>And why was this not the Sparkfun implementation in the first place?</Rhetorical question>
You do not have the required permissions to view the files attached to this post.
By stevech
#132437
yes, it's likely the RS232 driver and how it is powered. Those drivers that steal power are awful. Some kludges draw power from RTS or DCD or some such and the software must set these properly. Or one I saw wanted the software to toggle DTR at a high rate. And ye ole laptops' RS232 native were feeble.

To be truly reliable, RS232 needs at least +/- 6V swings at the far end of the cable. And the higher capacitance the cable, the lower the baud rate you can run due to waveform degradation (cable is a low pass filter).

With semi-decent cable and RS232 that meets the old intent of the standard, that being more like +/- 12V not 6V, I've run 19.2Kbaud and higher with 200 ft. of cable.
By fll-freak
#132455
This weekend we are likely to get a few good thunderstorms form the hurricane coming through. It is unlikely my new 232 or 485 parts will come in time. So I am looking for plan-B to collect data to fine tune my algorithm.

It comes to me that my detector circuit has both +5, -5, 3.3V and ground. The +-5 are used for the amplifier stage but could easily be also used to drive the RS-232. But the logic level from the micro is 3.3V referenced to ground.

In my stupidity last night, I tried to create a simple switch using a simple 2N2222A. From +5 I went through a resistor, then through the transistor and then to ground. The base was driven through a resistor from the logic source. This failed miserably as the base to emitter voltage was always at least 5 volts and hence the transistor was always on.

So with parts I could get at Radio Shack and those in my stock pile (sorry, no inventory but includes resistors, caps, transistors of various sexes, fets, diodes, ...) how can I switch +-5V with a 3.3V source?

Just a hint for the right Google keywords would be welcome (common base follower, totem pole, ...)

Would this work as a Plan-B RS-232 driver?
By UhClem
#132464
fll-freak wrote:It comes to me that my detector circuit has both +5, -5, 3.3V and ground.
Connect the -5V directly to the 10uF capacitor in the converter.
By Mee_n_Mac
#132469
Could you use an optoisolator in place of your 2N2222 ? Not sure if you'd find one at RS these days. :?
By fll-freak
#132471
Could you use an optoisolator in place of your 2N2222
Mee_n_Mac, you win the prize! This is an simple clean ellagant solution (and I have a dozen optoisolators in my stash!).

Guys at work had me using opamps, comparators, and circuits with a dozen transistors. Go figure.

@UhClem: Nice idea and that was my top solution till the optoisolator!