Shop OBEX P1 Docs P2 Docs Learn Events
different hardware compatibility? — Parallax Forums

different hardware compatibility?

MatthewMatthew Posts: 200
edited 2004-10-17 21:33 in BASIC Stamp
I apologize if my question sounds very stupid (I'm new to this stuff, and just ordered a Discovery kit!).

Anyways, can you use any type of sensor with the Parallax's stamp? Am I correct when I say all sensors give an analog output, and a ADC is needed to convert that to digital so that the stamp can understand it?

Thanks,
Matthew

Comments

  • kb2hapkb2hap Posts: 218
    edited 2004-10-16 04:05
    depends on what kind of sensor your looking for. If you talking about a photo eye or push button there already digital (1 or 0)(on/off). If you were using a thermocouple or a variable device then you may need an ADC. Analog is a variable range or amount not on or off. hope this helps a little. Theres alot of knowledgable people on this forum who can help.

    kb2hap

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • DonDon Posts: 34
    edited 2004-10-16 16:25
    To be directly compatible with the Stamp (and other microcontrollers) a sensor has to has to generate a voltage that is acceptable to the Stamp.· In most cases, this means that the sensor's output must be in the range of 0 to 5 volts.· As another poster mentioned, if the sensor output is continuous (meaning that it can produce any voltage in that range), you'll need to do an analog to digital conversion on the input.· If the sensor's output is digital (meaning that it produces either a high or a low voltage) the Stamp can read it directly.

    If the sensor generates a voltage outside of the acceptable range, you can still use it but you must add some additional circuitry to adapt its output that the acceptable range.· For example, if the sensor's output is 0 to 12 volts you may be able to use a voltage divider so that the voltage that the Stamp sees is 0 to 5 volts.· You might also find a sensor whose output is 0 to 0.5 volts.· Although you could use this directly with the Stamp, it would probably work better if you fed that output to an amplifier that scaled the signal to 0 to 5 volts.

    Some sensors (also called transducers) produce a current instead of a voltage.· Here again, a simple conversion circuit·can transform the sensor's output to a Stamp-compatible 0-5 volts.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Kinzer

    ·
  • MatthewMatthew Posts: 200
    edited 2004-10-16 17:45
    When using the converters as you mentioned, do you just plug the outputs of the sensor through the converters, then to the Stamp? Meaning, do you need one converter per sensor, or can you have multiple sensors to one converter.

    Thanks,
    Matthew
  • Ken GraceyKen Gracey Posts: 7,386
    edited 2004-10-16 23:22
    Matthew,

    Some A/Ds have two-eight channels with different resolution. There are very simple, easy to use A/Ds with one channel (like the 8-bit ADC0831) which are well supported in our books. Depending on the resolution/accuracy of the sensor and output volutage, 8 bits of measurement can often be plenty. Check out our Basic Analog and Digital Text (Stamps in Class series) for many free examples with this part. In fact, some sensors like the LM34 might output 1 mV/F (?), so the range you would measure in a room environment could be 50-100F or so. But with two potentiometers on the ADC0831 you can set the bias and span to measure eight bits over .50V to 1.00V.

    But then there's the RCTIME command. With a precision capacitor, precision resistor and an analog sensor you could even measure sensor output without an A/D converter. This requires some math to make use of the sensor's output (if you want to turn the RCTIME units into useful numbers you can understand) but can often be perfectly appropriate without any complexity depending on the application (is it warm or dark in the room?, etc.). For this command see our Applied Sensors Stamps in Class text from Tracy Allen. It will detail RCTIME with examples.

    I think the answer to your first question is "yes, the Stamp can connect to any sensor" but "depending on what you connect to it and how you write the code".

    What I usually do is find a sensor that is easy to interface to the Stamp. Tell the group what you want to measure and you'd be surprised at the answers you get. Not all sensors are analog, either. Some use asynchronous serial (often really easy and convenient), generate pulses (get yourself a M2125) or are simply on or off. Others are high voltage and might require optically isolated relays. . .

    So, what kind of sensor are you looking for?

    Ken Gracey
    Parallax, Inc.
  • MatthewMatthew Posts: 200
    edited 2004-10-17 00:58
    As for the sensors I plan on using:
    -pressure sensor, Motorala MPXA4110A
    -some sort of sensor that can measure RPM
    -ultra wave sensor
    -tilt sensor (the one Parallax sells)

    Now, a few questions.
    What's the most accurate A/D out there? (I've only seen a 12 bit one, but does more bits necessary mean better accuracy?)
    What's the most powerful ultra wave sensor out there? (I've only seen one that can measure up to 6m)
    Any recommendations for a sensor that can measure RPM?

    Because you have some much experience with these Stamps, I'm sure you don't like questions with "best" or "most" in them. If not, can you just tell me the "best" or "most" you've seen?

    Thanks,
    Matthew
  • DonDon Posts: 34
    edited 2004-10-17 17:03
    Matthew said...
    Meaning, do you need one converter per sensor, or can you have multiple sensors to one converter?
    Generally, you'll need one signal conditioner/converter per input.· If a conversion circuit was expensive, you could use the same converter for multiple identical signals by using an analog multiplexor to connect one signal at a time to the converter.· Usually, this is more trouble than it is worth, though.
    Matthew said...
    What's the most accurate A/D out there? (I've only seen a 12 bit one, but does more bits necessary mean better accuracy?)
    Technically, the number of bits doesn't affect the accuracy, but it does control the resolution.· If you have an 8-bit A/D with an input range of 0 to 5 volts, you'll be able to distinguish 256 (two to the eighth power) different voltage levels.· This means that each level represents a range of 19.5 millivolts (5 volts divided by 256).· With a 12-bit A/D, you have 4096 voltage levels - the resolution on a 5 volt swing is 1.2 millivolts.· In both cases, the accuracy·might be·specified as +/- 1/2 LSB (least significant bit) of resolution.

    Since more bits requires longer conversion time, you'll generally want to use the lowest number of bits that provides an acceptable resolution for your project.· Often, you'll find that an A/D can be operated in different resolution modes.· For example, you might find a 12-bit A/D that can be directed to perform either 8-bit, 10-bit or 12-bit conversions.· Some of them also have multiple analog inputs with a built-in analog multiplexor.· I have used the LTC1298 with good results on a project.· It is a 12-bit, dual channel A/D with serial I/O that is compatible with the Stamp's SHIFTIN and SHIFTOUT commands.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Kinzer

    ·
  • MatthewMatthew Posts: 200
    edited 2004-10-17 19:18
    Okay, thanks for your response.

    In my case, the sensors will need to be as accurate as possible.

    1) You mentioned greater resolution will take more time to process, is there a way of calculating the different times?

    2) I was looking at Dallas Semiconductor's list of A/D and found a dozen of different kinds. Can you explain how they all differ (dual-slope and display orientated ADCs, Sigma-Delta ADCs, High-Speed ADCs, Fast CODECs, Medium/Fast ADCs, single channel, multi channels)?

    http://para.maxim-ic.com/ADConverters.htm

    3) Could I use any A/D out there on the market? Or is there something specific that it needs to have to be used with the Basic Stamp II?



    Thanks.
  • DonDon Posts: 34
    edited 2004-10-17 21:05
    Matthew said...
    In my case, the sensors will need to be as accurate as possible.

    If you do, indeed, need extremely high resolution, you may have to build your own A/D converter.· I suspect, however, that unless you're doing something very unusual, 8, 10 or 12 bits of resolution will be sufficient.

    Matthew said...
    1) You mentioned greater resolution will take more time to process, is there a way of calculating the different times?

    Actually,·my statment was·overly broad.· The typical A/D converter uses a sequential process (internally) to compute the digital approximation to the analog voltage.· This process is often a fixed amount of time per bit.· In any event, the datasheet will tell you what the conversion time is the A/D converter is.· The specification will be given as a maximum sampling rate (perhaps in ksps: thousands of samples per second) or as a conversion time (perhaps in microseconds).

    Matthew said...
    I was looking at Dallas Semiconductor's list of A/D and found a dozen of different kinds. Can you explain how they all differ (dual-slope and display orientated ADCs, Sigma-Delta ADCs, High-Speed ADCs, Fast CODECs, Medium/Fast ADCs, single channel, multi channels)?

    I would focus on factors that are important to your project.· Suggested: the number of bits of resolution, the number of channels that you need, conversion speed (perhaps), interface type (parallel or serial), packaging, cost and availability.· You also need to ensure that the device that you choose is electrically compatible with the Stamp (in most cases, they will be).·

    One other factor that hasn't been mentioned is single-ended vs. differential.· In most cases a single-ended converter will do the job nicely.· In this type, the A/D converter has one analog input per channel and the conversion value is based on the voltage from the input relative to ground.· In a differential A/D converter, there are two inputs to the A/D per channel and the conversion is done based on the difference in voltage between the two inputs.· This is most useful in an electrically noisy environment - the theory being that the electrical noise induced on the two signal lines will be nearly equal and will therefore not affect the conversion value.
    Matthew said...
    Could I use any A/D out there on the market? Or is there something specific that it needs to have to be used with the Basic Stamp II?
    If it is signal compatible with the Stamp, you can use it.· What you're looking for is a 5 volt interface (those that only operate on 3.3 volts won't work for you).· Virtually any A/D that is powered by 5 volts is going to work.· If you want to be certain, look at the device's electrical specifications.· That will tell you what the device expects to see on its inputs and what will present on its outputs.· As long as those are compatible with the Stamp you're good to go.

    More critical, perhaps is the type of interface.· You'll see that there are both serial and parallel interfaces.· A parallel interface would work but it will typically requre as many as 11 I/O lines to operate it.· If the Stamp is doing nothing else, that will work fine.· More often, your project will have a few or many other devices connected to it an you cannot afford to set aside 11 I/O lines just for the A/D converter.· If this is the case you can either build an external parallel to serial interface (using shift registers and latches) or, more simply, just get an A/D with a serial interface.

    There are several different serial interfaces available: 1-wire, 2-wire, 3-wire, etc.· Unless you have prior experience using the 1-wire and 2-wire or I/O pins are extremely scarce, I would suggest going with the 3 wire interface.· These generally are going to be usable with the Stamp's ShiftIn and ShiftOut commands.· You'll have to examine the data sheet to find out what the devices expects and what it'll send back.· Some of them are going to send data in a fixed order, say, most significant bit first.· Others, like the LTC1298 that·I mentioned earlier can send/receive data in either order.

    Another factor that I mentioned above is packaging.· If you're going to be experimenting with the device, it is often much simpler to use a device·in a DIP package.· Other package types can be used but the prototype boards are generally set up for DIPs.· You can, of course, build a prototype or proof-of-concept device using a DIP package and then change to a different device and/or different packaging for a production run (if such is in your plans).


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Kinzer

    ·
  • MatthewMatthew Posts: 200
    edited 2004-10-17 21:33
    Wow. Thanks for clearing up almost everything. Seems like I'm going somewhere I shouldn't be going, especially for a beginner!

    I'll stick with the 12 ADC that Parallax offers.

    Thanks again,
    Matthew
Sign In or Register to comment.