Arduino analog in uno to analog in nano

Hi, i am kinda a newbie to arduino, I built a project (from a website) in a breadboard with a arduino uno, I used a 4x4 keypad as showed, and connected to analog 1 to 5 and 13D, 12D, I did some alterations in the code but nothing special, and everything was working fine.

Now I switched to a nano with the same port config and the keypad isn't working..
Is something from the code, or is some limitations between uno and nano?

I think that this is nothing to do with the keypad, but in the case that I am wrong the keypads that I am using are these ones:

The project with the uno was with this keypad:
http://www.minikits.com.au/image/cache/data/components/keypad3-500x500.jpg

And with the nano is this one:

I switch because the project itself is with a friend of mine, so I am making a second one.
I have checked the matrix schematics and switch the pins from the black one to the other one accordly.
I have tried, not switching it up, dismount the keypad to see if I was missing something.
Can anybody shine a light to this matter to me ?

Thanks in advance :wink:

The Arduino Uno version 'R3' has a gate from pin 13 to the led. Therefor pin 13 can be used as input.
The Arduino Nano has a resistor and led at pin 13, using it as input can cause trouble.

Use another pin for pin 13 (use pin 13 to blink the system led).

Peter_n:
The Arduino Uno version 'R3' has a gate from pin 13 to the led. Therefor pin 13 can be used as input.
The Arduino Nano has a resistor and led at pin 13, using it as input can cause trouble.

Use another pin for pin 13 (use pin 13 to blink the system led).

