Page 1 of 1

Digital POT Driving a LED with SPI

Posted: Sat Feb 23, 2013 6:04 pm
by mdperry
I am setting up a test project where I am using a digital potentiometer to change the intensity of a LED light. I am new to electronics for the most part so was looking for a little direction. I have spent a fair amount of time reading the datasheet for my chip and searching the message board and think I have the wiring right but wanted to see if any one could confirm if this is correct (my apologies for the crude diagram but it was the best I could do).

Image
Full size image: http://www.kymark.com/spiled.jpg

Here is the link to the datasheet for the digital pot chip I am using (it is the 8 pin one).
http://ww1.microchip.com/downloads/en/d ... 11195c.pdf

Re: Digital POT Driving a LED with SPI

Posted: Sat Feb 23, 2013 7:02 pm
by btidey
I think the basic logic of the wiring is OK, but when I look at the data sheet the maximum wiper current is supposed to be 1mA which means driving the LED directly is going to be very limited. You would need an analog buffer between the chip and the LED if you wanted to get a decent amount of LED current.

Re: Digital POT Driving a LED with SPI

Posted: Mon Feb 25, 2013 6:58 pm
by gridrun
Interesting :)

I thought of using a digital Pot before, to control a cheap household dimmer for 230VAC lamps.

Re: Digital POT Driving a LED with SPI

Posted: Tue Feb 26, 2013 1:56 am
by mdperry
I think the basic logic of the wiring is OK, but when I look at the data sheet the maximum wiper current is supposed to be 1mA which means driving the LED directly is going to be very limited. You would need an analog buffer between the chip and the LED if you wanted to get a decent amount of LED current.
I was thinking maybe I would try a different chip.... maybe one with an I2C interface since I will eventually need three different pots for my project and it seems from my reading that it is easier to add more I2C devices.
Interesting

I thought of using a digital Pot before, to control a cheap household dimmer for 230VAC lamps.

If I ever get it working, I'll post my code.

Re: Digital POT Driving a LED with SPI

Posted: Fri Mar 01, 2013 5:03 am
by mdperry
I got it working in FPC/Lazarus using the wiringPi library. Below is my sample code. I also had to run a wire between the MISO and the MOSI pins on my Pi to get it to work.

New diagram:
http://www.kymark.com/spiled2.jpg

Code is available here:
http://www.kymark.com/spitest.tar.gz