Pages: [1]   Go Down
Author Topic: Problem - all analog inputs as digital input pins  (Read 719 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, noob need help here please.   :-[
I want to use all analog pins 0-5 as digital input pins.  I know we can do this by assigning them as digital pins 14-19.  So I connect all these pins with 6 pull up 10K resistors, and switches to ground to pull down and read LOW value.  But strange things I can only digitalRead on pin 14 (analog 0) AND 19 (analog 5) only.  When I test/print the value of all these pins with the switches open (meaning all the value should be HIGH, right?), I got only pin 14 AND 19 that is HIGH, while pin 15, 16, 17, and 18 are still LOW even though it is already pull up to VCC with the resistors.  I tried the setup on the normal digital pins 8 to 13, and they works fine, so the component connection is fine, I am sure.  Please help, I really need to use a lot of the pins as digital input.  Tks a lot.
« Last Edit: October 05, 2009, 08:08:04 am by bennyjo88 » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 505
Posts: 31345
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What type of arduino are you using?
Have you used the board for other stuff and maybe fried the other pins?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am using Dorkboard with atmega328 with Lady Ada bootloader.  I have tried to change the chip with another brand new 328, it still has same problem.
Logged

Spokane, Washington
Offline Offline
God Member
*****
Karma: 0
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It kind of sounds like a hardware problem.. why not just use the internal pull-ups to take away from external components?

To enable them, first use pinMode to turn them into an input, then turn the pin high. Attach one side of the switch to ground, other to the input pin, and that's it, no resistors smiley

Also, have you looked at using shift registers for your switches instead? You can read 8 buttons per chip, and you can use I believe 8 chips (probably more) with just 3 wires from the Arduino.
Here's an example:
http://www.arduino.cc/en/Tutorial/ShiftIn
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Captain.. tks for suggestion, actually before I put the resistor I have tries to use the internal pull-up, and I got same problem.  So I thought the internal pull-up was fried, that is why I use the external resistors.

The ShiftIn register is great idea, but PCB (Protoboard actually  smiley-wink ) and casing space is really a premium on my project, that is why I use dorkboard, there is already a Hope RFM12B wireless module, 3.3V step up module, mini joystick and mini BCD switch (not shown on the picture).

Big thanks for the suggestion, I might have to re-think this project.  I will try to test these analog pins on the real Duemilanove/Diecimila and see whether I got same problem or not.  Tks again.


Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It wouldn't hurt to post your code, just in case there is an issue there.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Solved..!!!  lousy me..  bad solder joint only..!
measure all the voltage on the pull up resistors.. only two got HIGH 3.3V, the rest is way below 1V.. clean the connection and re-solder.. and Voila.. all HIGH 3.3V..  thanks for all your suggestion...
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 25
Posts: 4108
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How do you reconcile your solution to the problem with this statement from your original post?
Quote
I tried the setup on the normal digital pins 8 to 13, and they works fine, so the component connection is fine, I am sure.
Don
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don
I mean "component connection" as following the electronic schematic...  I use same schematic connection on pin 8-13 as using also pull up resistor, and they work fine.  But on the pin 14-19, using same schematic with another pull up resistors, they dont works properly.  If you see my photo, there are 6 resistors in the middle of the board (which I found 4 has bad connection latter) and there are several others on the top right corners which I use to connect to test pin 8-13.  Sorry to give you confusion.
Logged

Pages: [1]   Go Up
Jump to: