New Zealand
Offline
God Member
Karma: 0
Posts: 999
Arduino pebbles
|
 |
« Reply #15 on: February 28, 2008, 07:05:35 am » |
From your description, I still don't really understand, maybe because I'm not into music. You have samples on each button, but what do the lights do? I can think of a couple of variations: With just a single colour LED you could use it to represent a drum loop, with a lit LED under a button indicating it was "active". Press the button to turn the "beat" on/off and the light would do the same. With a multi-colour LED you could have each colour represent a different drum sample for that beat and cycle through them with repeated button presses--with the current colour giving feedback on the current sample. The same approach could be used for cool/warm/hot control for a set of fans or something... --Phil.
|
|
|
|
|
Logged
|
|
|
|
|
Toronto
Offline
Jr. Member
Karma: 0
Posts: 70
|
 |
« Reply #16 on: February 28, 2008, 10:34:16 am » |
The point of the monome is that it is a really simple, versatile interface that can be made to do whatever you like. The buttons provide input, the lights provide feedback. Musicians like it for all sorts of reasons, but of course it can be used in countless applications: to be very cheesy, your imagination is the limit.
To be honest, I have no use for it in mind personally. It's just an interesting project to work on, that combines interesting hardware and software problems.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 2
Posts: 849
Arduino rocks!
|
 |
« Reply #17 on: February 28, 2008, 01:58:27 pm » |
To be honest, I have no use for it in mind personally. It's just an interesting project to work on, that combines interesting hardware and software problems. That's pretty much where I am. It looks like an amazing and versitile idea, especially the RGB clone. Yet I can't think of a thing to do with it.
|
|
|
|
|
Logged
|
|
|
|
|
Toronto
Offline
Jr. Member
Karma: 0
Posts: 70
|
 |
« Reply #18 on: February 28, 2008, 02:16:19 pm » |
That's pretty much where I am. It looks like an amazing and versitile idea, especially the RGB clone. Yet I can't think of a thing to do with it. Well, the PCBs for the revised RGB just arrived, so hopefully I'll come up with something soon.  I think the first thing I'll do is set up a monome-compatible device where it is monochrome, but the user can select the global color. That, and maybe a "monochrome" monome-compatible where the global color is constantly cycling, just because it'd look cool. After that, I need to start thinking of ways to use the color on a button-by-button basis.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #19 on: February 28, 2008, 08:49:22 pm » |
im still trying to set up your first version of the project, and i cant get it working, if you could look at the posts on the last page and help me figure out whats not good, i'd be very gratful  it's just that i have this huge buttons pad sitting on my desk, and it doesent seem to be working, and wires are running everywhere, and there bread boards to the waazoo, as soon as i get this running i can stick it in a nice case, and furthur program from there. the code you gave me is so far just making rows of the same color light up except for one row which isint lighting up, and 2 rows of which only work when i press a button, and the last row, is on, but when i disconnect the button ground, then the buttons freak out for bout a second, then they all turn on... wierd, if you could put up a schematic just for how you hooked up the buttons, i think i could get this working. thnks -big93
|
|
|
|
« Last Edit: February 28, 2008, 08:49:39 pm by big93 »
|
Logged
|
|
|
|
|
Toronto
Offline
Jr. Member
Karma: 0
Posts: 70
|
 |
« Reply #20 on: February 28, 2008, 10:39:33 pm » |
I don't have time to make a schematic right now, but the idea is this: each of the wires labelled "switch1" to "switch4" on the board is connected to a different Arduino pin, which are all configured as outputs. The wires labelled "swt-gnd1" to "swt-gnd4" are connected to different Arduino pins, each configured as inputs. These wires also have a pull-down resistor, meaning that there is a resistor of high-ish value (say, 10kOhms) that connects from the pin to ground, in addition to the wire coming from the board. Does that help? Otherwise, perhaps get in touch with me and send me pictures of your project and I'll see if I can see what's wrong with it.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #21 on: February 29, 2008, 03:26:36 pm » |
well what i did was resistors to the switch ground arduino pins, then connect the other side of the resistors to the actual switch grounds, and also connected another row of resistors to ground. Im intrested in knowing what the code on the first page is sapposed to make it do...becuase i want to know what to expect from the button pad if it works correctly.
Also, that one picture you took of the breadboard was pretty much how I put everything together, so for other intrested people, tell them that they can build the whole project by just looking at that picture and reading a bit of your info... It was a very well put together page... hope to hear from you soon -big93
|
|
|
|
|
Logged
|
|
|
|
|
Toronto
Offline
Jr. Member
Karma: 0
Posts: 70
|
 |
