Need more power ...?

i am trying to make a very large keyboard but i dont think the arduino puts out enough electricity to power the keys? i tried testing each key with the 'switch" code from the tutorials and one key works just fine but the LED fades as a move farther from the arduino so to speak. halp

is there a way to power said keyboard separately from the arduino? or add more power without it overloading the arduino?

Arduinos usually don't put out energy to power anything at all. Take the power directly from the battery.

Yes. This is very easy. Just take a battery of some sort and hook it up to all the lights and switches. As long as you connect the ground to the ground on the Arduino it will work fine

Keys - as in, push buttons - don't need any power when in open state. So you can power an infinite number of buttons through an Arduino, you just won't be able to press them all at the same time as when pressed (and closed) a button does use a little bit of power - 0.5 mA for a common 10k pull-up, or about 0.2 mA if using the internal pull-ups, allowing for 1000 buttons to be pushed at the same time before reaching the 200 mA limit.

So powering a keyboard, as in a great number of push buttons, should be no problem.

Now you're also talking about an LED. One or more? How is it all wired? An Arduino can power a few LEDs at the same time (through the 5V out - a single LED for an output pin).

You also really have to explain this part in more detail:

EdWino:
the LED fades as a move farther from the arduino so to speak.

One and the same LED?
How far from the Arduino?
How is the LED wired/powered?

