how to make digital potentiometer as mechanical potentiometor using arduino?

 connection between digital pot x9c103p
 INC - Arduino pin
* U/D - Arduino pin 3
* VH  - 5V
*VSS - GND
*  VW  - Output: 150 Ohm resistor -> LED -> GND
*  VL  - GND
*  CS  - Arduino pin 4
*  VCC - 5V

and the code i used
#include <DigiPotX9Cxxx.h>

DigiPot pot(2,3,4);

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println("Starting"); 

  for (int i=0; i<100; i++) {
    Serial.print("Increasing, i = ");
    Serial.println(i, DEC);
    pot.increase(1);
    delay(200);
  }

  for (int i=0; i<100; i++) {
    Serial.print("Decreasing, i = ");
    Serial.println(i, DEC);
    pot.decrease(1);
    delay(200);
  }

}

what is error in that and how can i make sthing varry between 1k to 4k if i have digital potentiometer 10k


sort by: active | newest | oldest
These things won't drive LEDs ! The maximum current is only permitted to be 8mA. On a 5V supply, you may have burned out the "track"
+1
Use an Op-Amp
see the NON INVERTING AMP on pp8
britich (author) 4 years ago
ok can i ask you other question:

when i use potentiometer and apply wave like sawototh bot has zero at negative cycle and connect the two other pins together and measure output , it give me pwm signal
vary with pot , how can i generate sth like that arduino, you will ask me why i need that, i need that because i have rc helicopter have this connection and i wanna make same connection using arduino , i tried to give it true analog voltage and im trying digital potentiometer now
iceng4 years ago
I don't think you can use an ohmeter to read the resistance.

You will have to measure the wiper voltage instead.
  • Ground pin_3 to pin_4 and apply 5v to pin_6
  • Run the count up at least 99 pulses
  • Now pulse down 40 steps
  • you should measure 3v on pin_5 the Wiper.
  • Which is  5V-4K-Wiper-6K-Ground
you don't even name the pot you have used. how can we guess?

what does it not do?
britich (author)  steveastrouk4 years ago
x9c103p