« Reply #22 on: February 29, 2008, 03:39:31 pm » |
I'm sorry, but I'm still not sure I understand what you mean by "connected another row of resistors to ground." Perhaps if you could PM me, maybe with a picture, I could help you further.
The code on the first page is really just a framework for making it do whatever you want it to. It contains a bunch of subroutines which you can fill to have it perform certain actions when certain events occur. I think the subroutines are fairly self-explanatory (i.e. on_press, while_pressed) Right now it does the following:
On startup, all the buttons are set to be blank.
When you press a button down it lights it up green and sends the coordinates of the pressed button (row, column) to the serial port. When the button is released it makes it blank again.
As I said, it's just a framework.
|
|
|
|
|
Logged
|
|
|
|
|
Toronto
Offline
Jr. Member
Karma: 0
Posts: 70
|
 |
« Reply #23 on: February 29, 2008, 03:43:01 pm » |
Here's the code for the color cycle demo (it just barely fits the character limit!) // Each button randomly cycles through colors. // When a button is pressed, all of the buttons change to that color and pause // The pressed button(s) is/are lit up white while pressed
#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) #define ROWS 4 #define COLS 4 #define H 254 #define L 64
#define slavesel(x) ((x<6) ? 0 : 1) const byte rowpin[ROWS] = { 14,15,16,17}; const byte slaveselect[2] = { 10, 18};
// The pot register numbers for each of the red, green, and blue channels const byte red[4] = { 5, 2, 7, 8}; const byte green[4] = { 3, 0, 6, 11}; const byte blue[4] = { 1, 4, 9, 10}; byte rGrid[ROWS][COLS] = { 0}; byte gGrid[ROWS][COLS] = { 0}; byte bGrid[ROWS][COLS] = { 0};
const byte buttonWrite[4] = { 2, 5, 3, 4}; //Pins for the Vin of the buttons const byte buttonRead[4] = { 6, 7, 9, 8}; //Pins for reading the state of the buttons boolean pressed[ROWS][COLS] = { 0};
byte trajectory[ROWS][COLS] = { 0}; unsigned long time; #define PAUSE 1000
// END DEFINITIONS, BEGIN PROGRAM
char spi_transfer(volatile char data) { SPDR = data; // Start the transmission while (!(SPSR & (1<<SPIF))) // Wait the end of the transmission { }; return SPDR; // return the received byte }
byte write_pot(byte address, byte value) { digitalWrite(slaveselect[slavesel(address)], LOW); //2 byte opcode spi_transfer(address % 6); spi_transfer(constrain(255-value,0,255)); digitalWrite(slaveselect[slavesel(address)], HIGH); //release chip, signal end transfer }
void setup(){ randomSeed(1);
byte i; byte clr; pinMode(DATAOUT, OUTPUT); pinMode(DATAIN, INPUT); pinMode(SPICLOCK,OUTPUT); pinMode(slaveselect[0],OUTPUT); pinMode(slaveselect[1],OUTPUT);
for(byte r = 0; r < ROWS; ++r){ pinMode(rowpin[r], OUTPUT); // Initialize rows digitalWrite(rowpin[r], LOW); // Turn all rows off }
digitalWrite(slaveselect[0],HIGH); //disable device digitalWrite(slaveselect[1],HIGH); // SPCR = 01010000 //interrupt disabled,spi enabled,msb 1st,master,clk low when idle, //sample on leading edge of clk,system clock/4 (fastest) SPCR = (1<<SPE)|(1<<MSTR); clr=SPSR; clr=SPDR; delay(10); // clear all of the pot registers for (i=0;i<12;i++) { write_pot(i,0); }
//setup the button inputs and outputs for(int i = 0; i < ROWS; ++i){ // ???? Is ROWS the right quanitity here? pinMode(buttonWrite[i], OUTPUT); digitalWrite(buttonWrite[i],LOW); pinMode(buttonRead[i], INPUT); }
grid_init();
delay(10);
time = millis(); }
void loop(){ always();
for(byte r = 0; r < 4; ++r){ digitalWrite(buttonWrite[r], HIGH); for(byte c = 0; c < COLS; ++c){
if(pressed[r][c] != digitalRead(buttonRead[c])){ pressed[r][c] = digitalRead(buttonRead[c]); if(pressed[r][c]){ on_press(r, c); } else { on_release(r, c); } } else { if(pressed[r][c]){ while_pressed(r, c); } else { while_released(r,c); }
} write_pot(red[c],rGrid[c][r]); write_pot(green[c],gGrid[c][r]); write_pot(blue[c],bGrid[c][r]); } digitalWrite(buttonWrite[r], LOW);
digitalWrite(rowpin[r], HIGH); //turn one row on delayMicroseconds(750); // display digitalWrite(rowpin[r], LOW); //turn the row back off } }
void grid_init(){ grid_rand(); }
void grid_rand(){ //initialize the button grids with random data for(byte x = 0; x < ROWS; ++x){ for(byte y = 0; y < COLS; ++y){ rGrid[x][y] = random(0,256); gGrid[x][y] = random(0,256); bGrid[x][y] = random(0,256); trajectory[x][y] = random(1,8); } } }
void grid_blank(){ //initialize the button grids with random data for(byte x = 0; x < ROWS; ++x){ for(byte y = 0; y < COLS; ++y){ rGrid[x][y] = 0; gGrid[x][y] = 0; bGrid[x][y] = 0; trajectory[x][y] = random(1,8); } } }
void always(){ if((long)millis() - (long)time > 10){ time = millis(); for(byte x = 0; x < ROWS; ++x){ for(byte y = 0; y < COLS; ++y){ rGrid[x][y] = constrain(rGrid[x][y] + ((trajectory[x][y] & B001 ) ? 1 : -1),L, H); gGrid[x][y] = constrain(gGrid[x][y] + ((trajectory[x][y] & B010 ) ? 1 : -1),L, H); bGrid[x][y] = constrain(bGrid[x][y] + ((trajectory[x][y] & B100 ) ? 1 : -1),L, H); if (rGrid[x][y] == ( (trajectory[x][y] & B001) ? H : L ) && gGrid[x][y] == ( (trajectory[x][y] & B010) ? H : L ) && bGrid[x][y] == ( (trajectory[x][y] & B100) ? H : L ) ) { trajectory[x][y] = random(1,8); } } } } }
void on_press(byte r, byte c){ for(byte x = 0; x < ROWS; ++x){ for(byte y = 0; y < COLS; ++y){ rGrid[x][y] = rGrid[r][c]; bGrid[x][y] = bGrid[r][c]; gGrid[x][y] = gGrid[r][c]; } } }
void on_release(byte r, byte c){ rGrid[r][c] = rGrid[(r+1) % ROWS][(c+1) % COLS]; gGrid[r][c] = gGrid[(r+1) % ROWS][(c+1) % COLS]; bGrid[r][c] = bGrid[(r+1) % ROWS][(c+1) % COLS]; }
void while_pressed(byte r, byte c){ time = millis() + PAUSE; rGrid[r][c] = 255; gGrid[r][c] = 255; bGrid[r][c] = 255; }
void while_released(byte r, byte c){
}
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #24 on: February 29, 2008, 05:36:50 pm » |
lol nice code, i looked through it a bit, and it's very nice!
sadly, i don't think i could explain this situation to you, so i will post pics asap, and if you look back in less then an hour, they'lle be up! But theres something wrong with my wiring, it works better as a capacitance sensor then a button pad lol, i messed up somehwere... tty tonight
|
|
|
|
« Last Edit: February 29, 2008, 05:39:58 pm by big93 »
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #25 on: February 29, 2008, 05:59:19 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Toronto
Offline
Jr. Member
Karma: 0
Posts: 70
|
 |
« Reply #26 on: February 29, 2008, 08:49:35 pm » |
OK, I can't tell at all what's going on in those pictures, and not just because they're blurry (but it doesn't help).
I recommend doing part by part debugging. First, I'd disconnect all of the switches, since the problem appears to be with the LED drivers. No point having unrelated circuitry in there messing things up.
Since the lights are on when they shouldn't be, I'm guessing that the problem is with the transistors. Are you sure you have those connected properly? Perhaps try driving the LEDs directly, without the transistors, and see if that helps. Just play around with it, reducing it to simpler setups, until you figure out what's wrong.
If it makes you feel any better, I spent the better part of a day debugging it when I built it a second time. I forget what the problem was, but it was something very simple that I felt really dumb about when I found it.
Good luck!
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #27 on: February 29, 2008, 11:51:40 pm » |
ok, i just pulled all the button pad wires out, and i'm gonna try to go over it again to see if anything is not in it's correct spot, but for now ill post pictures of the ic's and everything without the wires, so you can see them more clearly.
ill post the pics in a cuple of mins...
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #28 on: March 01, 2008, 12:36:39 am » |
pics with disconnected wires:     as for the debuging, i had moments where i had my finger on the transistor, and it seemed to work fine, the colors on the row of which transister i was holding was changing colors randomly, but i dident know why it stoped when i took my finger off! i tried connecting my finger with other points and sometimes got a result, and sometimes didnt. This is starting to tickly my angry bug ( horrible way of saying im gettin pissed off, i know.. ) but i just did everything perfect, i see no reason why it shouldent work! your picture is almost an exact duplicate of what i have, its just strange... I might go out to radioshack and buy those transistors there, they sell alot for about 3 bucks, so maybe its these transistors, even though i got em from digikey... And i researched the crap out of em to make sure i got them in the right way... this really should be working
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
God Member
Karma: 0
Posts: 507
Arduino rocks
|
 |
« Reply #29 on: March 01, 2008, 12:39:42 am » |
well, there fuzzy again, but hopefully not too fuzzy...
i'm not sure why, but for some reason this doesent work even though i duplicated your picture...
|
|
|
|
« Last Edit: March 01, 2008, 12:16:37 pm by big93 »
|
Logged
|
|
|
|
|
|