Final Project - Working with AD5206 digital pots
Today I finished wiring the first of two prototype boards, and started testing code to work with the AD5206 digital potentiometer. This is a chip that takes serial input on two wires, and uses it to set a variable voltage on up to 6 output pins. You can chain them together, using an additional line to select the chip you want to address.
I am using two of these in each lamp. This lets me control 12 variable outputs using only 4 lines on the Arduino (clock, serial data, select chip 1, select chip 2).
Fortunately, Heather (another ITP student) has written a tutorial on working with the AD5206. Very helpful.
Here are the AD5206s in all their glory:
Read past the link for some weirdness and lessons learned...
I was able to run her example directly, and easily extend it to more than one AD5206. However, when I started writing code to handle multicolor LEDs, I experienced some odd problems. To achieve different color combinations, you have to provide voltage on several pots at once (something that Heather's example does not do).
The multicolor LEDs are connected to the AD5206 using the following scheme. Note that the pots are actually numbered 0-5 when programming, not 1-6. This caused a minor headache.
When I first tested this scheme, something strange happened: applying maximum voltage to the lines controlling the red element on the LEDs would turn off the blue and green element. Slightly reducing the voltage to the red element would allow it to light together with the blue & green.
I suspect that maybe the red element draws more current than the blue or green channel of the LED and that setting it to max power overrides the other digital pots.
I will try with a higher current external supply, and see what happens.
I also learned something about SPI (Serial Peripheral Interface), the protocol used to communicate between the Arduino and the AD5206. Basically, the AD5206 is enabled for writing by pulling the CS pin low. When the CS pin is set high again, the AD5206 acts on the command received. I thought that you could bring CS low, write a series of commands, and then all the commands would be executed when CS went high. In fact, you need to do the CS low, write, CS high cycle for every single command.
Finally, a brief note on the prototype board layout:
Basically, the long board to the lower left is the lamp controller as it will go into the project. The topmost board will be replaced by the physical structure of the lamp.
The little board to the right is interesting, it is the "programming module". The Arduino Mini, which I am using, does not have a built-in USB port, or a reset button. So I have placed those components on a small breadboard, which will allow me to move it from lamp to lamp for programming.


