Contents

Interfacing X9C104 100K Digital Potentiometer Module with Arduino

X9C104 100K Digital Potentiometer Module Features

The X9C104 digital potentiometer module is a variable resistor whose resistance value can be set digitally by a microcontroller. It consists of  3 output pins (RH، RW و RL) which can replace a mechanical potentiometer which has 3 pins. This module has 99 resistance components and its resistor is controlled by a 3-wire interface.

X9C104 100K Digital Potentiometer Module Pinout

This sensor has 10 pins:

5 pins on the left side:

  • VCC: Module power supply – 5V
  • GND: Ground
  • INC: Changing resistor command
  • U/D: UP / Down. Adjusting resistor
  • CS: Chip Select. Active LOW

5 pins on the right side:

  • VCC: Module power supply – 5V
  • RH: Resistor High
  • RW: Regulated Resistor
  • RL: Resistor Low
  • GND: Ground
Note

The 3 RH, RW and RL pins can replace a mechanical potentiometer which has 3 pins

You can see the pinout of this module here.

Required Material

Hardware component

Arduino UNO R3R3 × 1
X9C104 100K Digital Potentiometer Module × 1
Male to Female Jumper wire × 1

Software Apps

Arduino IDE

Interfacing X9C104 100K Digital Potentiometer Module with Arduino

Step 1: Circuit

The following circuit shows how you should connect Arduino to X9C104 module. Connect wires accordingly.

Step 2: Installing Library

Download the DigiPotX9Cxxx library here. Then go to the Include Library and install the library.

Note

If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library

Step 3: Code

Upload the following code to Arduino. After that open the Serial Plotter.

  /*  
Modified on Dec 12, 2020
Modified by MehranMaleki from Arduino Examples
Home
*/ /* * For this example, connect your X9C104 (or the like) as follows: * 1 - INC - Arduino pin 2 * 2 - U/D - Arduino pin 3 * 3 - RH - 5V * 4 - VSS - GND * 5 - RW - Output: Arduino pin A0 for analogRead * 6 - RL - GND * 7 - CS - Arduino pin 4 * 8 - VCC - 5V */ #include <DigiPotX9Cxxx.h> DigiPot pot(2,3,4); void setup() { Serial.begin(9600); } void loop() { Serial.println("Starting"); float voltage; for (int i=0; i<100; i++) { pot.increase(1); voltage = 5.0 * analogRead(A0) / 1024; Serial.println(voltage); delay(20); } for (int i=0; i<100; i++) { pot.decrease(1); voltage = 5.0 * analogRead(A0) / 1024; Serial.println(voltage); delay(20); } }

In this code, the Arduino pins 2, 3 and 4 are connected to the INC, U/D and CS, respectively. Then, at first the variable output voltage goes up and then goes down. The output value is read by Arduino pin A0 and displayed in the Serial Plotter.

The output is as follows.

Liked What You See?​
Get Updates And Learn From The Best​

Comments (14)

  • Etienne Reply

    Thanks for this very good tutorial.
    Worked perfectly.

    May 14, 2021 at 7:16 pm
    • Mehran Maleki Reply

      You’re quite welcome. We always try to do our best.

      May 17, 2021 at 4:51 am
  • dave Reply

    Thanks for the nice info.

    Your pinout says “VCC: Module power supply – 5V”.
    This should be Vcc is +ve ?

    June 8, 2021 at 11:21 am
    • Mehran Maleki Reply

      Hi,
      There can actually be different symbols representing the positive end of the power supply. And among them VCC and +ve are the most popular ones. So, they can be used alternatively.

      June 9, 2021 at 7:11 am
  • Michael Reply

    Please help me if you can. I need to use the x9c to regulate either power on, or power completely off. I understood the RH HIGH is complete resistance (no power) and RH LOW is very little resistance (nearly full power). Did I get that right?

    June 24, 2022 at 5:24 am
    • Mehran Maleki Reply

      Hi. You’re absolutely correct.

      July 10, 2022 at 11:31 am
  • Pavel Reply

    Hello, I have a question regarding stepping of the resistance. If I pulse up from 0 up to more than 100 steps, will the resistance “roll over” zero, or will it ramp and stay on the maximum?
    Thank you in advance for info.

    January 9, 2023 at 10:26 pm
    • Ali Abdolmaleki Reply

      Hi
      it goes to zero when touch the maximum level

      February 28, 2023 at 2:31 pm
  • ajinkya_udamale Reply

    Hi,

    thanks for this detail explaination of useing thise moduel, we really get more information from your effort.

    can you please tell me, can i replace this with mechanical potentiometer of dc to dc boost converter 1200 watt (check product link).

    https://www.electronicscomp.com/1200w-dc-dc-boost-step-up-converter-8-60v-to-12-83v-20a?gclid=Cj0KCQjwyLGjBhDKARIsAFRNgW-BdkgFSU458Sl1GWV5YWH3Vno21pJQ5Yo3iycCH9Sk6af2-uOw2hkaAqEQEALw_wcB

    there are 3 potentiometer in this module
    1) 1st to control load in voltage which is around 8volt to 60 volt
    2) 2nd to control Current which is around 20amp
    3) 3rd to control load out voltage which is around 12volt to 100 volt.

    i did not able to figure out that this module can regulate 100 volt or not, because in the product description 5volt mention. but same mechanical potentiometer 100k ohm can regulate 100 volt which is already used in boost converter module.

    May 24, 2023 at 6:19 am
    • Mohammad Damirchi Reply

      Hi ajinkya,
      According to the datasheet, the maximum input voltage of this module is positive and negative 5 volts. Therefore, you cannot use it for your case.

      May 27, 2023 at 7:34 am
  • ajinkya_udamale Reply

    thanks for your replay,

    but does it possible if i add resistor 22k for 100 volt load to this module

    May 27, 2023 at 12:37 pm
  • Seymour Reply

    Which pins can I connect an OHM meter so that I can observe the INCREASE/DECREASE in resistance as INC is pulsed?

    January 16, 2024 at 2:03 pm
    • Mohammad Damirchi Reply

      Hello Seymour,

      You can read the value between RL and RW, but it might not work as you intend.
      In this case, you should set a voltage between RH, RL and use a voltmeter between RL and RW to observe the changing value.

      January 17, 2024 at 7:33 am
  • SEYMOUR MYRON FOOS Reply

    Many thanks!

    January 17, 2024 at 4:38 pm

Leave a Reply

Your email address will not be published. Required fields are marked *