Shop OBEX P1 Docs P2 Docs Learn Events
BS2p max pin input voltage and encoder application — Parallax Forums

BS2p max pin input voltage and encoder application

jacko87jacko87 Posts: 6
edited 2009-06-27 05:08 in BASIC Stamp
Hi all, I am new to basic stamp, I wonder how much is the maximal pin input voltage for bs2p.. I plan to use it for encoder application, when the light comes, my circuit output signal of 5.22V, which should be read high by the BS2, and when there is no light, the output signal will becomes 0 V.. Is the output signal of 5.22V is safe to be used as an input signal for BS2 pin?

the second one is what function can be used for this application:
I want to run a dc motor, and the encoder signal will output high and low values to be used as a feedback for the motor..
the initial signal is 1 (the light goes through), and I expect that the motor will stop when the signal turn to 1 again (after it change to 0 before because the motor movement)..

I know Button function but I am not sure of its application...

Can anyone help me with this? Thx before..

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2009-06-26 14:53
    You should be OK at 5.22 volts, but I usually put 100 ohms or 220 ohms in series with the input pins on the Stamp for a bit of extra safety. For instance, if you accidently set the Stamp pin to be an output LOW when the encoder signal is high.

    Depending on how many pulses per revolution your encoder gives, you may quickly realize the Stamp may not be able keep up at high pulse rates. Also, an encoder can also be used to get direction of rotation information as well, but does require a bit more on-the-fly calculation.

    To monitor the encoder pulses, use the INx function, where x is your pin number. Use the Editor's help file to see sample applications of any command.
    ·You can also use PULSIN and COUNT, depending on your application.

    When you say "feedback for the motor", do you mean in terms of rpm or actual number of revs or some other quantity? Give us a bit more detail, and I'm sure you'll get more specific help.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • jacko87jacko87 Posts: 6
    edited 2009-06-27 04:12
    thx for the reply stamptrol..

    the detail is that I build a robot arm, and I use a DC motor to drive one of its link.. assume that the initial position of the link is 0 deg from X axis, and I want to rotate it to 90 deg from X axis.. the motor maximum voltage is 12 V and I use PWM to decelerate the speed of the rotation. Lets say at initial position, I need 12 V to lift the link (since the torque required at this position is the biggest) and then at 10 deg, the voltage is reduced to 11 V (since the torque required decreases at this position). then 9 V at 30 deg and this goes until 5 V at 80 deg..

    I know the PWM function, and I am thinking to use loop function such as FOR...NEXT. lets say the initial position of the encoder signal is high and the voltage is 12V, and when the motor rotates, the encoder also rotates, the signal goes to low, and when it's high again, I would like to reduce the voltage to 11V, and then it loops again..
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-27 04:17
    You'll need some kind of external switching circuitry to handle the 12V. Look at the Wikipedia article on H-Bridges for further details. The StampWorks Manual from Parallax (downloadable for free) has one section on the use of an H-Bridge with a Stamp. There are inexpensive DC motor controllers from Parallax and others that simplify the control of DC motors. Have a look at Parallax's.
  • jacko87jacko87 Posts: 6
    edited 2009-06-27 05:08
    I already have an H-bridge with PWM module and I am using it for the application.. it works well with the PWM command when I am using BS PWM function to output 5V, 6V until 12V , but I need to control it using the encoder...
Sign In or Register to comment.