Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Serial stream diminished....failure? — Parallax Forums

BS2 Serial stream diminished....failure?

steve_bsteve_b Posts: 1,563
edited 2004-11-25 21:38 in BASIC Stamp
Hey guys,

I have a BS2 w/ accelerometer on the back of a radar dish monitoring vibration (for possible gear train problems).
I'm using the programming port (p16) to output the data which is then read with a monitoring PC.
Things work great....

Recently we lost the data stream.· I hooked up an oscilloscope and I could see the data...but it was at a lower voltage level then previously.
Does this mean the RS232 driver on the BS2 is kaputz?

A few times before we had lost the data stream and in the midst of connect/disconnecting wires, it all of a sudden appeared.
We ARE running about 200ft; which is within spec (I think spec is 150m).
Anyhow....some thoughts were noise or capacitance on the line (as it runs close to some power cables too).

I don't recall the voltage levels on the scope...but it sure wasn't +/-15Vdc and if it was at least TTL, it would work.

Anyhow....is this "diminished" voltage level of the data stream a failure mode of the rs232 driver on the BS2?

thanks

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve
http://members.rogers.com/steve.brady
http://www.geocities.com/paulsopenstage

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-23 19:16
    The return voltage on the RS-232 'p16' port is taken from the RX pin. In other words, the PC (or whatever) generates an 'idle' voltage on its TX pin, which becomes the BS2 RX pin. The BS2 then modulates that voltage with its SEROUT data, and sends it back on the BS2 TX pin, which becomes the PC's RX signal. (This also results in every bit sent to the BS2 being echo'ed back to the PC. That's not a bug, that's a feature.)

    This is a very ingenious approach, which takes just 1 or 2 transistors to implement. So, if this is not working, either the PC's transmit voltage is having troubles, the wire is intermittent, or one of the BS2 transistors is having troubles. I would bet the PC's RS232 driver is having trouble, or the wire has a bad crimp somewhere.

    RS232 'standard' is 50 feet, by the way, not 150 meters. That's for 19,200 baud. If the 200 feet has worked for you before, don't let it bother you. Good cable with good grounds can extend the distance easily.
  • achilles03achilles03 Posts: 247
    edited 2004-11-23 19:43
    On a tangent, the fastest I've been able to sample (and write) acceleration data from a lowely 8bit ADC was about 170 Hz. That means any vibration over, say, 20 Hz might cause aliasing. For instance, if you get vibration at 40 Hz, you'll only manage about 4 samples over the course of a vibration cycle, and you won't be able to make sense of it. Are you monitoring the accelerometer for magnitude, or really low frequency vibration? Or sampling it some other way altogether? smile.gif

    Dave
  • steve_bsteve_b Posts: 1,563
    edited 2004-11-23 21:01
    allanlane5 said...
    The return voltage on the RS-232 'p16' port is taken from the RX pin. In other words, the PC (or whatever) generates an 'idle' voltage on its TX pin, which becomes the BS2 RX pin. The BS2 then modulates that voltage with its SEROUT data, and sends it back on the BS2 TX pin, which becomes the PC's RX signal. (This also results in every bit sent to the BS2 being echo'ed back to the PC. That's not a bug, that's a feature.)
    So it's stealing the power off the PC's bus line.· Very neat indeed.· Wish I had known that before! eyes.gif
    I have installed an opto cct inbetween the PC and the BS2. (see cct below)
    Now...this DID work.· worked for a while actually.

    Like I said, the data is there...but at a VERY low level.
    I'm guessing I'll have to use a MAX232CPE and borrow +5Vdc off the stamp.· I have room in the box....but really wanted to keep the setup simple!

    I'm only running 1200 or 2400 baud (today's my dumb day....don't remember! yeah.gif ) so the distance is fine.
    (rs232 is only 50feet eh....dang, I swore I thought it was longer than that....today IS dumb day! tongue.gif )


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

    1024 x 820 - 77K
  • steve_bsteve_b Posts: 1,563
    edited 2004-11-23 21:11
    achilles03 said...
    On a tangent, the fastest I've been able to sample (and write) acceleration data from a lowely 8bit ADC was about 170 Hz. That means any vibration over, say, 20 Hz might cause aliasing. For instance, if you get vibration at 40 Hz, you'll only manage about 4 samples over the course of a vibration cycle, and you won't be able to make sense of it. Are you monitoring the accelerometer for magnitude, or really low frequency vibration? Or sampling it some other way altogether? smile.gif
    I don't remember how many times I'm sampling....but I'm firing out data twice a second (2Hz).
    We're not looking for graphable data...at least not fine resolution graphs.

    We have a large radar dish who's motor control system is a bit...well...crappy.· Although it works great most of the time.· There are times when it gets funny (not in a good way) and has issues controlling the motors.· With a big dish this can really break things with all the shuddering (it's on a 100ft tower and I've been to sites where the building at the base of the tower was shaking too).

    Anyhow, we're just looking for peaks and I include some basic averages for the graphing curves.
    We decided just to try it and see if it helps us monitor the condition of our bearings/gearings/motors at the top.

    go to my personal site to get a few details on the accelerometer I pieced together.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-24 00:45
    It's not entirely clear from your diagram what is coming from the "tower". If it is RS-232, what is creating it?

    Oh! I assume the tower is where the Stamp is. Hmm. Yes, if you want to continue using the opto-isolators, you'll have to put a MAX232 on the tower with the Stamp. The good news is you can then use any two I/O pins of the stamp, and you won't get the echo back anymore.

    Also, do you have bi-directional comm *to* the tower? From the diagram it looks like you have two comm lines *from* the tower, and none going out to it.
  • steve_bsteve_b Posts: 1,563
    edited 2004-11-24 00:56
    Allan:

    Yes, the stamp is in the tower....I'm using a BOE RevB I think (the one without the servo switch).
    I'm using an ADXL210 accelerometer on the board.

    It's been working great.· And it worked flawlessly previous to the opto's being installed (worked for a couple months anyhow--but at a shorter cable length too).·
    We've since gone to a "special" computer that we needed to add protection on, hence the opto's.· BUT, it did work!!· Worked for a couple weeks then would stop.· I'd fuss with the wires and get it to work.· I'm now thinking that I jumpered the wires over the opto's and directly to the PC.·
    We only need data from the stamp....any reprogramming will be done on special circumstances and the 'box' removed.
    So we just used the Txline and the Gndline from the stamp.·

    By jumping JUST these 2-wires past the opto's, is that enough to "kick-start" the serial transistors and get it going.

    Any idea on why it would work before?
    Capacitors holding a charge?· Wouldn't think they could for that long?


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-24 00:56
    Note a Stamp I/O pin *can* put out +5 at 20 mA, so perhaps that high-current TTL would activate the LED. I would prefer a 220 ohm resistor in the line, to limit the current to that level. Perhaps you are over-driving the LED, so the opto-isolator is burning out over time.
  • steve_bsteve_b Posts: 1,563
    edited 2004-11-24 01:36
    Does P16 also qualify for the 5V/20mA limit?

    I am using the programming port to send the data.

    I honestly don't remember why I decided to use 120R.·
    Doing a quick calculation on 5Vsource with the 120R gives just over 40mA.
    I might have got this stuck in my head as a regular LED...looking at the 4N35 opto datasheet, the forward current is 10mA.
    but I did disconnect the opto and measure straight from the wires to the tower and that's how I saw the signal (at around 200mV levels).

    The other channel on the opto works fine, although it's a different source (a single board computer near to the same length of cable).
    I've also swapped opto channels to be sure the opto cctry is still working.
    Thus, I'm lead to the stamp.

    What's the failure mode of an oversourced I/O pin?·
    If I get a chance I'll leave the thing disconnected and see if it can sort itself out (I know, sounds funny).
    This is on a weather radar and we don't have the luxury of shutting it down....especially if there's 'good' weather to look at.





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-24 21:06
    Failure mode of an over-stressed pin is it blows out (melts? fuses open?) the driver transistor on the PIC16C54 chip on the BS2 module.

    I really think your opto-isolator might work perfectly well at 0 to +5 volts, if you used a 470 ohm resistor (for a 10 mA LED). The only concern is the line length may low-pass filter your signal. Use pin 1 and try it. A low-pass filtered digital square wave looks like a sine-wave -- you lose all those nice sharp edges, but it can still work at low (2400 and below) baud rates.
  • steve_bsteve_b Posts: 1,563
    edited 2004-11-25 01:59
    Initially I had to use an RC filter to clean up my signal (this is PRE-opto isolation).



    Looking at the scope trace now....it certainly isn't square....but it worked with the opto anyhow.· I did toss the RC back on and it still looked fine.

    Could the signal I'm seeing now (~200mV) be crossover from the other side of the bad transistor?· There certainly IS data present...just not at usable thresholds!



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • allanlane5allanlane5 Posts: 3,815
    edited 2004-11-25 21:38
    If you are *still* using the "Port16" pins, be aware that the line back *to you* from the BS2 is modulating the (supposedly negative) voltage being sent *to it*. If you've left that line open (since you're not sending *any* signal to the BS2) then I don't know what voltage it is modulating.

    Best solution: *Stop using the Port16*. You're trying to use it *way* outside its intended purpose. Instead, use one of the standard I/O pins, and connect it through a 470 ohm resistor to the opto-isolator. In PBasic code, all you have to do is change the SEROUT '16' to the pin number you've chose.

    Next best solution: put zero volts on the 'TX' line going out to the BS2, so it has *something* to modulate.
Sign In or Register to comment.