This article discusses how to control a digital potentiometer using an Arduino, as well as what areas of application this device can have. Let's use a ready-made module that costs less than $ 1.
Necessary
- - Digital potentiometer X9C;
- - Arduino;
- - a computer with the Arduino IDE development environment;
- - prototype board and assembly wires.
Instructions
Step 1
A potentiometer, or variable resistor, is an electrical device that allows you to change the resistance of an electric current. A classic (mechanical) potentiometer consists of two contacts, between which there is a third - movable. By moving the movable contact, we change the resistance between it and each of the fixed contacts.
An electronic potentiometer is an analogue of a mechanical potentiometer, but with a number of advantages: it has no mechanical parts, it can be controlled remotely using, for example, a microcontroller, and it is significantly smaller in size.
Step 2
The digital potentiometer type X9C can be one of the following ratings: X9C102 = 1kΩ, X9C103 = 10kΩ, X9C104 = 100kΩ. These values are the maximum possible resistances for the resistor. Between 0 and the maximum value in steps of 1/100 of the maximum, you can adjust the resistance on the third "moving" contact.
The position of the "moving" contact is controlled by a series of negative pulses. Each impulse shifts the resistance value by 1 step in the direction of increasing or decreasing. The increase or decrease in resistance is regulated by a special microcircuit foot.
Step 3
Let's put together the circuit as shown in the picture. We need power supply and 3 control wires: CS - device selection (low level), INC - output resistance change (low level pulses), U / D - direction of change (U - up - the voltage on the microcircuit leg has a high logic level, D - down - low level).
Step 4
Now let's write such a sketch and load it into the memory of the Arduino board.
This sketch contains the following algorithm: increase the resistance every 100 ms in 10% steps from 0 to 100% of the potentiometer maximum.
Step 5
If now, with the help of a multimeter, we check the resistance between the center and one of the final conclusions, then we will fix the changes in resistance.
I will apply 5 volts to the potentiometer and measure the voltage with an oscilloscope. The photo illustrates the result.