Shop OBEX P1 Docs P2 Docs Learn Events
HELP: 2pe Cant Operate Pin Like Basic Stamp 2 does with same routine, HOW DO I FIX? — Parallax Forums

HELP: 2pe Cant Operate Pin Like Basic Stamp 2 does with same routine, HOW DO I FIX?

MiddleSchoolerMiddleSchooler Posts: 10
edited 2013-01-27 08:46 in BASIC Stamp
UPDATE 1/17/13 - SOLVED THANKS FOR YOUR HELP : )

I have two Basic stamps that I am using in my project. Fist a Board of Education USB Kit with BasicStamp 2 ("Bd of Ed"). Secondis the 2pe Motherboard ("2pe"). I am using both microcontrollers to do different tings, but the 2pe justdoes not do what the Bd of Ed does, so I need some help, I cant believe the moreexpensive 2pe is less useful the Stamp 2 in Bd of Ed.

Here is what I am doing: I have a sensor and when it is tripped, I want a little buzzer micromotor to spin a few hundredths of a second. For example, when an object is detected at more than 12 inches, the stampis to activate the micro motor. I use Stamp2 in Bd of Ed, and this works perfectly!! No relay needed, when the sensor detects and object, a GOTO in my softwaresend it to a subroutine:

PAUSE 5
LOW 9 (these two lines are at the top of the program, beforeusing the sensor. I want to make sure themotor does not buzz when the program boots, before the sensor detects the object.)
…….
……

' Subroutine for after object detected
' I use Pin 9and Vss on Stamp 2 Bd of Ed

HIGH 9
PAUSE 88
LOW 9

PAUSE 500

HIGH 9
PAUSE 88
LOW 9

DEBUG "Object Found"
END


' the above makes the micro low voltage low amp buzzer motorspin for 88/1000 of a second, pause and the respect the buzz.

The above subroutine WORKS GREAT! No problem in Bd of Ed!!!

BUT HERE IS THE PROBLEM:

Using another sensor and 2pe Motherboard, I have the sensor attachedto Socket B

When the sensor is tripped, I want the buzzer/motor to runjust like it does with Stamp 2 above.

So I use Pin 9 and Gnd on Socket B (there is no Vss listed, instead on 2pe Pin 2 is called Gnd, and then below it are Pin 3, and then Pin 9.)

So I use this subroutine, the same as I used in Stamp 2 above (both units are operating independently, independent ally powered, etc.) I use Gnd and Pin 9

' Subroutine for after object detected
' I use Pin 9and Gnd on 2pe Mothorboard

HIGH 9
PAUSE 88
LOW 9

PAUSE 500

HIGH 9
PAUSE 88
LOW 9

DEBUG "Object Found"
END

BUT THE MOTOR DOES NOT ACTIVATE. I hear a little sound, real weak sometimes, but not all the time,it basically does nothing! But, the samesubroutine works great in Stamp 2 Bd of Ed.

Can someone please tell me what I am doing wrong? And how can I get the 2pe to run my micromotor/buzzer? I know I don't need a relay, Stamp 2 runs itperfectly?

Maybe trash the pe2 (which otherwise works perfect, and othersocket A pins work perfect because I use Pin 8 for moments in the initial part ofthe program to detect a button pushed, and it works) so sholud I buy another Stemp2 and trash the 2pe?

PLEASE HELP????

Thank you.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-26 14:35
    The reason you cannot drive the motor direclty with the MoBoStamp-pe is that the Stamp chip's pins are protected by 330-ohm series resistors and will not provide enough current to drive the motor. That's easily remedied, however by using the pin to drive the motor via an NPN or MOSFET transistor.

    Whether you're using the BS2 or BS2pe, you should not drive a motor directly from a Stamp pin anyway, at the risk of damaging the Stamp. Use a transistor driver and a protection diode across the motor leads, and you'll be good to go.

    -Phil
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-01-26 14:59
    Phil, Just a quick question as I also have a BS2PE that I may use in one of my projects. Does the PE use the same math as the standard BS2? In other words, can the same code be used for the PE as the BS2 without using "CASE" ?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-26 15:34
    PBASIC for the 2pe is the same as for the BS2, but with a few extra commands and some slightly different timings, all of which are explained in the PBASIC manual.

    -Phil
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-01-26 15:49
    So, the OP's code for BS2 will work with the BS2PE?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-26 15:58
    Yes, the code would work; but the OP's problem is not a code problem: it's a hardware issue.

    -Phil
  • MiddleSchoolerMiddleSchooler Posts: 10
    edited 2013-01-26 16:16
    Wow, thank you!

    My 2pe was not malfunctioning, the pins on it are protected. Thank you again!

    A NEW QUESTION PLEASE : Can I send a signal via Gnd and Pin9 on my 2pe to the Pin 10 on my Basic Stamp 2 Bd of Ed, and the Stamp 2 would knowif it got a signal from the 2pe? Anyidea of how I would code that, if such was possible?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-01-26 16:53
    Can I send a signal via Gnd and Pin9 on my 2pe to the Pin 10 on my Basic Stamp 2 Bd of Ed, and the Stamp 2 would knowif it got a signal from the 2pe?
    Yes. Set the 2pe pin to an output and raise or lower it to signal the BS2, whose pin is set to an input to be read by its own program.

    -Phil
  • MiddleSchoolerMiddleSchooler Posts: 10
    edited 2013-01-27 08:46
    FANTASTIC - I programed it per you tip Phil, and it worked! Thank you Phil and everyone. I am sorry I was so dense, I am learning as I use my stamps and with various programing, but I am obviously very, very green. Your wisdom has helped me in many ways, THANK YOU!
Sign In or Register to comment.