5.12V reference question

Discussion in 'Embedded Systems and Microcontrollers' started by tracecom, Dec 29, 2013.

  1. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Is there any problem using a 5.12V reference with a PIC that is running on less than 5.12V, 4.5V or 4.9V, e.g.?

    Thanks.
     
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Yes. Try a 4.096V reference.
     
    tracecom likes this.
  3. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Thanks.

    I snagged a circuit off the web, made a couple of mods, and built it; the schematic is attached. Using a 10 turn pot for R2, I can adjust Vout to either 4.096V or 5.12V.

    However, I don't really know if the R values are optimum. In addition, R1 gets hot, so I need to either increase the resistance or the wattage.

    What changes do I need to make?

    And is C1 needed, and is it just a .1uF?
     
    Last edited: Dec 29, 2013
  4. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
    Hello,

    Do you have the schematic or a link?

    Bertus
     
  5. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Yes, I forgot to attach it. I'll go back and do that. Thanks.
     
  6. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
    Hello,

    R2 and R3 are rather low valued.
    Looking at the datasheet R3 is between 5K and 10K.
    R2 would be 10K or 20K in your case.

    How much current is needed from this reference.
    For good regulation the TL needs 0.5 mA itself.
    You have a total current of about 15 mA now.

    Bertus
     
    tracecom likes this.
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    I think you always will find that the datasheet say that the Vref range allowed allowed are limited by VDD
     
  8. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Right, no pin of a processor should ever exceed the power supply voltage. But you could run the processor on 5.12 Volts and use the power supply as reference, which would save a pin. Is that an idea worth pursuing?
     
  9. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Thanks for all the input. The processor that I plan to use is the 16F88, and I need to stick with a LM7805 or LM78L05 regulator, which will be very close to 5.0V. However, I looked at the 16F88 datasheet, and it seems to say that the minimum reference voltage is 2.0V and the maximum is Vdd + 0.3V, so I should be okay at 5.12Vref.

    Thanks again.
     
  10. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Here's the revised schematic. It seems to work well, but please feel free to point out any errors. Thanks.
     
  11. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Another option is to just use the Vdd as the Vref, and measure it with a multimeter. Once you know what the Vdd voltage is you can just do the ADC correction in the software.
     
    tracecom likes this.
  12. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    I was wrong earlier: it should be OK to apply more voltage to a processor pin than the power supply, provided that the input protection diode doesn't conduct, which would be at about half a volt of difference. Even if applying that voltage to the chip doesn't damage anything, I'd be interested in hearing whether an analog input works throughout the reference range, particularly the part above 5.0V. But most of the time, probably it doesn't need to--the aim would be to get a nice relationship between input voltage and A/D counts. With a 5.12V reference and a 10-bit A/D, that's exactly 5mV per count. Yes, you could do some math and use a 5V reference, but I imagine there would be some quantization errors.
     
    tracecom likes this.
  13. RamaD

    Active Member

    Dec 4, 2009
    254
    33
    TL431 stability is with a load cap of <5nF or >5uF approximately. Varies with Ika and Vka, but the above range covers the forbidden region. 10uF low esr or tantalum is my preference.
    For R2, 5.1K is preferable, so that while adjusting the voltage does not go above 5.3V.
     
    tracecom likes this.
  14. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Sure but it's probably not as bad as it first sounds. Generally the ADC value is used for some real world task, and has to go through a scaling math procedure anyway (like; result = ADC *X /Y) which itself produces quantising errors. So in that case you can just include the calibration value as part of that scaling procedure.

    If more accurate ADC is required it is generally a good idea to add together a lot of ADC samples, which gives a much higher data resolution so that increases accuracy, reduces the effect of HF noise and greatly reduces any quantisation errors caused by later scaling and/or calibration.
     
  15. #12

    Expert

    Nov 30, 2010
    16,332
    6,818
    Your mistake was assuming the first circuit was set up for something besides the maximum survivable current for the TL431. You don't need 150 ma for a reference voltage. Thus, you trimmed it down to 26 ma. I suspect that is still way more current than your 16F88 chip needs for a reference voltage.

    Page 188 of the PIC 16F88 dtatsheet: Vref input current = 150 ua
    Using my usual standards for a precision reference, 100 x 150 ua = 15ma
    On a lesser quality job, 10X would be sufficient.
    The TL431 probably contributes a lot to the stability of your reference voltage.
    I don't know enough about PICs to say whether you could get excellent results with less current than 15 ma in your reference circuit. That would be a good topic for a new thread. How much TL431 shunt current is really necessary for x% precision on a PIC ADC reference pin?
     
    Last edited: Dec 30, 2013
    tracecom likes this.
  16. tracecom

    Thread Starter AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Thanks. This should provide 15mA.
     
  17. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Why would you need 100X or even 10X? Just hang a bypass (energy storage) capacitor between the TL431 output and the reference input. If the Ref input pin draws a transient current larger than 150uA, it can come out of the capacitor. If you are worried about ESR in the capacitor, hang a low esr, low inductance disc ceramic across the larger capacitor...
     
  18. RamaD

    Active Member

    Dec 4, 2009
    254
    33
    I agree with you fully on providing current just marginally higher than what is required, and not way higher than what is required.
    TL431 is a shunt regulator, and requires atleast 0.6mA through the cathode for regulation. The resistor divider would require 0.5mA. And then the load current of 160uA. All this at lowest Vin. With all the margins, couple of mA should be ok. So, a 3.3K instead of 470 Ohms!
    BTW, the point I was mentioning about R2, is that, if the wiper is moved so that the resistance is 10K, output voltage could go to above 7.5V, which could damage the microcontroller. That is why I suggested 5.1K.
     
  19. bertus

    Administrator

    Apr 5, 2008
    15,648
    2,348
    Hello,

    I made a little change in the schematic.
    With the modification, the voltage can be adjusted between ca. 5.00 and 5.26 Volts.

    [​IMG]

    Bertus
     
  20. #12

    Expert

    Nov 30, 2010
    16,332
    6,818
    Good job!
    Some people that know responded to my idea.:)

    (That 10X and 100X stuff came from the old days of simple resistive dividers.)
    I remembered where that came from. In this circuit, the TL431 is improperly used and the resistive divider on the right should carry a lot more current than the load in order that it doesn't change much when the load, as seen on the datasheet, changes from 50ua to 150ua.
     
    Last edited: Dec 31, 2013
Loading...