Connect with us

Using a digital potentiometer

Discussion in 'Microcontrollers, Programming and IoT' started by Balos69626, Nov 11, 2020.

Scroll to continue with content
  1. Balos69626

    Balos69626

    4
    0
    Nov 11, 2020
    Hello
    I'm trying to set the resistance of a digital potentiometer DS1804-10, and I'm not sure how to programme it on the Arduino software. I'm using an Arduino Uno.

    Pin 1 (INC) on the potentiometer goes to pin 12 on the Arduino.
    Pin 2 (U/D) on the potentiometer goes to pin 13 on the Arduino.
    Pin 4 (GND) on the potentiometer goes to ground (-)
    Pin 5 (W) goes into a comparator.
    Pin 7 (CS) on the potentiometer goes to ground (-)
    Pin 8 (Vcc) has 5V coming in (+)

    Now I'm confused about how I know the resistance of the potentiometer and how I can programme the correct resistance.
     
  2. bertus

    bertus Moderator

    1,158
    439
    Nov 8, 2019
    Hello,

    What did you do with the pins 3 and 6?
    Those are the ends of the potmeter:

    DS1804-features.png

    Bertus
     

    Attached Files:

  3. Balos69626

    Balos69626

    4
    0
    Nov 11, 2020
    I was told they didn't need to go anywhere, like it says in the datasheet
     
  4. bertus

    bertus Moderator

    1,158
    439
    Nov 8, 2019
    Hello,

    This is given in the datasheet:

    H - High-Terminal Potentiometer. This is the high terminal of the potentiometer.
    It is not required that this terminal be connected to a potential greater than the L-terminal. Voltage applied to the H-terminal cannot exceed the power-supply voltage, VCC, or go below ground.
    L - Low-Terminal Potentiometer. This is the low terminal of the potentiometer.
    It is not required that this terminal be connected to a potential less than the H-terminal. Voltage applied to the L-terminal cannot exceed the power-supply voltage, VCC, or go below ground.

    There must be a connection to them.
    If they are not connected the W (wiper) will float.

    Bertus
     
  5. Balos69626

    Balos69626

    4
    0
    Nov 11, 2020
    I connected H and L to + and ground
     
  6. Balos69626

    Balos69626

    4
    0
    Nov 11, 2020
    Now I'm still not sure why I can't control the resistance
     
  7. bertus

    bertus Moderator

    1,158
    439
    Nov 8, 2019
    Hello,

    With the H connected to the + and L to the ground, you should be able to read a voltage from 0 to 5 Volts on the W.
    Did you see this thread on the AAC forum:
    digital potentiometer

    Bertus
     
  8. Harald Kapp

    Harald Kapp Moderator Moderator

    10,591
    2,360
    Nov 17, 2011
    There is a library for Arduino to control the DS1804.

    How do you know you can't control resistance? How do you measure resistance?

    By the way: The resistance of a potentiometer is fixed, it can't be changed. What you change is the position of the wiper (on a mechanically operated potentiometer) or equivalently the resistance ratio between high-input (H) and wiper vs. low input (L) and wiper (W) on a digitally controlled potentiometer as exemplified in this diagram:

    upload_2020-11-12_11-37-57.png
    Note that the total resistance is 10 kΩ in each case. only the resistance ratio varies with the setting of the potetiometer. So in order to measure a correct setting of the potentiometer follow the advice given in post #7 by @bertus .
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-