Hi, i tried use digital potenciometer MCP41100 code from: http://www.instructables.com/id/Digital-Potentiometer-MCP41100-and-Arduino/
/*
this program taken from arduino Example .
modified by By Mohannad Rawashdeh
http://www.genotronex.com
https://www.instructables.com/
This code used to control the digital potentiometer
MCP41100 connected to arduino Board
CS >>> D10
SCLK >> D13
DI >>> D11
PA0 TO VCC
PBO TO GND
PW0 TO led with resistor 100ohm .
*/
#include <SPI.h>
byte address = 0x11;
int CS= 10;
int i=0;
void setup()
{
pinMode (CS, OUTPUT);
SPI.begin();
// adjust high and low resistance of potentiometer
// adjust Highest Resistance .
digitalPotWrite(0x00);
delay(1000);
// adjust wiper in the Mid point .
digitalPotWrite(0x80);
delay(1000);
// adjust Lowest Resistance .
digitalPotWrite(0xFF);
delay(1000);
}
void loop()
{
for (i = 0; i <= 255; i++)
{
digitalPotWrite(i);
delay(10);
}
delay(500);
for (i = 255; i >= 0; i--)
{
digitalPotWrite(i);
delay(10);
}
}
int digitalPotWrite(int value)
{
digitalWrite(CS, LOW);
SPI.transfer(address);
SPI.transfer(value);
digitalWrite(CS, HIGH);
}
The problem is in max resistance - I measured only about 63-83kOhm. I tested 3 pcs of this chip ...
For better measurements, we've modified the code so that we can measure min and max in 'loop' to:
void loop()
{
digitalPotWrite(255);
delay(2000);
digitalPotWrite(1);
delay(2000);
}
The result was exactly the same, measured around 83-63 ohms
I need to use a range of 0-100k ohm ...
I tested on board UNO and Nano V3, both with controller ATmega328P
I do not know what I'm doing wrong