Arduino Projects

Digital Potentiometer X9C103s Arduino Circuit and Programming

Digital Potentiometer X9C103s Arduino:

Digital Potentiometer X9C103s Arduino– In all of my previous projects I have been using Variable resistors or Potentiometers, the resistance of which had to be controlled by manually rotating the knob or using a screw driver. In this article, I am going to use another type of the potentiometer which is called a digital potentiometer, the resistance of which can be automatically controlled using a controller. For the best understanding I will use the digital potentiometer with the Arduino.

A digital type potentiometer is a variable resistor with three terminals and is used to change the resistance or voltage of a circuit. Potentiometer is frequently applied in a volume control for audio equipment’s.  The digital type potentiometer has the advantage of being able to automatically control when voltage adjustment is required during operation and as I said earlier this can be done using Arduino boards, electronic circuit, esp32, esp8266, etc. The digital Potentiometer I am going to use is the X9C103s.


Amazon Links:

Arduino Nano USB-C Type (Recommended)

Digital Potentiometer X9C103S

Other Tools and Components:

ESP32 WiFi + Bluetooth Module (Recommended)

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

digital potentiometer x9c103s

Types of Variable Resistors:

Now let’s take a look at several types of variable resistors.

Potentiometer:

First discuss the potentiometer as mentioned in the introduction is a device with three terminals it is mainly used to change the voltage in a circuit, the symbol of the potentiometer is as follows.

digital potentiometer x9c103s

You can change the resistance value by adjusting the position of theVW port between VH and VL which is also called wiper position and as a result, the value of the voltage divided can be changed.

There are rotary types of potentiometer in which you can turn the knob to adjust the resistance.




Rheostat:

Rheostat has two terminals and is generally used in applications requiring high voltage or current between both terminals.

digital potentiometer x9c103s

X9C103S Digital Potentiometer Module:

So let’s take a look at the digital potentiometer X9C103S, this device is manufactured by several companies.

digital potentiometer x9c103s

X9C103S Key Specification:

  • The full range is 10-kilo ohms in other words the resistance between VH and VL terminals is 10-kilo ohm
  • The wiper has 100 tap points which means that you can adjust the resistance value between 0 and 10-kilo ohms with 100 steps, therefore the resolution of each tap point will be 100 ohms.
  • It also provides a storage function for storing a resistance value which can be restored after the power is turned off and on
  • The supply voltage must be provided in the range of 5 volts ±10% and the current consumption is very small up to 3 milliamperes during active state and 750 microamperes in the standby state.
  • Note that if you look at the back of the module the supply voltage range is indicated 3 to 5 volts as shown in the picture below which is different from the datasheet

digital potentiometer x9c103s

It actually worked with 3.3 volt supply but i recommend supplying 5 volts as specified in the datasheet. It provides three control signals for changing the wiper position and to store them in the storage also make sure that the current flowing through the wiper pin does not exceed 4 milliamperes. The control cycle of the wiper tap must be at least 2 microseconds. You should not be controlling the wiper tap with a faster rate.


Internal Structure of the X9C103S Digital Potentiometer:

let’s take a closer look at the internal structure, there are up-down counters controlled by UD, INC, and CS pins and there is a decoder that asserts one of 100 taps using the counter value.

digital potentiometer x9c103s

There are gates and resistor arrays that perform the resistance change function using signals provided by the decoder, as you can see from this structure. Their resistance value between RH and RL is always 10-kilo ohms. Now, for example, let’s assume that tap 96 is enabled when the gate of tap 96 is enabled. The path from RH to RW is formed as a blue path and the paths of RL and RW are formed as a yellow line, as a result, the resistance changes while the sum of the resistance between RL and RW and the resistance between RH and RW maintains 10-kilo ohms.

digital potentiometer x9c103s

Then let’s see how we can control the three signals mentioned earlier, this is a mode selection table from the datasheet.

digital potentiometer x9c103s