If I matrix a bunch of buttons, the power is going to be either row or column pins INPUT_PULLUP and then only one pin supplies next to no current (5V through 20K to 50K AVR chip internal resistor, that's 20K ohms minimum).

The power part shouldn't matter how many buttons you have within reason. I don't joke,

Since I don't know how you have this wired or coded if you've gotten that far there is little else I'd mention. Your ball.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What are you using to power your project?

What keyboard are you using, link to specs/data?

What model Arduino are you using?

Can you please post your code?

Thanks.. Tom.. :slight_smile:

first of all!! thanks for responding!! to answer a previous question.. i am using the pin 13 led on an arduino uno.. just to test my keys..i am using the code from the switch tutorial...

so i am trying to turn this...

into a midi controller..

the pads are triggered through two piece of electric painted plastic that connect through holes in foam when you step on a 'key'

the pads connections go like this.

the led fires up only when i step on the 'middle e 'key when i have only the middle e key set up as the switch. even then, the further down i press on the key, the fainter the light becomes. when i move it to any other key it doesnt work.


i thought i was having trouble with the code and using a shift register. but now seeing that the keys are (im guesing) not juiced enough. i need to tackle this first.

what did i miss?

oh the code!
well my code for the controller is

// Pin Definitions
// Rows are connected to
const int row1 = 5;
const int row2 = 6;
const int row3 = 7;
const int row4 = 8;

// The 74HC595 uses a serial communication
// link which has three pins
const int clock = 9;
const int latch = 10;
const int data = 11;

uint8_t keyToMidiMap[32];

boolean keyPressed[32];

int noteVelocity = 127;

// use prepared bit vectors instead of shifting bit left everytime
int bits[] = { B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000 };

// 74HC595 shift to next column
void scanColumn(int value) {
digitalWrite(latch, LOW); //Pulls the chips latch low
shiftOut(data, clock, MSBFIRST, value); //Shifts out the 8 bits to the shift register
digitalWrite(latch, HIGH); //Pulls the latch high displaying the data
}

void setup() {

// Map scan matrix buttons/keys to actual Midi note number. Lowest num 41 corresponds to F MIDI note.

keyToMidiMap[1] = 53;
keyToMidiMap[2] = 55;
keyToMidiMap[3] = 57;
keyToMidiMap[4] = 59;
keyToMidiMap[5] = 60;
keyToMidiMap[6] = 62;
keyToMidiMap[7] = 64;

keyToMidiMap[1 + 8] = 54;
keyToMidiMap[2 + 8] = 56;
keyToMidiMap[3 + 8] = 58;
keyToMidiMap[5 + 8] = 61;
keyToMidiMap[6 + 8] = 63;

keyToMidiMap[1 + 16] = 65;
keyToMidiMap[2 + 16] = 67;
keyToMidiMap[3 + 16] = 69;
keyToMidiMap[4 + 16] = 71;
keyToMidiMap[5 + 16] = 72;
keyToMidiMap[6 + 16] = 74;
keyToMidiMap[7 + 16] = 76;

keyToMidiMap[2 + 24] = 66;
keyToMidiMap[3 + 24] = 68;
keyToMidiMap[4 + 24] = 70;
keyToMidiMap[6 + 24] = 73;
keyToMidiMap[7 + 24] = 75;

// setup pins output/input mode
pinMode(data, OUTPUT);
pinMode(clock, OUTPUT);
pinMode(latch, OUTPUT);

pinMode(row1, INPUT);
pinMode(row2, INPUT);
pinMode(row3, INPUT);
pinMode(row4, INPUT);

Serial.begin(31250);

delay(1000);

}

void loop() {

for (int col = 0; col < 8; col++) {

// shift scan matrix to following column
scanColumn(bits[col]);

// check if any keys were pressed - rows will have HIGH output in this case corresponding
int groupValue1 = digitalRead(row1);
int groupValue2 = digitalRead(row2);
int groupValue3 = digitalRead(row3);
int groupValue4 = digitalRead(row4);

// process if any combination of keys pressed
if (groupValue1 != 0 || groupValue2 != 0 || groupValue3 != 0
|| groupValue4 != 0) {

if (groupValue1 != 0 && !keyPressed[col]) {
keyPressed[col] = true;
noteOn(0x91, keyToMidiMap[col], noteVelocity);
}

if (groupValue2 != 0 && !keyPressed[col + 8]) {
keyPressed[col + 8] = true;
noteOn(0x91, keyToMidiMap[col + 8], noteVelocity);
}

if (groupValue3 != 0 && !keyPressed[col + 16]) {
keyPressed[col + 16] = true;
noteOn(0x91, keyToMidiMap[col + 16], noteVelocity);
}

if (groupValue4 != 0 && !keyPressed[col + 24]) {
keyPressed[col + 24] = true;
noteOn(0x91, keyToMidiMap[col + 24], noteVelocity);
}

}

// process if any combination of keys released
if (groupValue1 == 0 && keyPressed[col]) {
keyPressed[col] = false;
noteOn(0x91, keyToMidiMap[col], 0);
}

if (groupValue2 == 0 && keyPressed[col + 8]) {
keyPressed[col + 8] = false;
noteOn(0x91, keyToMidiMap[col + 8], 0);
}

if (groupValue3 == 0 && keyPressed[col + 16]) {
keyPressed[col + 16] = false;
noteOn(0x91, keyToMidiMap[col + 16], 0);
}

if (groupValue4 == 0 && keyPressed[col + 24]) {
keyPressed[col + 24] = false;
noteOn(0x91, keyToMidiMap[col + 24], 0);
}

}

}

void noteOn(int cmd, int pitch, int velocity) {
Serial.write(cmd);
Serial.write(pitch);
Serial.write(velocity);
}

and the arduino tutorial code is here

also, attached the picture files because idk if they posted on the last one.

EdWino:
the pads are triggered through two piece of electric painted plastic that connect through holes in foam when you step on a 'key'

You're trying to push enough current through that kind of connection and get enough out to force an INPUT pin HIGH....

It would be good to measure the resistance through one of those switches.

You might read those switches easier if you set your sense/input pins to INPUT_PULLUP because pins set to that mode only have to be drained of their weak supply current, not raised from LOW to HIGH.
You would need to ditch the shift register and use pins instead that you switch between INPUT (when you don't read an input, the connect is neutral) and OUTPUT (both LOW) which a 595 shift register won't do.
The thing is that I don't know if your switches can take the weak pullup current down if their resistance through the conductive paint is too high.

Hi,
Can I suggest you forget for the moment about the Midi programming.
Just write code for reading your keypad and nothing else.
Get it working then do the Midi bit.

As @GoForSmoke has suggested, you need to measure the Pad ON and OFF resistance with a DMM.

Also a good circuit diagram would help, NOT A FRITZY picture, but a diagram showing ALL your wiring and label pins, either CAD or a picture of a hand drawn circuit in jpg, png?

Tom... :slight_smile:

EdWino:
i am trying to make a very large keyboard but i dont think the arduino puts out enough electricity to power the keys? i tried testing each key with the 'switch" code from the tutorials and one key works just fine but the LED fades as a move farther from the arduino so to speak. halp

is there a way to power said keyboard separately from the arduino? or add more power without it overloading the arduino?

Look schematics in attachment

newtechnology:

No buttons, no LED, not even a power connection to the Arduino... this can't be a complete circuit diagram of your project.

Useful schematic. I can clearly see why it doesn't work. There are no connections between the keyboard and the Arduino and the Arduino has no power so it not actually running the program.

Steve

By the way, just to make sure:
newtechnology == EdWino?

wvmarle:
By the way, just to make sure:
newtechnology == EdWino?

nope

TomGeorge:
Also a good circuit diagram would help, NOT A FRITZY picture, but a diagram showing ALL your wiring and label pins, either CAD or a picture of a hand drawn circuit in jpg, png?

Tom... :slight_smile:

here's that diagram!

wvmarle:
No buttons, no LED, not even a power connection to the Arduino... this can't be a complete circuit diagram of your project.

It's just external power connection for keyboard.In this schematic arduino power connection at DC socket

newtechnology:
It's just external power connection for keyboard.In this schematic arduino power connection at DC socket

so, from your diagram, i hook the possitive battery to my output wires, and the ground to my input/ground of the arduino? im having trouble with whats going on in the black box

You better completely ignore the diagram from @newtechnology as it has no relevance to your project whatsoever. We were also tricked - I'm afraid it's just a troll attempt.

Now about your diagram:

EdWino:
here's that diagram!

What's this "595" component? The other markings are unreadable. I guess it's some form of input?
Is that "DIN5" also your power supply? If not where is your power supply?
What is that bottom left marker in the "Arduino" box? Can't read it.
What is the value of those four resistors?

wvmarle:
Now about your diagram:
What's this "595" component? The other markings are unreadable. I guess it's some form of input?
Is that "DIN5" also your power supply? If not where is your power supply?
What is that bottom left marker in the "Arduino" box? Can't read it.
What is the value of those four resistors?

  1. its a 74HC595 shift register
  2. din5 is the female midi output jack, power supply is currently just the arduino hooked in through its usb port.
  3. the is the pin1 tx output for the midi
  4. the four resistors re 10k, there is also one 220 going into the power jack to the din5