Ambient Energy?

Hey guys, totally new to this.

I took apart an old security system we had in our house (what was left of it) and I got a nifty number pad.
It has 1 input wire, and 7 output wires (one for each row, one for each column). I plugged 6 of these into the “analog in” ports on my Arduino Uno, and used The 3.3V output to supply the energy. I Serial.print-ed the analogRead(A0-A5) and still got around 150 for each one, even when the switch hasn’t been thrown. I even tested it like this:

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  Serial.print("A0: ");
  Serial.println(analogRead(A0));
  Serial.print("A1: ");
  Serial.println(analogRead(A1));
  Serial.print("A2: ");
  Serial.println(analogRead(A2));
  Serial.print("A3: ");
  Serial.println(analogRead(A3));
  Serial.print("A4: ");
  Serial.println(analogRead(A4));
  Serial.print("A5: ");
  Serial.println(analogRead(A5));
  delay(100);
}

And got a range from 250 to 350.

A0: 268
A1: 273
A2: 272
A3: 276
A4: 273
A5: 284
A0: 299
A1: 301
A2: 297
A3: 297
A4: 290
A5: 297
A0: 313
A1: 314
A2: 308
A3: 304
A4: 293
A5: 294
A0: 303
A1: 304
A2: 296
A3: 289
A4: 276
A5: 272
A0: 268
A1: 271
A2: 263
A3: 259
A4: 250
A5: 249

So much so that I can do this and get consistent results:

int output = 3;

void setup()
{
  Serial.begin(9600);
  pinMode(output, OUTPUT);
  digitalWrite(output, LOW);
}

void loop()
{
  if(analogRead(A0) == 0)
  {
    if(analogRead(A3) == 0)
      {Serial.println("ONE");}
    if(analogRead(A4) == 0)
      {Serial.println("FOUR");}
    if(analogRead(A5) == 0)
      {Serial.println("SEVEN");}
  }
  if(analogRead(A1) == 0)
  {
    if(analogRead(A3) == 0)
      {Serial.println("TWO");}
    if(analogRead(A4) == 0)
      {Serial.println("FIVE");}
    if(analogRead(A5) == 0)
      {Serial.println("EIGHT");}
  }
  if(analogRead(A2) == 0)
  {
    if(analogRead(A3) == 0)
      {Serial.println("THREE");}
    if(analogRead(A4) == 0)
      {Serial.println("SIX");}
    if(analogRead(A5) == 0)
      {Serial.println("NINE");}
  }
  delay(100);
}

So…what’s going on?

It has 1 input wire, and 7 output wires (one for each row, one for each column). I plugged 6 of these into the "analog in" ports on my Arduino Uno,

So why did you do this, what did you expect it to achieve?

This is not the way to wire up a keyboard.

You have floating inputs
http://www.thebox.myzen.co.uk/Tutorial/Inputs.html

Thanks for the floating input info, never knew that!

I was just hoping for some sort of numerical input for use in later projects. I hoped that Arduino would be able to register when a button was pressed and released. My ultimate goal is to have it attached to 5 LED’s (4 red, one Full Color) So that it can function as a sort of password system, lighting up a red LED so the user knows they’ve input a number, then, if the right numbers are input, the full color flashes green. Otherwise, it flashes red.

But that’s for later. For now, I just want Arduino to be able to tell when the buttons are being pushed.
Any suggestions on how to better wire up the number pad?

It has 1 input wire, and 7 output wires

How do you know they are inputs and outputs?

You need to find out how that keypad is wired. My guess is that it has not got inputs or outputs but has 4 columns and 4 rows wired in a matrix.
If so connect the 4 columns to arduino inputs and enable the pull up resistors. The connect the rows to outputs and set them all to high.
Then take the rows down to low one at a time. At each low look at all the column inputs to see if any have gone low. When you find one that is low the combination of what input has gone low with what row you were pulling low will give you the number of the key being pressed down.

Alternatively read this:-
http://arduino.cc/playground/Main/KeypadTutorial

Oh, no, I took it apart and studied the circuits. This isn’t a normal keypad. I recently purchased a keypad similar to the one on the link you sent me and thought it was the weird one. Thanks for that info though! That will come in handy when I try to use my new keypad!

But the keypad I’m using right now is actually set up with an input and 7 outputs. Apparently that’s not normal, but that’s the way it’s hooked up.

I took it apart and studied the circuits.

So what did you find. That photo just shows a normal keypad arrangement.
What did the input go to? where did the outputs come from?
Was there any pins that seemed to be power and ground?
Have you got a photo of the other side?

Oh, I assumed when looking at it that energy goes in on the farthest right pin (the second white wire) and it comes out of 2 wires, depending on which button is pushed (In the case of pushing the upper-left button, the red wire and the green) Is that not how this is supposed to function?

But there's nothing on the back:

Is that not how this is supposed to function?

No that is not how any electronics works.

So we are back to the passive column / row situation.
Get your continiuity meter out and start seeing what connects to what when you press the buttons.

Alright, my mistake. Anyways, I know what connects to what when which buttons are pressed. It's easy to tell by just looking at the circuit, but I also tested it with my multimeter when I got it.
So...now what? And what do I do with the far right wire? Or is that not necessary for me to use with my Arduino?

Actually I believe jnighlight is correct in his assumption.

Try this: Connect each of your seven "outputs" to a ground via a 10k resistor and to an input on your arduino. Connect your "input" to +5v.

All your inputs should be LOW (or 0). If you press a button, two inputs should go HIGH (or 1024).

If this is unclear I can draw a quick schematic.

Cheers

p.

So…now what?

Read reply #3

Really sorry about the long time no response. :blush:
I got it figured out, and just remembered that I should probably thank you for helping me solve my problem! I appreciate your help! Thank you!

mind posting how you solved it? just curious and might be useful for future reference :slight_smile:

congrats!

p.

Right, we wouldn't want to become one of those forums where the last post is always "Hey! I got it working! Thanx!" that you find when you Google a problem... :cold_sweat:
Sorry for the long response time, I was on a vacation.

I actually did what fkeel recommended, and he was correct in his assumption (connecting the resistors to zero the analog inputs out). That worked, as well as grumpy Mike's link to the arduino keypad tutorial (which, really, I should have looked there first...) worked charms for actual, simple use in a program!