Shop OBEX P1 Docs P2 Docs Learn Events
Conversion — Parallax Forums

Conversion

Lizzy1118Lizzy1118 Posts: 3
edited 2013-01-30 23:26 in BASIC Stamp
I created a Program in Basic Stamp which has to be used to run a FlexiForce Sensor...I need to know how can I convert the output from time to force???

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-30 21:18
    You need to provide more information about what you're doing. At the very least, provide your source code and a description of how you have things connected.

    attachment.php?attachmentid=78421&d=1297987572

    If you're referring to the use of RCTIME to measure the resistance of the sensor where RCTIME provides a time value, you'll have to calibrate your system using test weights. The BASIC Stamp Syntax and Reference Manual discusses the use of RCTIME to measure resistance and shows how the resistance can be calculated from the capacitance used and the time measured. Look at this article from the manufacturer's FAQs. In addition to using curve fitting to get an equation for force vs. resistance, you can use the Stamp's LOOKDOWN statement.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-01-30 21:22
    You mean something like this? I used this and once the pressure on the sensor hit the 50000 it would move my bot forward.
    IF rawforce >=50000 THEN
    FREQOUT 4, 1500, 1000
    FREQOUT 4, 1500, 1500
    FREQOUT 4, 1500, 2000
    FOR counter = 1 TO 300
    PULSOUT 13, 2030
    PULSOUT 12, 1627
    PULSOUT 14,1650
    PAUSE 20
    DEBUG CLS
    NEXT
    ENDIF
    
  • Lizzy1118Lizzy1118 Posts: 3
    edited 2013-01-30 22:07
    This is my program,

    Code:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    time VAR Word
    sensorPin CON 15
    DO
    HIGH sensorPin
    PAUSE 100
    RCTIME sensorPin,1,time
    DEBUG HOME, "time = ", DEC5 time, CR

    IF time>10 THEN
    HIGH 14
    PAUSE 500

    ELSE
    LOW 14
    PAUSE 500
    ENDIF

    LOOP

    The program objective is detect the force applied on a flexiforce sensor, if the force applied is greater than the number assigned then power on a LED, I need to convert the RCTIME into force.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2013-01-30 22:43
    This same question came up here on this forum about a week ago, too, how to convert the RCTIME value to force, from the flexiforce sensor. Basically, force is inversely proportional to resistance.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-01-30 22:52
    Still using RCTIME change time to rawforce. Worked for me.
    ' {$PBASIC 2.5}
    ' {$PORT COM1}
    ' -----[ Declarations ]----------------------------------------------------
    counter VAR Word
    rawForce VAR Word ' Stores raw output
    sensorPin PIN 14 ' Flexiforce sensor circuit
    duration VAR Word
    ' -----[ Main Routine ]----------------------------------------------------
    Measure:
    HIGH sensorPin ' Discharge the capacitor
    PAUSE 2
    RCTIME sensorPin,1,rawForce ' Measure RC charge time
    DEBUG HOME, "Flexiforce raw output = ", DEC rawForce,CR
    
    IF rawforce >=50000 THEN
    FREQOUT 4, 1500, 1000
    FREQOUT 4, 1500, 1500
    FREQOUT 4, 1500, 2000
    FOR counter = 1 TO 300
    PULSOUT 13, 2030
    PULSOUT 12, 1627
    PULSOUT 14,1650
    PAUSE 20
    DEBUG CLS
    NEXT
    ENDIF
    GOTO Measure
    
  • Lizzy1118Lizzy1118 Posts: 3
    edited 2013-01-30 23:26
    Thanks, I appreciate everyone's help.
Sign In or Register to comment.