Ok, I switched from pin 13 to Analog 6 that was the only one left, still no response from the keypad.
If the problem was or is (supposing that my keypad isn't broke) the pin 13, why I am not getting anything from the rest of the keys ? If this is a matrix system pin 13 in my setup its only the second column.

But thanks on the pin 13 note :wink:

Okay, you are right. The other columns should have worked.
Do you have a multimeter, to test the keypad ?

I think it can be a faulty Nano board, or you use too much power from a pin, or the voltage input is too high and the voltage regulator gets hot, or the sketch is wrong.

Could you make a test sketch for the keypad. Disconnect everything else.
Use the USB cable to power the Nano.
Did you use the Keypad library ? which one ?
What else was connected ? Did you use the 3.3V pin ?
Can you give a link to your Nano board ?

Are you sure the keypad is still working with the Uno at the moment ?
Is the Nano a cheap clone ? Does it even work at all ? can you blink a led ?
You don't use the Wire library I hope ? The I2C takes over pin A4 and A5.
Did you select the proper board in the Arduino IDE ?

Some have reported that cheap clone boards have shortcut or not connected wires for the I2C bus. That is pin A4 and A5. Try using other pins, or try to measure if the A4 and A5 from the chip are connected to the pins.

If that still doesn't help. Make a sketch that toggles all the pins one by one, and reads them all one by one. Test every pin.

Could you buy another Nano board ? Don't buy from the same seller.

Hey Peter_n, from all thing you just said, the one that caught my eye was in fact the problem with the A ports... I tested the keyboard with a multimeter and it was ok, the only thing left to see is that problem with the A ports, and yes my adrduino nano is a funduino, but I can connect it to a LCD, so the board seams ok... I think :stuck_out_tongue:

Thanks for your help, I will try to switch the ports when I get home.

Edit: I tried not to use ports 13 and A4 and A5 and still no response.. The lcd was working fine, but for the test I only have the board and a buzzer to test the signal from the keypad. Any more sugestions out there ?

You only provided pictures of the keypads so the specifications are unknown. Perhaps the one that doesn't work has diodes to allow for n-key rollover. Try swapping the rows and columns. That should reverse the path through any diodes.

johnwasser:
You only provided pictures of the keypads so the specifications are unknown. Perhaps the one that doesn't work has diodes to allow for n-key rollover. Try swapping the rows and columns. That should reverse the path through any diodes.

Yeah I know, but I think that those two models are the most used, so I assume that everyone will recognize one, and even if they are the same model but different manufacturer the schematics are the same.

And yes, they have differences in the matrix schematic, but I had that into account and modified the black one to be the same as the other..

Test the pins one by one. I don't know what else to do :confused:

The power circuit is different, but if nothing else is connected and the USB cable is used to power the Arduino, then it should not matter. Unless the USB power is very weak and the 5V pin has only 4.5V. A weak USB power can be bad quality cable or a laptop USB port.

Hi,

Peter_n suggested

Could you make a test sketch for the keypad. Disconnect everything else.

Have you done this, just a test for the keypad, with no other hardware connected or programmed?

How many and what libraries are you using.

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom..... :slight_smile:

TomGeorge:
Hi,

Peter_n suggested
Have you done this, just a test for the keypad, with no other hardware connected or programmed?

How many and what libraries are you using.

Can you please post a copy of your sketch, using code tags?
They are made with the </> icon in the reply Menu.
See section 7 http://forum.arduino.cc/index.php/topic,148850.0.html

Tom..... :slight_smile:

Hey, I have already tested the connections one by one with a multimeter and they seemed ok, I got a different nano to check if it was from the arduino but no luck on that one either.
The code is quite extensive, and it's an open source code (I didn´t made it), its for a prop bomb for airsoft. This is the download link: http://yin.mainstreamds.com/wp-content/uploads/2014/08/bombpro.zip or just go to http://yin.mainstreamds.com but its in spanish, but its a good project and it comes with fritzing sketch.

Thanks for the help so far, I have ordered a new set of keyboards, I should get them wednesday. Lets hope that the problem lays on the keyboard for some magical unknown reason lol

I have no clue ! Sorry :sob:
Both the Uno and Nano use the ATmega328P microcontroller.
I took a look at that project, but I didn't see anything strange. I would use a protection resistor for the speaker and the mosfet of 150 ohm and I would avoid pin 13. But nothing serious.

It is possible that the other Nano is faulty as well. Or the breadboard has bad contacts, and you used the same location on the breadboard.

There are many things to test, but that would take a lot of time. You could use a wire to shortcut a row and a column and see if that is detected. Some changes to the code could be made to display more messages, and to move data into flash to get more free ram.

Peter_n:
I have no clue ! Sorry :sob:
Both the Uno and Nano use the ATmega328P microcontroller.

That was the first things I did, but with no luck, well I think I will keep trying.
Thanks for the tips anyways :wink:

Hi,

Have you written a test sketch just for the keypad on the nano, with no other hardware connected or programmed?

What library are you using to read the keypad?

Does all the other parts of your sketch work, input and output wise?

This will tell if the nano can output and input from the keyboard.

You can attach your sketch to the REPLY rather than QUICK REPLY if it is too big to put in code tags.
There is an attachment facility in the REPLY window.

Tom..... :slight_smile:

Hi, again.

What version nano do you have?

If you have an Arduino Nano 3.0, you'll need to select Arduino Duemilanove or Nano w/ ATmega328 from the Tools > Board menu. If you have an Arduino Nano 2.x, select Arduino Diecimila, Duemilanove, or Nano w/ ATmega168.

http://www.arduino.cc/en/Guide/ArduinoNano

Tom.... :slight_smile:

TomGeorge:
Hi, again.

What version nano do you have?

http://www.arduino.cc/en/Guide/ArduinoNano

Tom.... :slight_smile:

Hi have a nano 3.0, I will test it today with a simple code for the keypad.
But I think that is an arduino "thing", because the same code in uno runs great...

Guys, I just received the new keypads, and they are the sames as the one I used that worked on uno, but with nano is still not responding.

I have in my hand two nanos, so the probability of both nanos being broke is short, and the screen pops up with them, so... I think is very unlikely, but you never know...

I am starting to think that this is a problem with the code, the original code was written to use in uno, mega, my bet is on that, what do you guys think ?

If it was the code, there must something extremely bad/awkward code in a library.
Try a test sketch with the keypad library (keypad.zip) : Arduino Playground - Keypad Library
If you bought the same Nano board from the same seller, they might have the same problem.

Peter_n:
If it was the code, there must something extremely bad/awkward code in a library.
Try a test sketch with the keypad library (keypad.zip) : Arduino Playground - HomePage
If you bought the same Nano board from the same seller, they might have the same problem.

Ok, got it working, half way but its working.
Nothing was doing the job, I tried running the keypad with nano and a serial print code so I could watch the keys, and it worked, even with the same analog pins that I started with, A0 to A5 and D 12 and 13.

The moment I connect the keypad to the project I was back to square one... I added a serial print to the code and I noticed that I was only getting half of the keys, so the menu didn't move...

The keys missing are the ones connected to pins 12 and 13, any idea why ? or this is a post to programing questions ?

Can you tell exactly what you did test ?
Which keypad library ? the one I mentioned ?
Is your project only an other sketch, or also extra hardware, for example the display ?
Pin 13 is the led as I wrote. Pin 12 is part of the SPI bus, but I suppose you don't use that.

When you upload/compile the sketch, do you select the Uno board or Nano board. I hope you don't upload code for the other board. I'm not sure, but I think that the Nano board has also A6 and A7. A bug with pin numbers could have a different result on the Uno or the Nano.

Peter_n:
Can you tell exactly what you did test ?
Which keypad library ? the one I mentioned ?
Is your project only an other sketch, or also extra hardware, for example the display ?
Pin 13 is the led as I wrote. Pin 12 is part of the SPI bus, but I suppose you don't use that.

When you upload/compile the sketch, do you select the Uno board or Nano board. I hope you don't upload code for the other board. I'm not sure, but I think that the Nano board has also A6 and A7. A bug with pin numbers could have a different result on the Uno or the Nano.

So, I started testing with library that was in the link you gave me, with only that, the nano seems to respond well, the keys are messed up, but that is just calibration.
This test was made with the 12 and 13 port, as well as other combinations of ports, I checked the analog ports with a blink led analog control, they were all okay.

Then I went to the system, the uno is still with my friend so I bought a chinese mega, (cheap thing....), and I tested the system with it and it was all good.. Then with the nano and the same ports the only thing that goes up is the led screen...
I tested the keypad with other connections, beside port 12 an 13 as you said, but with no luck..
I can't use any other ports beside 12 and 13 in the full mount version of the project, even if I use all the analog ports one of the pins must go into one of those ports.