Shop OBEX P1 Docs P2 Docs Learn Events
BS2PX CONFIGPIN 3V logic level — Parallax Forums

BS2PX CONFIGPIN 3V logic level

JimKJimK Posts: 21
edited 2008-11-20 21:48 in BASIC Stamp
I recently purchased the HM55B compass from Parallax but discovered after·testing and calibration the accuracy and issue with tilt error would·not be practical for my application (for use on a sailboat in the·ocean).· I also saw this thread which explained in more detail those issues.

http://forums.parallax.com/showthread.php?p=736727

I·found this compass sensor OS5000 TTL that seems to have better accuracy, tilt compensated, plus pitch and roll data·in a ASCII NMEA output format (and expensive at $250).

http://www.oceanserver-store.com/os3axdicoton.html

In reading the Ocean Server user manual it states the TTL version, Tx uses a voltage level 3v and the Rx says 3v or 5V tolerant.

I have a BS2px and noticed the CONFIGPIN command has a logic threshold option that can set a pin for TTL or CMOS levels.· My question is can I use the CONFIGPIN command to specify CMOS logic levels and be able to use the 3v output level of the compass sensor ?· I assume I cannot simply connect Tx to the BS2px since it does not output 5v levels ?

I also saw Sparkfun sells a logic level convertor board but wonder if anyone could tell me if the think the CONFIGPIN option would work.· As I said the sensor is expensive and I do not want to purchase it unless I am somewhat confident it can interface to the BS2px.·

http://www.sparkfun.com/commerce/product_info.php?products_id=8745

Thanks!

Comments

  • BeanBean Posts: 8,129
    edited 2008-11-20 01:58
    CMOS levels are 1/2 Vdd (2.5V), and TTL levels are fixed at 1.4V.
    So I would go with the CMOS levels, but really it rarely makes a difference.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    "The welfare of the people in particular has always been the alibi of tyrants." ~ Camus
    www.iElectronicDesigns.com

    ·
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-11-20 04:12
    Although the nominal threshold for most CMOS inputs is Vdd/2, as Bean suggests, the datasheet for the SX48 (the BS2px's processor) specs 0.7*Vdd for a guaranteed high and 0.3*Vdd for a guaranteed low. This makes the high threshold potentially as high as 3.5V, which is above the OS5000's output level. This is typical of the way CMOS inputs are spec'd, BTW. For this reason, I would definitely go with the TTL input levels.

    When I'm designing with 5V CMOS circuitry that may have to accept inputs from 3V or 3.3V logic, I always interpose a 74HCTxx gate or buffer to make sure the CMOS device receives an adequate signal. Fortunately, the BS2px gives you a choice, obviating the need for external circuitry.

    -Phil
  • JimKJimK Posts: 21
    edited 2008-11-20 13:01
    Bean/Phil,

    Thank you for your comments.· So it sounds like TTL mode would work.· Is this generally true of interfacing any 3.3 volt sensor with a stamp ?· I have seen several sensors that use 3.3 volts and always thought they would not work with a stamp.· Thanks
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-11-20 17:25
    With 3.3V devices you can always take the output of one into the input of a 5V device. The issue is that some 3.3V devices cannot handle 5V on their input. Although the device you mentioned is 5V tolerant, you’ll probably be putting a series resistor between the I/O pin from the BS2px and the module to limit current. No level shifting should be required.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • JimKJimK Posts: 21
    edited 2008-11-20 17:57
    Thanks Chris
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-11-20 18:30
    Chris Savage said...
    With 3.3V devices you can always take the output of one into the input of a 5V device.
    Yes, I agree, that almost always works. But when you read the spec sheets for CMOS devices, you see a range of input thresholds, spec'd for different values of Vdd and temperature. For example, here are the NXP Semiconductor input characteristics for their 74HCxx logic chips:

    attachment.php?attachmentid=56859

    For a 4.5V Vdd (and who knows why they spec it that way) the minimum input level to guarantee being read as a "high" is 3.15 volts over temp. This is 0.7 * Vdd, which is typical of CMOS specs. At 5V Vdd this would be 3.5V, which makes driving with 3.3V logic not a total slam dunk. While it would take an extreme situation for it to fail under such circumstances, I always design with the worst case in mind, and that usually entails interposing a 74HCT gate, with its lower input thresholds, in the signal path.

    The fact that VIH(min) and VIL(max) are so widely separated doesn't imply that there's hysteresis built into the inputs, though. It only means that the actual switching threshold can vary between those two values, across production lots and at various operating temperatures. Typically, at room temperature, this range is reduced to 0.47 * Vdd - 0.53 * Vdd, according to the datasheet. This is where the "Vdd/2" value that's so often quoted comes from.

    Am I being overcautious? Probably. But it's an approach learned the hard way I'm afraid.

    -Phil
    565 x 188 - 9K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-11-20 19:24
    Phil, I am trying to think where I have supplied 3.3V outputs into a 74HC device…and all I can think of is the 74HC165 and 74HC595, which do work. It is, of course, always a good idea to check things like that. The BASIC Stamps having a fixed threshold for a 5V device have made some of us lazy I think. =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-11-20 19:45
    Chris,

    I had a case recently where I spec'd a 74HCT595 that had to run on 5V and, as an option, be driven by 3.3V. But the assembly house subbed a 74HC595 instead. I didn't catch it in the first articles, since they worked fine, and the boards went into production that way. To date there hasn't been a failure that I know of, despite my initial chagrin and unease over it. But I always try to use 'HCT parts in cases like this, just to be on the safe side.

    -Phil
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-11-20 21:48
    Definitely a good idea. =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.