B4R Question Technical question ADC pin/ Potentiometer

Discussion in 'B4R Questions' started by Beja, May 14, 2019.

  1. Beja

    Beja Expert Licensed User

    To interface a pot to an Arduino analog pins, you need to connect all 3 pins (Vcc, Gnd and the center pin..
    Why is that necessary? Isn't Vcc and the center pin enough to send a variable voltage to the analog pin"
    In the image below, why A and not B?

    quiz8.png
     
  2. Cableguy

    Cableguy Expert Licensed User

    Electronic wise both are correct, and to me a single (pot center pin) pin to the Arduino is enough. Still if you plan to use the pot as a positive/negative and mesure tension drop, the you need the 3 pins to the arduino.

    PS I keep forgetting that we refer to the whole board when we say Arduino. To me an Arduino pin is a usable I/o pin. Vcc and gnd are power pins from/to the board and not directly from the atmega.

    In the 3 pin configuration, the analogue will read from vcc to gnd, in the 2 pin, the minimum value is as open pin, which may result in a non-zero value
     
    Last edited: May 14, 2019
    Beja likes this.
  3. klaus

    klaus Expert Licensed User

    A. This is a voltage divider. You need the three connections to get a voltage between 0 to Vcc.
    B. Here you put a variable resistor between Vcc and Signal. You will get always Vcc as the input.
     
  4. Cableguy

    Cableguy Expert Licensed User

    What he said
     
    Peter Simpson likes this.
  5. Beja

    Beja Expert Licensed User

    Thanks Cableguy and Klaus.. (alphabetical)
    Hi Klaus,
    Is that because A0 is internally connected to Vcc?
     
    Last edited: May 14, 2019
  6. Beja

    Beja Expert Licensed User

    Then how about if the pot two points are connected between Gnd and A0?
     
  7. Cableguy

    Cableguy Expert Licensed User

    Then you mesure nothing, ADC needs a reference voltage, usually it's internal.
     
  8. klaus

    klaus Expert Licensed User

    No!
    Look carefully at the sketch!
    You are connecting Vcc to Signal via a variable resistor, the resistor value will vary between 0 and the nominal value of the potentiometer.
    This means that you will read the max value.
    You will read 0, because you are connecting A0 to Gnd via a resistor.
     
    Beja likes this.
  9. Beja

    Beja Expert Licensed User

    Thanks Klaus
    I wish I knew the internal circuitry of this A0 pin.
    I am thinking with the discreet ADC in mind, from the old good time of TTL LSI ICs.
     
  10. klaus

    klaus Expert Licensed User

    Well, for me, even if I don't know the internal circuit of the analog input.
    I know that it's an analog input and I have to provide a voltage, taking care of the maximum voltage beeing supplied.
    This can be provided by a sensor, or for testing with a potentiometer, and in this case it must be voltage divider.
     
    Beja likes this.
  11. Beja

    Beja Expert Licensed User

    Indeed I believe you Klaus, only trying to understand..
    Assuming that a voltage level follows the variable resistor, then I expect if a var's two adjutant legs connected to Vcc and A0 then the input of A0
    should vary as well.So no need for the third leg.

    varsistor.png

    Correction:
    More resistance when turned counterclockwise
     
    Last edited: May 15, 2019
  12. kolbe

    kolbe Active Member Licensed User

    Inputs are high impedance, something on the order of Mohms. The ATmega328P states 100 Mohms. So this means that you (@Beja) are correct the voltage does change but... in a negligible way so Klaus is correct too. A few nano amps through a 10K resistance isn't much of a voltage drop.

    Hope this helps.
     
  13. Beja

    Beja Expert Licensed User

    How can I say that if one can dim and brighten an LED with potentiometer?
     
  14. kolbe

    kolbe Active Member Licensed User

    A potentiometer will limit the current that flows through a LED provided you are above the threshold voltage. A higher resistance means less current, ohm's law, less light emitted. The LED when above the threshold voltage has almost no resistance... the exact opposite in the case above with a input on the ATmega328P. FWIW, the best way to control on LED is with PWM and not a potentiometer as you could easily overdrive the LED if the resistance drops to far.
     
  15. Beja

    Beja Expert Licensed User

    Thanks but I don't want to dim LED with that simple arrangement.. Just wanted to show an LED can be dimmed and brightend with only 2 legs of the pot. It doesn't matter if it burns at max current.
    Ok forget about the LED. Use a voltvoltmeter and put the Gnd probe on the pot center pin and the positive probe on a dc power supply.. Then move the pot wiper and watch the volt varies.
    The question is, when applying connecting the center pin to A0 then it should also read a varying volt. Right?
     
    Last edited: May 15, 2019
  16. kolbe

    kolbe Active Member Licensed User

    Sorry but I don't think this discussion is going anywhere. What you are really doing and asking isn't clear to me. I'll just end with this.

    In your diagram in post #1, A is the normal way of using a potentiometer as A0 (set to an input) will see the voltage vary because you have a voltage divider. In B what you have electrically is dependent on how you set up A0. If it's an input the circuit is still equivalent to a voltage divider but the arduino input is a very large resistor to ground which will only produce a very small voltage change as the pot is turned, unless the pot value is in the mega ohms. Maybe you are seeing something else as you are dealing with the complex internal circuitry of the microprocessor to complete the circuit which could vary depending the state of the microprocessor.

    Think of it this way, in B you need a ground to complete the circuit or else no current and just Vcc. How is that done in B is the question and will determine the results and is complex as it is happening through the microprocessor's many components that can vary depending on the state of each.
     
    Beja likes this.
  17. Johan Schoeman

    Johan Schoeman Expert Licensed User

    The ground serves as a zero reference where voltage is measured from. Imagine the ground is not connected and floats to let's say 2V and VCC is 5V. Now the voltage range will only be 3V and not 5V as when the pot is connected to ground.
     
    Beja likes this.
  18. Beja

    Beja Expert Licensed User

    Thanks guys for the efforts.. truly appreciated.
     
  19. advansis

    advansis Member Licensed User

    If you connect the A0 PIN (don't know if that particular pin has this feature) with the internal pullup resistor, you can measure the voltage variation while rotating the knob. But the value depends on the global resistance of your potentiometer and will be not precise. If you are interested, I will post an explaining drawing
     
    Beja likes this.
  20. Beja

    Beja Expert Licensed User

    Sure I am,
    With ADC8080 for example.. I could use both, the three pins and only two pins.. but I shouldn't apply more then VCC, the
    chip knows the range because it is its own power supply. That was 35 years ago and still my memory may be misleading.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice