[Robotgroup] BASIC STAMP II EMERGENCY!! (was Robot Head: BS2 Stamp)

Andre Lamothe ceo at nurve.net
Wed Aug 6 17:55:17 PDT 2008


I donated 5 of them to the RG for the basic stamp class. Vern or whoever is 
teaching the class has them and should be able to bring you one no problem.

The question is how did you blow yours? So you don't do it again..

I haven't been following this thread, but if you are using the STAMP to 
directly drive the servo this should be fine since its a digital signal, but 
if you are doing something else where you are using IO pins to drive a motor 
then the inductive kick can damage the IO pin. In the former case, for a 
little more protection put 100 ohm resistors in the servo pulse lines to 
limit current for extra safety. In the later, case you would want to isolate 
any inductive load with a transistor or fet, so that the digital IO of the 
stamp only drives the base or gate of the semiconductor switch and the worst 
that happens is you blow the transistor or fet.

Andre'

----- Original Message ----- 
From: "LHudson" <lhudson73 at yahoo.com>
To: "The Robot Group Mailing List" <robotgroup at puremagic.com>
Sent: Wednesday, August 06, 2008 7:40 PM
Subject: [Robotgroup] BASIC STAMP II EMERGENCY!! (was Robot Head: BS2 Stamp)


I just blew mine. Does anyone have an extra or unused one that needs some 
robot code to process? If not, can I borrow someone's tomorrow so I can do a 
demo? Otherwise my comptroller / spouse says I have to wait until payday, 
which is Monday, and that would just be sad.

Also, each and every failure makes this ServoPAL look like a better and 
better idea. I wonder, if the motor overloads, would it blow the ServoPAL 
instead of the Stamp? That would make economical sense to me. Well not as 
much as not blowing any components at all, but anyway.

Oh and also, if you had a stamp available for tomorrow, but are having 
second thoughts because of everything I said about motor overloads, don't 
worry... I won't be demoing the servos. First I think I need to upgrade them 
because I don't think they are providing enough torque.

Thanks,

L. Scott Hudson

"There are known knowns. These are things we know that we know. There are 
known unknowns. That is to say, there are things we know we don't know. But, 
there are also unknown unknowns. These are things we don't know we don't 
know."

-- Donald Rumsfeld, describing the IBM "Rational Software" Platform

--- On Tue, 8/5/08, Vern Graner <vern at txis.com> wrote:

From: Vern Graner <vern at txis.com>
Subject: Re: [Robotgroup] Robot Head: BS2 Stamp programming Help?!
To: "The Robot Group Mailing List" <robotgroup at puremagic.com>
Date: Tuesday, August 5, 2008, 2:18 PM

LHudson wrote:
> The problem is that if there is no command to execute the Pan & Tilt,
then
> the servos receive no PULSOUT.  With no charge to the motors, the
slightest
> bump can cause a severe case of whiplash.  My tentative solution was to
put
> additional PULSOUT codes before the ...LOOP:

Servo motors need a constant stream of pulses in order to operate. More
specifically, a servo's main "job" is to correct for errors in
position.
In order to correct (i.e. move), it needs to have two values to compare--

* The first value is derived from the potentiometer that is attached to
the servo's output shaft (i.e. where the servo IS)

* The second value is derived by measuring the incoming PWM pulses (i.e.
where the servo SHOULD BE)

The servo is constantly checking and correcting for differences between
the first and second value. If there is no discernible difference, then
the servo *holds* its existing position.

If you do not provide a constant stream of pulses for the servo to
"compare" with its current position, then the motor will not
"power up"
or move at all (i.e. goes "slack" as if it were un-powered).
subsequently, if you exert external force on your pan/tilt mechanism, it
will simply "flop" over to whatever position it is pushed towards
since
it only has one value (i.e. the potentiometer value) so no
"correction"
can be derived.

In the situation you described, you would need for the basic stamp to
"refresh" the servo output in a continuous loop (ever 20ms).

This will be a problem with your existing code since you are using a
Serial-In command. The Serial-In (i.e. SERIN) is considered
"blocking"
code in that the Basic Stamp will HALT, and WAIT for this command to
complete successfully (or time out) before continuing.

To get around this problem, there are two apparent choices:

   1) Use an external piece of hardware to produce the stream of pulses
to the servo. Examples include many "serial servo controllers" such
as:

ServoPAL from Parallax: http://tinyurl.com/58ymtp

or

SSC from Parallax: http://tinyurl.com/5a4kqf

or

Micro Servo Controller: http://www.pololu.com/catalog/product/207

This approach is the simplest and it will absolutely solve the issue as
it "offloads" the "feeding" of the servos to an external
device that is
designed specifically for that task. This leaves the BSII free to
"listen" constantly for a serial input.


   2) Modify your code to both monitor the serial port AND refresh the
servos in a loop, such as:

--------------------- CODE -----------------------
DEBUG CR, "Enter Command: "

DO
  SERIN 16, BAUD, 20, RefreshServos, [DEC COMDATA]

  IF COMDATA < 100
    ' {Do the Speech Code}
    ELSEIF COMDATA < 1000
     ' {Do the Movement Code}
    ELSE
     ' {Do the Pan or Tilt Code}
  ENDIF

  RefreshServos: 'Update Servo Positions
    PULSOUT PIN_PanTilt_Pan, POS_PanTilt_Pan
    PULSOUT PIN_PanTilt_Tilt, POS_PanTilt_Tilt

LOOP
--------------------- /CODE ----------------------

The above code waits 20 ms for an incoming serial command, if one is not
received, it then updates the PWM output to the servo motors. If a
serial command is received during the 20ms wait period, it will execute
the IF comparison pseudo-code.

I have not tested the above code to see if it works. One issue that
comes to mind is if a serial command begins while the servo PWM is being
sent. You might miss the first few bytes of the transmission.

Hope this helps. :)

Vern

-- 
Vern Graner CNE/CNA/SSE    | "If the network is down, then you're
Senior Systems Engineer    | obviously incompetent so why are we
Texas Information Services | paying you? Of course, if the network
http://www.txis.com        | is up, then we obviously don't need
Austin Office 512 328-8947 | you, so why are we paying you?" ©VLG


_______________________________________________
Robotgroup mailing list
Robotgroup at puremagic.com
http://lists.puremagic.com/cgi-bin/mailman/listinfo/robotgroup




_______________________________________________
Robotgroup mailing list
Robotgroup at puremagic.com
http://lists.puremagic.com/cgi-bin/mailman/listinfo/robotgroup 



More information about the Robotgroup mailing list