Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: 5V on analog input teensy 3.2

  1. #1
    Junior Member
    Join Date
    Nov 2017
    Posts
    3

    5V on analog input teensy 3.2

    I have a pressure sensor that has a max output of 5V.
    is there a way to connect that to a teensy 3.2 without a resistor based voltage divider ?

    A voltage divider is not that precise enought in my opinion th resistor may vary due to temperature or other infuences.
    i was thinking about a mcp3008 but i dont know if that wil work supplying it wit the 3V from the teensy3.2 and connecting 5v to the inputs.

    any ideas are helpful

  2. #2
    Some thoughts:

    - make the resistor divider adjustable with a potentiometer; bear in mind digital resolution on teensy 3.2 is effectivly just 12 bit (exept differential inputs), so it may work for you
    - put a precise voltage reference (e.g. 2.7 V) and a resistor against ground and messure the point between referenz and resistor, calculate the right values (correct the offset) in your software
    - put a circuit with an operational amplifier with a gain of about 0.6 before the analog teensy pin, calculate the right values (correct the gain) in your software

    I wish you success

  3. #3
    Junior Member
    Join Date
    Nov 2017
    Posts
    3
    Hi Larry_berlin,

    the sensor has an output of 0,5v@ 0 bar 4,5V @7bar i need to measure by 0,5bar 0- 0,5- 1- 1,5 etc etc
    how would you suggest the circuit with the opamp this ?
    any example ?

  4. #4
    Senior Member Epyon's Avatar
    Join Date
    Apr 2013
    Location
    Belgium
    Posts
    439
    I recommend against an opamp circuit. Most opamps are unstable at gains less than 1 and it reduces bandwidth and slew rate. In general opamps make for bad attenuators. Your gain will also depend on the temperature coefficient of the gain resistor.

    The most straightforward way is still the simple resistor divider, but use precision resistors with at least 0.5% accuracy and 100ppm temperature stability. E.g. a 1kOhm resistor with 20ppm stability will only change 0.5 Ohm if its temperature changes from 25C to 50C (77F to 122F). These resistors are a bit more expensive than your run of the mill resistors, but you only need two right.

    You can also use less stable resistors and use an additional analog input to measure the voltage over a known resistor divider (e.g. VCC/3). If this voltage changes you can calculate and compensate for the resistance change.

    An external ADC is also a solution. I like the ADS1115 more, it has a wide voltage input range, differential input, programmable PGA an good library support.

  5. #5
    Quote Originally Posted by Epyon View Post
    I recommend against an opamp circuit. Most opamps are unstable at gains less than 1 and it reduces bandwidth and slew rate. In general opamps make for bad attenuators. Your gain will also depend on the temperature coefficient of the gain resistor.

    The most straightforward way is still the simple resistor divider, but use precision resistors with at least 0.5% accuracy and 100ppm temperature stability. E.g. a 1kOhm resistor with 20ppm stability will only change 0.5 Ohm if its temperature changes from 25C to 50C (77F to 122F). These resistors are a bit more expensive than your run of the mill resistors, but you only need two right.

    You can also use less stable resistors and use an additional analog input to measure the voltage over a known resistor divider (e.g. VCC/3). If this voltage changes you can calculate and compensate for the resistance change.

    An external ADC is also a solution. I like the ADS1115 more, it has a wide voltage input range, differential input, programmable PGA an good library support.
    Epyon is right.
    Simplest solution is his suggestion with precision resistors for resistor divider.

    I also often use ADS1115 (or even ADS1114 , ADS1113 if you need just one or 2 channels). There are cheap ready to use modules on the market (e.g. https://www.adafruit.com/product/1085). You have to supply the ADS1115 with 5V in your application (you have to measure up to 4.5 V), connect I2C lines direcly to digital pins (I2C) of teensy 3.2 (it is 5V tolerant), don't forget pull up resisitors (4.7k or 10k) on I2C lines (often these are already present on the prefabricated modules).

    I assume you use pressure sensor similar to MXP4250. Then you need a stable power supply for this kind of sensor or you measure the supply voltage of the sensor also and corrects the readings in your software.

  6. #6
    Junior Member
    Join Date
    Nov 2017
    Posts
    3
    its this sensor https://www.letscontrolit.com/wiki/i...ressure_sensor
    i will order ads 1115, now i have to find out how to connect the I2C lines.

    thanks for al the sugestions

  7. #7
    Quote Originally Posted by Sprokkie View Post
    its this sensor https://www.letscontrolit.com/wiki/i...ressure_sensor
    i will order ads 1115, now i have to find out how to connect the I2C lines.

    thanks for al the sugestions
    Simply connect SDA with pin 18 and SCL with pin 19 of teensy 3.2. If you use prefabricated module like in my example (Adafruit), you don't need pull up resistors.
    For your code use "wire" library and the library ADS1015 from Adafruit.
    You can get ADS1115 modules much cheaper than from Adafruit (search amazon), half price but compatible.

    Test all on a breadboard before make any PCB (software also). And check if the sensor analog ouput doesn't depend on the supply voltage of pressure sensor.

    Much fun.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •