A couple newbie questions

Started by Rick Harroun J1 January 22, 2007
Hi, folks.

I just got my first BX-24 (brand spanking new from NetMedia) a few weeks ago and have been doing some experimenting, but some things are happening that don't seem right. I have looked anywhere I can think of for answers, but don't see anything that addresses these questions.

Can anyone explain these, or do I have a problem somewhere?

1. I set up a comm port using pin 11 for transmit (pin 2 on the DB-9 connector), pin 12 for receive (pin 3 on the DB-9 connector). I also connected pin 9 of the DB-9 connector to ground on the breadboard. Any time I connect the cable to my PC, the green LED glows on the BX-24. I think the red one was glowing when I first noticed it happening, but I could be wrong there. It doesn't matter what program is loaded in the BX-24.

2. I wrote a quick routine to check the analog signals on pins 13 through 20 and display them with debug.print. I set it to loop continually and delay a fraction of a second on each loop. I have a straight vertical wire connected to pin 13 like an antenna and nothing connected to the other pins, but the readings for all eight pins are all over the map and seem to change with each loop of the program. Shouldn't I get a zero reading on the pins with nothing connected to them?

I've written a lot of code on mainframes and PCs, but microcontrollers (and I guess electronics) are new to me. I'm looking forward to a lot of fun learning and experimenting, but didn't expect to run into these kinds of questions right out of the blocks.

Thanks in advance for any help!
Rick
Welcome to the BX-24, Rick.

> ... pin 9 of the DB-9 connector to ground...

RS232 on a DB9 calls pin 5 ground, not pin 9; isn't that RI?

> ... Any time I connect the cable to my PC, the green LED glows...

With no common ground, PC RS232 voltages might cause strange symptoms; I
hope the BX-24 is not consequently damaged. Unless you did not have
COM1 connected to the PC, there should also have been a ground through
that connection, too.

> ... the readings for all eight pins are all over the map...

The analog inputs are high-impedance, floating pins. Ground them and
you should see zero readings. Connect two 100k resistors from some
analog pin, one to ground and one to +5v; the reading should be ~2.5v on
that pin.
Tom
Thanks for the quick reply, Tom.

I apologize, I had a typo in that post and, as you correctly pointed out, it should have said pin 5 goes to ground, not pin 9. I do have pin 5 to ground and pin 9 is open.

After some more testing, it appears that the LED only glows when I connect pin 3 of the DB9 to pin 12 of the BX-24. If I connect it to any other pin on the BX-24, the LED doesn't glow. (Well, to be honest, I only tried a couple others.) I know it has nothing to do with the code in the BX-24. I even wrote a program that just flashes both LEDs and ends and I get the same results with the green LED glowing.

Thanks for the explanation on the analog inputs. I tried your suggestion and got exactly what you said. So that takes care of one question, but the glowing LED still has me baffled.

Rick
> ... the LED only glows when I connect pin 3 of the DB9 to pin 12 of
the BX-24...

Well, I don't know how that's happening but my guess is that it is the
result of a too-high voltage on the pin. DB9 pin 3 is usually data
input, in this case, from the PC. What does a voltmeter tell you?

A PC's RS232 signal output is usually +/-12v, but the BX-24 input pin
can only tolerate 0v to+5v. It is common to limit the input voltages by
putting a resistor (10k works well) in series with the data and
"clamping" the maximum voltages with a pair of signal diodes, like 1N914
or 1N4148. One diode must be between the pin and ground with the
cathode (the bar side of the diode symbol, the striped end of the diode)
to the pin, anode to ground. The other diode needs the anode connected
to the pin and the cathode to +5v. Alternatively, and in most commercial
designs, you can use an RS232 interface chip like the MAX232, which will
also logically invert the signals.
Tom
Hi Rick,

I teach robotics using the BX-24 and have found it is worth using
Robodyssey System's RAMB II motherboard for all my BX-24
applications. (See www.robodyssey.com) On my book's website I have
a detailed description (with lots of pictures) of this fabulous
motherboard. See it at
http://www.basicxandrobotics.com/additions/RAMB2/index.html. We've
used about 100 of these motherboards and they've always worked
perfectly -- even in low-Earth orbit! Heck, they've even survived
my students' mishandling over the past 5 years. Anyway, the RAMB II
really takes the guess-work out of deploying BX-24 (or BasicStamp)
projects and I thought you might like to see a commercial solution
to your problem. (Oh, the RAMB II costs $35 as a kit or $50 pre-
assembled.)

chris

--- In b..., "Rick Harroun J1"
wrote:
> I just got my first BX-24 (brand spanking new from NetMedia) a few
weeks ago and have been doing some experimenting, but some things
are happening that don't seem right.
Good morning, Chris.

Thanks for taking the time to send that note. Last fall I got a copy of Physical Computing by Dan O'Sullivan and Tom Igoe and I've been working my way through it. They say (and in fact they show pictures) that they always just connect the serial cables directly to the microcontrollers without reducing the voltage and they have never had problems. Maybe I've been reading the wrong book, huh?

As soon as I send this I'll put in an order for a RAMB II and a copy of your book. Then I just have to cool my jets waiting for them to get here.

Thanks again for your help. I appreciate it.
Rick
----- Original Message -----
From: Chris Odom
To: b...
Sent: Tuesday, January 23, 2007 2:39 PM
Subject: [BasicX] Re: A couple newbie questions
Hi Rick,

I teach robotics using the BX-24 and have found it is worth using
Robodyssey System's RAMB II motherboard for all my BX-24
applications. (See www.robodyssey.com) On my book's website I have
a detailed description (with lots of pictures) of this fabulous
motherboard. See it at
http://www.basicxandrobotics.com/additions/RAMB2/index.html. We've
used about 100 of these motherboards and they've always worked
perfectly -- even in low-Earth orbit! Heck, they've even survived
my students' mishandling over the past 5 years. Anyway, the RAMB II
really takes the guess-work out of deploying BX-24 (or BasicStamp)
projects and I thought you might like to see a commercial solution
to your problem. (Oh, the RAMB II costs $35 as a kit or $50 pre-
assembled.)

chris

--- In b..., "Rick Harroun J1"
wrote:
> I just got my first BX-24 (brand spanking new from NetMedia) a few
weeks ago and have been doing some experimenting, but some things
are happening that don't seem right.
Chris, that's a cute platform for the BX-24, but what can it do that
helps the OP answer or avoid his two questioned behaviors, floating
analog inputs and the green LED, that a breadboard won't?
Tom