Go Down

Topic: Full-colour RGB 4x4 button pad (monome-esque) (Read 7 times) previous topic - next topic


Mar 02, 2008, 08:45 am Last Edit: Mar 02, 2008, 08:47 am by big93 Reason: 1
ok, i have an idea, and i'm sure it'll work.

if you can... tell me what pins on the arduino, are connected to the other side, becuase the picture confuses me, especially the connection the the digital pots.

so if you could tell me where every used pin on the arduino goes to (ex pin 12 arduino to pin 5 digital pot )
i'm sure my project could work, becuase i am certain that the wrong pins are in the wrong place, and that has to be the problem!

thanks in advance, and if u need any links, just tell me...


here is the link to the digital pot page where it shows the pins, so you can identify it easier...


big93, all of the connections are defined in the code, in the defines and variables at the top. It may be different in different examples I have posted, so look at the code you're using and either use those pins, or change the defines to meet your needs. I long ago disassembled my version of the project, so this code is all I have to go on myself.

Here are the relevant lines from the "color fading" example, and an explanation of what they're saying. The first three must not be changed, since they're hardware features of the SPI, and make sure you're using Arduino pin 10 as an OUTPUT only, otherwise it will mess up the hardware SPI, too. Other than that, they can all be changed.

The data connections for the digital pot (can't be changed):
Code: [Select]
#define DATAOUT 11//MOSI (pin 7 of AD5206)
#define DATAIN 12//MISO - not used, but part of builtin SPI
#define SPICLOCK  13//sck (pin 8 of AD5206)

The LED "row" select, and the two slave select lines for the digital pot. Also, the defined function "slavesel" chooses which digital pot to send the data based on the pot register numbers.
Code: [Select]
#define slavesel(x) ((x<6) ? 0 : 1)
const byte rowpin[ROWS] = {
const byte slaveselect[2] = {
 10, 18};

The pins for writing to and reading from the buttons.
Code: [Select]
const byte buttonRead[4] = {
 5, 2, 3, 4}; //Pins for the Vin of the buttons
const byte buttonWrite[4] = {
 6, 7, 8, 9}; //Pins for reading the state of the buttons

All of the above refer to Arduino pins. Pins 14, 15, 16, and 17 are analog pins 0, 1, 2, and 3, respectively.

The following code does not refer to Arduino pins, it refers to which digital pot registers to which the various color lines are connected. The "slavesel" function below is used to choose which chip the number refers to (the first chip if the number is 0-5, and the second if it is 6-11), and a modulo function (% sign) is used to shift the numbers higher than 5 down to make sense when talking to the chip.

Code: [Select]
// The pot register numbers for each of the red, green, and blue channels
const byte red[4] = {
 8, 7, 2, 5};
const byte green[4] = {
 10, 6, 0 , 3};
const byte blue[4] = {
 11, 9, 4, 1};

I can't emphasize this enough, those are not Arduino pins. If you happened to use them that way, then that could definitely be the source of your problems!


ok that makes more sense now... So I just need to know that all pins can be rearanged except for arduino pin 10. but the code will definitly help, now I can get the pins in the right place.

But to be honest, you have soon much code, you should just go a little extra way, and make a library out of it with the simple ability to bring up any button and give 3 colors to blend ( r g b ). But since you discontinued this, I guess it won't matter...

Thanks for the help, and I'll message back as soon as I have results( hopefully good results)

P.S I bought those same transistors to replicate your project as close as I can to hopefully make it work.


ok, so as far as i see, it seems that everything is hooked up fine.
now i tried messing with the wiring, and after simply connecting one led gnd to the middle transistor pin, it changes colors sometimes, but not smothly. its verry sudden, be aware, that buttons are not hooked up yet becuase i just wanted to see if the lights pwm like they are sapposed to... obviously they arent... wires are all correct, and i even tried a "debug" led thats connected right from the digital pot resistor to gnd, and its not changing smoothley.... very sudden, i can't put my finger on whats wrong, as of now, everything seems to be hooked up perfectly.

i might just scrap the way it's put together, and try to put it together on my own, becuase maybe itll make more sense...

but before i do that, i have to understand how you tell the second digital pot chip what to do...

i'm confused how you communicate between the second digital pot, and how you "switch between them"

so heres what i think you do, and please correct me if i'm wrong, so i don't mess up the chips...

i think you turn the master slave chip for one on, and the other off by either setting it to high ( on ) or low ( off ). And then you just comunicate like your talking to one chip becuase the clock and data pins are connected. is this correct?
And as for the transistors... are they REALLY REALLY neccasery, i think theyre just dead weight, unless they really help becuase i think a resistor might just slow enough current, before it entars the arduino, and the transistors just confuse me becuase i think they might be the source of my failure... if they savge the arduino, ill keep them ,but if theyre a "just in case" i might have to leave em out...


ok that makes more sense now... So I just need to know that all pins can be rearanged except for arduino pin 10.

No, you can't rearrange pins 11, 12, or 13, either.

You are correct about how to communicate between the two pots.

I think you can probably get away without using the transistors; I used them just to be safe (and also, to make sure I knew what I was doing with the transistors!). Even if you've got all of the LEDs on at their full capability (20mA/color channel), that's still only 240mA at any one time, which I believe the Arduino can handle. To be extra safe, make sure that all twelve of the lines from the digital pot have a reasonably sized resistor on them to limit the current from each (the definition of "reasonable" is left as an exercise); it'll make the output dimmer, but you can always swap them out later for something with lower resistance.So, yes, I think you can get rid of them. Just don't expect me to buy you a new Arduino if it doesn't work!  ;) Also, you'll need to change the code a little bit: every time you see a digitalWrite to rowpin[r], change LOW to HIGH, and HIGH to LOW. I believe there will be three changes total.

Good luck!

Go Up