Utilizing the Arduino ADC Internal Reference

Поделиться
HTML-код
  • Опубликовано: 19 авг 2024

Комментарии • 31

  • @iHayri1
    @iHayri1 8 лет назад +1

    Thank you very much for your video and your code. After searching and trying for hours to get something working with my OLED Voltmeter code yours worked right away and now I can see the voltage of my LiPo battery.

  • @AngelGdo
    @AngelGdo 7 лет назад +2

    You are the man! This video helped me so much to understand the internal reference voltage.

  • @captiveimage
    @captiveimage 7 лет назад +1

    Awesome! Been looking for some way to measure the Li-Ion Battery status on the MKR1000... looks like this technique is the way forward. Many thanks.

  • @CasaMaryParadise
    @CasaMaryParadise 2 года назад +1

    Nice stuff!

  • @ABID5
    @ABID5 5 лет назад +2

    This is what i wanted. Thank you

  • @whitefields5595
    @whitefields5595 6 лет назад

    At 11:00 you explain how to measure ARef. ARef varies with VCC. Here are my measurements for ARef taken for a range of VCC values on an Arduino Nano (ATMega 328P). I bypassed the regulator putting VCC straight to the VCC pin;
    VCC ARef
    6.0 1.030
    5.5 1.043
    5.0 1.054
    4.5 1.067
    4.0 1.073
    3.5 1.081
    3.0 1.085
    This represents a 5.1% variation.
    I want to use a battery, but get the maximum use from a single charge so bypass the regulator to avoid regulator drop-out.
    I deduce that we should use the ARef when VCC is in the mid-range of what is to be measured. In my case I am putting an unregulated 18650 cell directly to VCC. The 18650 range is 4.0 to 3.0 V so I'm taking the mid-range value of ARef at 3.5V of 1.081 for maximum accuracy at the mid-point of the 18650 discharge curve. If I want end state accuracy I would use the value at 3.0V of 1.085.
    Comments?

    • @bob-ny6kn
      @bob-ny6kn 2 года назад

      Why does Aref decrease as Vcc increases?

    • @whitefields5595
      @whitefields5595 2 года назад

      @@bob-ny6kn Bob, I can barely remember what I was doing at the time 4 years ago 💁‍♂️
      I do not know why there was an inverse relationship ... but those were the values I recorded at the time, presume the same now if you want to try it?

  • @shambhaviuppin
    @shambhaviuppin 4 года назад

    Working perfect!!!
    This was something I was really looking for...
    Thank you so much!!

  • @bob-ny6kn
    @bob-ny6kn 2 года назад

    Divide by 1024 (steps), not 1023 (largest number).

  • @radekkierzek6853
    @radekkierzek6853 2 года назад

    I have notice for slide (5:24). External AREF pin not go down to 0V. Datasheet says (for each chip may be different) bottom/minimal value, but not 0V. eg.m328 1.0V-AVcc, ATtiny44A 2.0V-AVcc ranges

  • @savaliyachintan5216
    @savaliyachintan5216 7 лет назад +1

    Really thank you so much for sharing

  • @syedumarjunaid5499
    @syedumarjunaid5499 3 года назад +1

    Voltage = (iRef/result)*1024 ;
    Is that equation right for calculating adc voltage?
    Is it not this:
    Voltage = (iref/1023)*result;
    ???

    • @sammyk7024
      @sammyk7024 3 года назад

      your question is very good. unfortunately, it does not have a simple answer (I've been struggling with it for years). this topic on the arduino forum illustrates what I mean:
      forum.arduino.cc/index.php?topic=303189.0

  • @heninghidayat8652
    @heninghidayat8652 4 года назад

    Thank you for the video, it helps me alot!

  • @charlesmarsh6243
    @charlesmarsh6243 8 лет назад +4

    At 1:45 you say 10 bit is "10 to the 2", I think you meant to say "2 to the 10th power".

    • @ForceTronics
      @ForceTronics  8 лет назад +1

      +Charles Marsh Thanks for pointing out that error, I will add a note.

  • @Taran72
    @Taran72 4 года назад

    This is great Video!! thank you so much for the wonderful explanation!!! :)

  • @partha95123
    @partha95123 6 лет назад +1

    Very good tutorial!! :)

  • @TheAndricos
    @TheAndricos 7 лет назад

    Thank you!
    This is realy helpful.

  • @hansifansi
    @hansifansi 5 лет назад

    At 11:00 can I use any analog pins for this (for reading the analog value in the loop)?

  • @sufiansiddiquee
    @sufiansiddiquee 8 лет назад

    hi, i want find out my arduino internal reference voltage. i did the same you said. i put my DMM GND to Arduino GND and DMM PLUS to ARDUINO AREF. and ran the code but nothing happened. i mean it was still zero.

    • @ForceTronics
      @ForceTronics  8 лет назад +1

      That should work, make sure you have the internal reference selected and then just loop in your code ADC measurements and the internal reference voltage will be at the AREF pin. Another way to calculate it would be to use a known VCC value (measure it) divided down with a voltage divider. Then measure that known value with the internal reference. Any error in the measurement will be due to your internal reference not being exactly 1.1V and you can derive a correction factor from that.

  • @marwanal-yoonus280
    @marwanal-yoonus280 5 лет назад

    Thank you for good illustration.
    I have a 50Hz sine wave and I want to sample it at 120Hz using Arduino Uno but l found that it's slow: I try only at sampling frequncy fs=50Hz. How l can increase the speed of ADC?
    I am looking forward to hearing from you.
    Thanks

    • @ForceTronics
      @ForceTronics  5 лет назад +1

      You have to use the 328p datasheet to reduce the measurement time of ADC by setting the proper registers. These settings are done behind scene by Arduino

  • @TheQade
    @TheQade 8 лет назад

    What is the 1.08 internal reference cal factor? And where do I get mine? :)

    • @ForceTronics
      @ForceTronics  8 лет назад +1

      The internal reference for the ADC is suppose to be 1.1V, but it is not perfect so the datasheet says it can be off plus or minus 10%. If you assume that it is 1.1V and it is actually 1.07 than all your ADC measurements will be off 30mV. If you measure the internal reference from the AREF pin to find out its actual value you can use that as a calibration factor in your code to have more accurate ADC measurements

  • @rimmersbryggeri
    @rimmersbryggeri 4 года назад

    arduino raw

  • @AerialPhotogGuy
    @AerialPhotogGuy 5 лет назад

    Sorry for responding to such an old video but I have a question that I can't seem to find the answer to on the Arduino Forum or Stack Exchange, I think I already know the answer but maybe you can confirm what I'm thinking.
    I have one analog input that is 1.8V max and it's certainly easy enough to use a resistor voltage divider scheme to scale that down to just under 1.1V max (or just under whatever the voltage reference actually is).
    The problem is that I have three other analog inputs with voltages ranging from 0 to 4.6V, when I activate the internal 1.1V reference, it seemed to effect all of the analog inputs.
    Is there a way to use the internal 1.1V reference for just one analog input, then use the default reference for the other three analog inputs?
    It would be great if I could use the internal 1.1V reference for just one analog input because that specific input needs to be as accurate as possible.
    I'm guessing that the best way to handle this is to use an external voltage reference at the AREF pin at the 328P-AU chip, I could remove the 0.1uf SMD CAP and attach the external reference voltage to the pad where the CAP was removed.
    I'm think about using the TL431 Adjustable Shunt Voltage Reference Device for that purpose.
    I read on the Arduino website that I can use an external reference at the AREF pin with a 5k resistor in series so I could switch between the internal and external references. Unfortunately There were no code examples to demonstrate how to switch between the two. I realize that using an external reference requires that I call for the external reference in the code to prevent a dead short internally but I'm not sure how to switch between them or even for sure if what I read is what I am after.
    Great videos!! All are very helpful!!
    Thank you!!
    Joe

    • @ForceTronics
      @ForceTronics  5 лет назад

      Most microcontrollers, including the ones used by Arduino, only have one internal ADC. They may have multiple ADC inputs but a multiplexing switch feeds those multiple ADC inputs to the single internal ADC therefore you can only use one voltage reference at a time. I would consult the microcontrollers datasheet for things to watch out for when switching voltage references during operation

    • @AerialPhotogGuy
      @AerialPhotogGuy 5 лет назад

      @@ForceTronics
      I checked the datasheet for the 328P-AU and it indicates that I can switch between references but one small mistake in code for the reference portion could easily render the chip useless due to an internal short.
      So, I plan to use the TL431 Adjustable Shunt Reference at the AREF pin (then of course make sure the external reference is called in the sketch), I will buy a different version of the INA250 current sense/amplifier that will output a higher voltage per amp, basically, I can just increase the max output from 1.8V (500mV per amp output) to 7V (2 volts per amp output), then use a resistor voltage divider to scale that down to about 4.5V for the max input at the analog pin I'm using.
      Keep it as simple as possible, right? :-)
      For those not familiar with the INA250 series current sense/amplifier device, it has the current sense resistors, output buffers and an op amp style amplifier all built into one chip, they are designed to have extremely low output errors. The resistors are about 6 milliohms each but there are three of them for a total of 2 milliohms since they are in parallel (and Kelvin connected) and since the resistance is so small, that very small device can handle up to 15 amps of current flowing through as long as the PCB traces are done right (usually best done with dedicated polygons for separate copper pours).
      Thank you so much for your quick response!
      All the best and I hope you have a great day!!
      Joe