Clock & Timer Circuit Diagrams

Learn To Use Digital Potentiometers Schematic Circuits Diagram

Digital Potentiometers: In the realm of electrical components, a resistor serves the purpose of hindering the flow of electrical current. In our modern digital era, we come across a range of “digital resistors” tailored for diverse everyday applications. This article delves into the world of digital potentiometers. Commonly known as digital pots, digital potentiometers are variable resistors manipulated by digital signals, diverging from the traditional mechanical adjustment.

In essence, a digital potentiometer comprises a resistor ladder equipped with electronic switches at each of its steps. Only one electronic switch is active at a time, and this closed switch determines both the wiper position and the resistance ratio. The number of steps in the ladder dictates the resolution of the digital potentiometer.

Learn To Play With Little Wire Schematic Circuit Diagram 1.

Digital potentiometers are integrated circuits with the initial position of the wiper at the midscale. However, some variants have an on-board (non-volatile) memory that remembers the last wiper position. Something to take into account when you start working with digital potentiometers is the fact that most of them are rated at 5 Vdc, and 10 KΩ is the most popular value.

Learn To Play With Little Wire Schematic Circuit Diagram 2

The MCP41010

MPC41010 is a tiny digital potentiometer from Microchip with a maximum resistance value of 10 KΩ (minimum value 100 Ω). The MCP41010 is a single-channel, 256-position digital potentiometer available in an 8-pin PDIP or SOIC package.

Learn To Play With Little Wire Schematic Circuit Diagram 3

Now to the pin description of MCP41010:

  • PA0: Potentiometer Terminal A
  • PB0: Potentiometer Terminal B
  • PW0: Potentiometer Wiper
  • CS: Chip Select (SPI port chip select pin used to execute a new command after it has been loaded into the shift register)
  • SCK: Serial Clock (SPI port clock pin used to clock in new register data)
  • SI: Serial Data Input (SPI port serial data input pin. The command and data bytes are clocked into the shift register using this pin)
  • VDD &VSS: Power supply terminals (2.7 V–5.5 V)

MCP41010 & Arduino Test

As you may have noticed, a digital potentiometer behaves the same as a mechanical potentiometer, except that instead of having a round handle that you can turn, it’s controlled by a digital interface. As a basic test, you can drive MCP41010 with the help of an Arduino UNO and its Serial Peripheral Interface (SPI) port. Note that SPI is a “synchronous” serial data bus — data can travel in both directions at the same time. On Arduino Uno (and compatible) boards, the SPI pins used are:

  • SS – D10 (you can use other digital pins, but D10 is the default)
  • MOSI – D11
  • MISO – D12
  • SCK – D13

Just refer to the datasheet and note that to program the digital pot, you have to first send a “command byte” (to tell the chip what to do) and a “data byte” (to tell the chip which value of resistance to set, from 0 to 255). As found in the datasheet, “executing any command is accomplished by setting CS low and then clocking in a command byte followed by a data byte into the 16-bit shift register. The command is executed when CS is raised.” Now prepare your hardware setup as follows!

Learn To Play With Little Wire Schematic Circuit Diagram 4

In the hardware setup, MCP41010 is connected to the Arduino via the Arduino’s SPI Interface. Potentiometer terminals A (pin 5) and B (pin 7) are connected to the Arduino 5-volt supply (5 V) and Ground (Gnd). The wiper terminal W (pin 6) is connected to the Analog Pin 1 (A1) of the Arduino. The pretty simple sketch (shown below) loaded into the Arduino selects the MCP41010 and cycles through all 256 wiper positions (about 39 Ω per step). The voltage at the analog pin is then read and displayed on the serial monitor.

Sketch

#include
const int CS = 10;
int PotWiperVoltage = 1;
int RawVoltage = 0;
float Voltage = 0;
void setup() {
pinMode (CS, OUTPUT);
Serial.begin(9600);
SPI.begin(); // initialize SPI
}
void loop() {
// move the wiper in one direction
for (int level = 0; level < 255; level++) { MCP41010Write(level); delay(100); RawVoltage = analogRead(PotWiperVoltage); Voltage = (RawVoltage * 5.0 )/ 1024.0; Serial.print("Level = " ); Serial.print(level); Serial.print("\t Voltage = "); Serial.println(Voltage,3); } delay(2000); // wait time // move the wiper in other direction for (int level = 255; level > 0; level--)
{
MCP41010Write(level);
delay(100);
RawVoltage = analogRead(PotWiperVoltage);
Voltage = (RawVoltage * 5.0 )/ 1024.0;
Serial.print("Level = " );
Serial.print(level);
Serial.print("\t Voltage = ");
Serial.println(Voltage,3);
}
delay(2000);
}
void MCP41010Write(byte value)
{
digitalWrite(CS,LOW); // select the chip
SPI.transfer(B00010001); // command byte
SPI.transfer(value); // data byte
digitalWrite(CS,HIGH); // de-select the chip
}

Learn To Use Digital Potentiometers Schematic Circuits Diagram 5

Tags

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button
Close
Close