November 24, 2024, 12:11:13 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Potentiometer control with a prop controller?

Started by clinefx1, March 20, 2007, 12:38:45 AM

Previous topic - Next topic

clinefx1

I was wandering if it was possible to substitute a potentiometer with a basic stamp.  I may be facing this situation soon at work. The gag is to control a mechanical bull and have it repeat the same action over and over.  Depending on how the factory controls work out, it may not be just contact closers and I foresee a pot.  Will the prop-1 or prop-2 get me close?   I can also see this question applying to fog level controls and other scary devices with potentiometers.


Thanks
-Chris

JonnyMac

March 20, 2007, 01:08:25 AM #1 Last Edit: March 20, 2007, 01:11:53 AM by JonnyMac
Yes, there are digital pots that can be controlled by either -- you'll just have to figure out the value of the pot you're replacing.  Now, if the pot in question is carrying a scary voltage, you might just attach a servo to it and turn it that way.
Jon McPhalen
EFX-TEK Hollywood Office

clinefx1

Where would one find these digital pots?  Do they program like a servo? 


Chris

JonnyMac

No, a digital pot is actually a chip that takes more than one control pin.  This article by Scott Edwards gives details for the BS1 (Prop-1 core):

-- http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv18.pdf
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

March 20, 2007, 02:39:04 PM #4 Last Edit: March 20, 2007, 03:23:37 PM by JonnyMac
Parallax carries the AD5520 digital pot.  I looked at the specs and wrote a short (untested) Prop-1 program for it.  Perhaps this will help.

' =========================================================================
'
'   File...... AD5520.BS1
'   Purpose...
'   Author.... Jon Williams, EFX-TEK
'   E-mail.... jwilliams@efx-tek.com
'   Started...
'   Updated... 20 MAR 2007
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  UpDnSelect      = PIN0
SYMBOL  Clock           = 1


' -----[ Constants ]-------------------------------------------------------

SYMBOL  IsUp            = 1
SYMBOL  IsDown          = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  oldLevel        = B2                    ' old setting
SYMBOL  newLevel        = B3                    ' new (target) setting
SYMBOL  delta           = B4                    ' change

SYMBOL  ramp            = B5                    ' demo value


' -----[ Initialization ]--------------------------------------------------

Reset:
  DIRS = %00000011                              ' make updn, clk outputs

  UpDnSelect = IsDown
  delta = 128
  GOSUB Move_It                                 ' zero the pot


' -----[ Program Code ]----------------------------------------------------

Main:
  FOR ramp = 0 TO 127
    newLevel = ramp MAX 127                     ' max level is 127
    GOSUB Set_AD5520
  NEXT

  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

Set_AD5520:
  IF newLevel > oldLevel THEN Raise_It
  IF newLevel < oldLevel THEN Lower_It
  RETURN

Raise_It:
  delta = newLevel - oldLevel MAX 127
  UpDnSelect = IsUp
  GOTO Move_It

Lower_It:
  delta = oldLevel - newLevel MAX 127
  UpDnSelect = IsDown

Move_It:
  PULSOUT Clock, 1
  delta = delta - 1
  IF delta > 0 THEN Move_It
  oldLevel = newLevel
  RETURN
Jon McPhalen
EFX-TEK Hollywood Office