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

Thread: possible to power a voltage divider for a analog in by a digital out?

  1. #1
    Senior Member
    Join Date
    Dec 2016
    Posts
    114

    possible to power a voltage divider for a analog in by a digital out?

    Hi

    Probably a stupid question:

    Is it possible to use a digital out to give the +3.3V to a voltage divider which is read bij an analog pin?
    (aprox. 1000 Ohm - 1000 Ohm divider).

    Is it stable after 0.1 msec?

    Alain

  2. #2
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,342
    I think that might work... you could just try it...

    .... is it to turn off the current when you're not going to be reading it?

  3. #3
    Senior Member
    Join Date
    Dec 2016
    Posts
    114
    It's indeed to only turn on the current when measuring.

    Because I plan it to be battery powered and only need a measurement every few seconds (or even less), I want to conserve unneeded energy.

  4. #4
    Senior Member
    Join Date
    Feb 2015
    Location
    Finland
    Posts
    183
    Yes, it does work. This is how resistive four-wire touch panels are read as well: a pair of pins is used as outputs, and the coordinate along that axis is read from either of the two other pins; then the roles are swapped for the other axis.

  5. #5
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,342
    Quote Originally Posted by AlainD View Post
    (aprox. 1000 Ohm - 1000 Ohm divider)

    If the first 1000 in the OP was meant to be 100 that's a lot of load (33 mA by my oft faulty calculations) - I've heard 25 is the limit.

    So 500 Ohm or greater I think to be safe.

  6. #6
    Senior Member
    Join Date
    Dec 2016
    Posts
    114
    Quote Originally Posted by oddson View Post
    If the first 1000 in the OP was meant to be 100 that's a lot of load (33 mA by my oft faulty calculations) - I've heard 25 is the limit.

    So 500 Ohm or greater I think to be safe.
    3.3V - 1000ohm or a bit more fixed resistor - the analog in - and a PT1000 (a bit above 1000Ohm) to the ground

    So about 2000-2300 ohm from 3.3V to ground.

  7. #7
    Senior Member
    Join Date
    Feb 2015
    Location
    Finland
    Posts
    183
    You won't have much accuracy at all doing it that way.

    I would recommend you use a MAX31865 instead, with its voltage or ground switched via a transistor or MOSFET on demand by Teensy.

    You can find cheap (4-5) break-out boards on eBay for example. They typically have a 430 Ohm reference resistor, but for PT1000, a precise 4000 Ohm resistor would be much better. (Even just replacing the resistor with one whose resistance you have measured accurately -- it does not have to be 4000 ohms exactly, 3.92k or 4.02k will be just perfect; all that matters is that you know or measure its accurate resistance, so you can do the math on Teensy correctly, giving you accurate temperature measurements.)

    Plus, you can use a three-wire PT1000 sensor, and with just a little math on the Teensy (as the PTC resistance as a function of temperature is not exactly linear) you can get half a degree Celsius/Kelvin accuracy; with a fraction of a degree resolution. (Meaning you can detect relative changes, on the order of a fraction of a degree, but with proper math compensation, your measurement can be accurate to within a degree or less over the entire range.)

    The MAX31865 does not consume much current at all, no more than 10mA or so during conversion -- that 10mA being just the figure you need to use for its power budget, i.e. using a small transistor with a maximum current rating of say 50 mA is plenty. You do need to power the MAX31865 for something like 10 - 20 ms from power on before initiating a measurement, each measurement taking somewhere around 50-70 ms, so budgeting about 100 ms per measurement should work fine.

    I have a few MAX31865's as well as 3-wire PT100 (but no PT1000) temperature sensors, so if there is something you wish me to check, let me know.

    I do also dabble with EasyEDA (but I am only a hobbyist bumblespork!), so if you want to make your own board, I may be able to help. The MAX31865 circuit is simple, just three capacitors and a precise reference resistor -- the value itself isn't that important, as long as you know it precisely! --, so adding a power-controlling transistor with a current-limiting resistor, and maybe an inrush current limiting resistor for the MAX31865 power too, would be a simple thing. I like EasyEDA, because it is easy enough for a hobbyist like me, and getting the boards manufactured at JLCPCB is easy; here are some of my own "designs". Other members here have much more experience than I, though!

  8. #8
    Senior Member
    Join Date
    Dec 2016
    Posts
    114
    Hi

    Thanks

    I checked it with two fixed resistors and it works quite well.

Posting Permissions

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