First for moving the wiper in the upper direction the INC pin should be toggled low while CS and UD is low and high respectively that is the wiper position moves at the falling edge of INC pin, moving the wiper position in the upper direction means incrementing the counter resulting in RH to RW decrease and RL to RW increase.
Second, for moving the wiper in the lower direction the INC pin should be toggled low while CS and UD are both being held low lowering the wiper results in an increment of RH to RW and decrement of RL to RW.
Finally, when CS rises high while INC is high the current wiper position at the rising edge of CS is stored as non-volatile memory. This stored wiper value is very useful because it is retained even when the power is turned off and on.


Interfacing the digital potentiometer with the Arduino:

Now, to interface the digital potentiometer X9C103S with the Arduino, we will require the following components:

Components Required:

  • Arduino Nano Or Arduino Uno
  • Resistor
  • Push-button
  • Digital potentiometer X9C103S
  • LED

digital potentiometer x9c103s

Connecting the Arduino nano with the digital potentiometer:

  • Connect the digital pin number 10 of the Arduino nano with the INC pin of the X9C103S
  • Connect the digital pin number 9 of the Arduino nano with the UD pin of the X9C103S
  • Connect the digital pin number 8 of the Arduino nano with the up push button
  • Connect the digital pin number 7 of the Arduino nano with the down push button
  • Connect the CS of the X9C103 with the CS push button
  • Connect the VCC of the X9C103 with the 5V of the Arduino
  • Connect the VSS of the X9C103 with the ground of the Arduino
  • Connect the INC and UD of the X9C103S with the white and green led respectively
  • Connect the RL and RW with the multimeter to see the resistance.

Operation of the digital Potentiometer X9C103S:

Let’s check the actual operation in conjunction with Arduino, each push buttons are for controlling the X9C103 from Arduino nano, pressing the up button causes the INC pin to toggle while UD pin is held high resulting in the wiper position to be raised. When the down button is pressed the INC pin is toggled while UD pin is held low so that the wiper position goes down CS is kept low for control of the wiper and when the CS button is pressed the signal transitions to a high value which stores the current position in the storage.


Digital Potentiometer X9C103S Arduino Code:

Output of the digital potentiometer with arduino:

After uploading the code to the Arduino nano we will see the output of the digital potentiometer X9C103S. Now let’s look at the demo in the configuration, for the demonstration the internal pull-up of arduino nano was used to simplify the wiring, in addition white led and green led were used to visually check the state of INC pin and UD pin respectively. Three push buttons are for wiper up, wiper down, and cs starting from left to right.
Let’s turn on the multimeter and power up the Arduino. When you initially turn on the X9C103S module the counter value is 0 which is approximately 200 ohms between RL and RW but the starting point here is 300 ohms. Let’s press the up button when you press the up button the white led connected to the INC pin blinks and the green led connected to the UD pin turns off that is it goes high raising the wiper position in the upper direction. You can see that the resistance between RL and RW is increasing if you keep pressing it it will increase to 10 kilo ohms and no more the wiper position has risen to 99 and it is saturated.

digital potentiometer x9c103s

Now let’s press the down button when the down button is pressed white lead blinks while the green led turns on indicating a wiper down and as a result, the resistance between RL and RW is decreased here we stopped at 5.2-kilo ohms.

digital potentiometer x9c103s



Let’s press CS button to store the current position after turning the power off and on let’s see if the saved resistance value is successfully loaded when the power is turned on it becomes 5.3-kilo ohms. One thing to note is the loaded value is always one step higher than the value actually stored. In other words, the loaded resistance value between RL and RW is 100 ohms higher than the value when the store actually happened.

digital potentiometer x9c103s

Let’s go down more and then power off and on to see if the stored value is recovered without pressing the CS button. The last stored value of 5.3 kilo ohms is recovered press the down button again and stop at 1.6 kilo ohms then press the CS button to save it to the storage and turn the power off.

digital potentiometer x9c103s

And once again what value will be read it will be 1.7-kilo ohms is loaded which is 100 ohms higher than 1.6-kilo ohms as expected.

digital potentiometer x9c103s

 

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

2 Comments

  1. Hi, very nice article. I’m looking for a digital way to replace a stereo logarithmic analog potentiometer of 250Kohm between rl and rh. Then maximum resistance of the chip used in your projet it’s just 10k. Do you think are there some other IC that can fits my needs in order of maximum ohm value?

Leave a Reply

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

Back to top button