Controlling DS1803 digital potentiometer via arduino I2C protocol in Matlab
Show older comments
Greetings!
I feel like I am one step away from being able to control this digital potentiometer using matlab but I seem to be missing some key component.
Here is a link to the datasheet for the device I am trying to use: https://datasheets.maximintegrated.com/en/ds/DS1803.pdf
I was able to run a package in arduino successfully that I found here: https://github.com/federico-galli/Arduino-dual-i2c-potentiometer-DS1803
I grounded all of the address inputs (A0,A1,A2) which gives me the correct (i think) address, 46.
Below is the code I am using in matlab.
clear all
a = arduino('COM3', 'Uno', 'Libraries', 'I2C');
addrs = scanI2CBus(a);
%this gives an address of 0x28
DS1803 = i2cdev(a, addrs{1});
write(DS1803, uint8(bin2dec('101010101')));
write(DS1803,250,'uint8')
Here how I have wired up the DS1803:

Again, I was able to get the LED to turn on with the arduino program. The matlab program seems to be much simpler and I am feeling like I am missing something.
When I execute the last line, the LED does not turn on. I see the indicator LEDs on the arduino flicker when sending the command though.
Any input would be really appreciated. I'll keep messing around with it in the meantime.
Thank you!
Accepted Answer
More Answers (0)
Categories
Find more on Arduino Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!