Shop OBEX P1 Docs P2 Docs Learn Events
best way to output 0V, 2.5V, 5V signal from stamp — Parallax Forums

best way to output 0V, 2.5V, 5V signal from stamp

BlakeBlake Posts: 74
edited 2014-10-28 12:12 in BASIC Stamp
This is probably a really easy thing to do, but after messing around with a breadboard for an hour, I don't have a solution. I need to send a signal to a pin on a motor controller that is either 0V (reverse), 2.5V (stop) or 5V (forward) from a basic stamp. Is there any reliable easy way to do this with no extra components/chips? If not, what is a fairly simple way?

The best I've done:

Use a LM317T to output 2.5V continuously to the controller pin. To send to 5V, send the BS pin high to the same pin. For 0V, I've tried to hooked up ULN2803A darlington array (open collector) and activate it with a high signal from another stamp pin. Except this doesn't actually seem to work.

Previously I tried variously making one BS pin into an input or output high or low with the 2.5V coming from the LM317T. I didn't really get anywhere with this either.

Can anyone point me in the right direction?

Thank you.

Comments

  • BlakeBlake Posts: 74
    edited 2014-10-28 08:06
    After some more thought, I guess really the best way to do this is to use PWM to output the 2.5V signal, and then high and low for the 5V and 0V.

    Is there an alternative to this approach?

    Thank you.
  • Hal AlbachHal Albach Posts: 747
    edited 2014-10-28 08:18
    Depending on how much current the motor controller input pulls, you could place two equal resistors across two pins of the stamp with the resistor junction going to the controller. For instance, P1 to the top resistor and P0 to the bottom one. When P1 & P0 = high the juction will be +5. When P1 is high and P0 is low then the junction will be +2.5. With P1 & P0 = low then the junction will be 0 volts.
  • BlakeBlake Posts: 74
    edited 2014-10-28 09:16
    This is exactly the answer I was looking for. It's really obvious now that you've pointed it out. Thank you very much.
  • Hal AlbachHal Albach Posts: 747
    edited 2014-10-28 09:30
    You could also use just one 20-turn trim pot to fine tune that 2.5 volt output. Possibly around 5k. Connect the end leads of the pot to the stamp and with a meter look for 2.5 on the pot center lead. Hook up the motor and controller with the top of the pot at high and the bottom at low turn the trim pot until motor stops.
  • BlakeBlake Posts: 74
    edited 2014-10-28 09:38
    Even better! Thanks.
  • GenetixGenetix Posts: 1,749
    edited 2014-10-28 10:35
    Blake, what motor controller are you using?
  • BlakeBlake Posts: 74
    edited 2014-10-28 12:12
    Will be using a Sabertooth 2x32 from Dimension Engineering:

    http://www.dimensionengineering.com/products/sabertooth2x32

    I know that there may be better methods to control this, even ways that Dimension specifically mentions (like using Pulsout in R/C mode). However, I am retrofitting this controller into an existing platform that previously used a servo drive (for speed) and a bank of relays (for direction) to control two motors. I'd like to drop this in for testing without drastically changing the control method for the machine, hence the question. Also, our system is currently open-loop analog control, and I'd like to keep it that way for now, and I'm dealing with tether lengths of hundreds of feet between the stamp and the controller.

    With this setup, I can control the two motor's speed (together) and direction (independently) with three analog signals (0-5V).
Sign In or Register to comment.