Shop OBEX P1 Docs P2 Docs Learn Events
how do I use the Schmitt Trigger in the basic stamp 2px as a threshold switch — Parallax Forums

how do I use the Schmitt Trigger in the basic stamp 2px as a threshold switch

andrew777andrew777 Posts: 25
edited 2005-07-08 18:36 in Robotics
Dear Group:

I want to use a flexiforce sensor by Tekscan as a force switch. The flexiforce sensor works by having high resistance when unloaded and increasing lower resistance when weight is placed on the sensor.

Can I use the Schmitt Trigger in the basic stamp 2px as a threshold switch. I don't know how to do this. I want the sensor·when loaded with 10 pounds or more,·to switch on. When the sensor is loaded with less than 10 pounds the switch goes off. Any help will be appreciated. I hope someone answers.· I got no answers for my last question.

·andrew777

Comments

  • KenMKenM Posts: 657
    edited 2005-07-01 12:57
    One method is to use the RCTime command. You will need to adjust capacitor values until the command returns a reading (number) that is easily discernable.....maybe something in the neighborhood of 50 with with the 10lbs on the sensor, and above 50 with no load on the sensor.

    The help file has good examples of the RCTime command if you are not already familiar with that command.

    The Schmidt trigger funtion could also be used, but is probably not as easy as RCTime for this application. Essentially to use the schmidt trigger you would set up a voltage divider using a resistor and your flexiforce into the schmidt trigger input of your stamp.

    I have a flexiforce sensor here. This weekend I can help if you need it.

    Ken
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-01 12:57
    Since the Flexiforce sensor acts like a variable resistor what you probably want to use is the comparitor inputs (P1 and P2, with [noparse][[/noparse]optional] ouput on P0).· With the comparator you could compare the output from the Flexiforce (that is part of a voltage divider) with the setting of a pot (take the wiper to one of the comparator pins).· See COMPARE in the help file for details.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • andrew777andrew777 Posts: 25
    edited 2005-07-01 19:07
    Thank you Ken and Jon:

    Now I feel like I'm a part of the group. I think that both ideas are good I would try them both. Should I use the output pin to power (5 V) the sensor or do I have to have a separate power supply. I am a novice at this. Do I need any resistors, if both of you can draw me a simple circuit that I can go by, it will be easier. I have the ideas but not electronic technical expertise. But I'm learning. But I thank you for what you already contributed. Ken any help that you can give I need.

    Thank again,

    andrew777
  • KenMKenM Posts: 657
    edited 2005-07-02 13:59
    Andrew,

    I will have some information for you later today...about 4 PM California time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken
  • KenMKenM Posts: 657
    edited 2005-07-04 03:47
    I am unable to find either of my two flexiforce sensors....arghhh
    In any event, there are a few ways to interpret when the force on the sensor exceeds 10 lbs.

    As Jon mentioned there is a comparitor function, or you can use RCTime, or you can configure the input pin for CMOS input and determine when the sensor output falls below 2.5 volts.

    Using the comparitor function that Jon mentioned has the advantage that a seperate pin can be configured to reflect the state of the input, so it can directly turn on an LED, activate a relay (via a transistor). The disadvantage is that it consumes three Stamp pins.

    The RCTime has the advantage of using only one Stamp pin (two if you will control some output based on the input). The disadvantage is that there is no "automatic" reaction to the input, the user must test the result obtained and control another output pin.

    The pin configured as CMOS basically has the same advantage/disadvantage as the RCTime method. If you use the CMOS pin configuration method, put a variable resistor in series with the sensor, and with 10 lbs on the sensor adjust the resistor until you get 2.5 volts. Turn the power off, remove the resistor and replace it with a fixed value.

    What should happen is when there is no weight on the sensor, the voltage going to the Stamp should be greater than 2.5 volts and you will read a logic 1 on the Stamp pin.
    At 10 volts on the sensor the Stamp pin should read 2.5 volts.....any additional weight will cause the voltage to drop below 2.5 volts, then the stamp pin should return a logic 0.

    See attached schematic, write back if more help is needed.
     CONFIGPIN THRESHOLD, %0000111100000000   'Set P8-P11 to CMOS, others TTL 
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken
  • KenMKenM Posts: 657
    edited 2005-07-04 05:22
    Andrew,

    I finally found my sensor and did a little experiment.

    With 10 lbs on the sensor I adjusted a series pot until the output (junction of pot and flexiforce sensor) was 2.5 volts. Removing the pot and measureing the resistance yeilds approximately 170 k ohms

    Keep in mind the sensor is quite sensitive to the application of the load. As you can see from the attached pictures, when one of the weights was moved about 5mm, the reading from the sensor changed.

    You can use the 5 volt output of the Stamp to power the circuit.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken

    Post Edited (KenM) : 7/4/2005 6:53:17 AM GMT
    901 x 352 - 46K
    971 x 360 - 58K
  • andrew777andrew777 Posts: 25
    edited 2005-07-04 16:47
    Hello Ken:
    I thank you for all your help. Thanks for the schematics. I'm sure that your solution will work. This brings up another related subject. What kind of measurement instruments should I buy. To determine the electrical signals and properties the flexiforce sensor,pwm etc. I want to know what kind of measuring instruments I need to own to work with stamps. Oscope by parallax? etc. If I have the proper instruments I might be able to determine somethings myself or get a clear illustration of something you or someone demonstrated. I hope this makes sense.

    Thanks,
    andrew777
  • KenMKenM Posts: 657
    edited 2005-07-04 17:05
    Andrew,

    About equipment, I think it greatly depends on many different things, including your budget.

    Perhaps an even more important factor to consider is how often will you use the equipement, and how serious are about this hobby, if it is a hobby. Are you in this for the long haul?

    I have not used the Parallax o-scope, but I read good things about it in this forum. The big upside to the Parallax scope is price, and the ability to see signals in the time domain. It can be used as a simple volt meter also.

    An o-scope is not needed to work with and understand the flexiforce sensor, but is almost a must to clearly see and understand PWM signals, momentary pulses and the like.

    The downside to the Parallax o-scope is you need a PC to use it (I think), and it will not directly measure resistance (again, I think).

    If the PC is not a problem, it seems you cannot go wrong with the Parallax o-scope, especially when you consider the professional support you get from Parallax. In my opinion that is priceless.

    In addition to the scope, you can also get a cheapo voltmeter that will measure resistance, voltage, current for less than $10 at Harbor Freight.

    For about $30 or more, another volt meter has a nice feature of a "diode checker"

    Hope this helps more than it confuses


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken

    Post Edited (KenM) : 7/4/2005 5:16:10 PM GMT
  • andrew777andrew777 Posts: 25
    edited 2005-07-06 23:17
    Dear Ken:

    I considered Harbor Freight to buy a multimeter because we have a store near our neighborhood. I didn't know anything about diode checkers. When I went to RadioShack I purchased a 46 range digital multimeter with a PC interface for $69.·· It has a diode and transistor checker it can display PWM frequency. I think that this will be a substitute for oscope at least for a while. I don't know a lot about these kind of instruments but I will learn.

    I just ordered the book Physical Computing by Dan O'Sullivan, it will give me ideas and a basic understanding of electronic relating to microcontroller. The reviews say that it is excellent for the beginner. I'm in it for the long-haul. You and Jon have given me a push for a lifelong avocation with help for my first major project.

    Thanks again,

    Andrew

  • Buck RogersBuck Rogers Posts: 2,184
    edited 2005-07-06 23:30
    Hello from Buck Rogers
    That is a good book. I have it here. I bought mine from the smallest Barnes and Noble in Manhattan.

    They don't consider the Basic Stamp a good candidate. They propose trying several others in addition tot he Stanp. Personally I believe they didn't try harder with the stamp. And of course the humor of it all is that they are NYC located.

    Incidentally where did you buy your copy? And where? PM me if you want to let me know privately.

    Oh and Ken, when will the company be at a trade show in NYC area, next time? roll.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Buck Rogers

    www.gregg.levine.name
  • andrew777andrew777 Posts: 25
    edited 2005-07-07 23:04
    I bought the book on amazon.com for $20. Quite a big book.

    Andrew
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-07-08 18:36
    I have that book as well- it was an interesting read, but consider going through the Parallax books (heck, they're free for download!)-

    Ryan
Sign In or Register to comment.