mdperry
Posts: 13
Joined: Mon Dec 31, 2012 10:18 pm

Digital POT Driving a LED with SPI

Sat Feb 23, 2013 6:04 pm

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

btidey
Posts: 1624
Joined: Sun Feb 17, 2013 6:51 pm

Re: Digital POT Driving a LED with SPI

Sat Feb 23, 2013 7:02 pm

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.

gridrun
Posts: 46
Joined: Mon Feb 18, 2013 12:26 pm
Contact: Website

Re: Digital POT Driving a LED with SPI

Mon Feb 25, 2013 6:58 pm

Interesting :)

I thought of using a digital Pot before, to control a cheap household dimmer for 230VAC lamps.
Find more info on Raspberry Pi, Virtualization and all things cloudy on my blog: http://niston.wordpress.com

mdperry
Posts: 13
Joined: Mon Dec 31, 2012 10:18 pm

Re: Digital POT Driving a LED with SPI

Tue Feb 26, 2013 1:56 am

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.

mdperry
Posts: 13
Joined: Mon Dec 31, 2012 10:18 pm

Re: Digital POT Driving a LED with SPI

Fri Mar 01, 2013 5:03 am

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

Return to “Interfacing (DSI, CSI, I2C, etc.)”