max i/o pins for arduino and/or atmel

has anyone figured out the practical limit for I/O pin count

Max Input pins?
Max I/O pins?
Max Output pins?

And for which Arduino or Atmel device that would be?

Or am I going to have to go scanning datasheets?

Tks, J

The pages with the different Arduino products each describe the number of I/O pins.

Note that they are I/O pins - that means input as well as output. How you allocate them is your business.

...R

The Arduino Mega has 70 I/O pins including the analog input pins. I believe that's the Arduino with the maximum number of I/Os.

I guess what I'm thinking about is, besides the standard Arduino assigns of I, I/O & O, if I develop code using the Arduino dedicated pins for I and O then use the board to program, say a 328, unplug it and plug it into my board for final check out. Example, my board has no serial I/O. Has anyone seen a discussion along those lines on this forum?

What? Unplugging the chip doesn't damage the serial.

When it's off the Arduino board, you don't get the nice serial-to-USB converter but the serial comms coming out of the chip is not affected.

captainjim47:
I guess what I'm thinking about is, besides the standard Arduino assigns of I, I/O & O, if I develop code using the Arduino dedicated pins for I and O then use the board to program, say a 328, unplug it and plug it into my board for final check out. Example, my board has no serial I/O. Has anyone seen a discussion along those lines on this forum?

I think it is fair to say I have no idea what this means.

Why don't you tell us exactly what you are trying to achieve rather than asking poorly framed questions.

...R

1 Like

I'll be plugging this into a board that has 8 LEDs it needs to drive, monitor 4 switches and control 4 relays. It won't be using any serial comms or anything else for that matter. Just watch the switches and manipulate the LEDs and relays based on what happens on the switches. Currently the switches control the relays directly. With a 328 or similar uP in the middle I can up the IQ of the circuit a bit and eliminate a situation where an incorrect switch entry will try to drive a DC motor both directions at the same time resulting in a blown fuse. So, bottom line, I need 12 outputs and 4 inputs. Tks.

// before setup
byte ledPinArray[] = {2,3,4,5,6,7,8,9];
byte buttonPinArray[] = {10,11,12,13];
byte relayPinArray[] = {14,15,16,17};
// leaves 0,1 for Serial
// leaves 18, 19, for I2C

// in setup
// control 8 LEDs
for (byte x = 0; x<8; x=x+1){
pinMode (ledPinArray[x], OUTPUT); // pin connected from resistor to LED anode, cathode to Gnd. HIGH turns on LED
}
// monitor 4 switches, pins with button that connects to Gnd when pressed
for (byte x = 0; x<4; x=x+1){
pinMode (buttonPinArray[x], INPUT_PULLUP); // reads as HIGH unless  button is pressed
}
// control 4 relays
for (byte x = 0; x<4; x=x+1){
pinMode (relayPinArray[x], OUTPUT); // pin connected from resistor to NPN transistor base to sink relay coil current
}

12 outputs and 4 inputs, that we understand.
It is possible, but what you want to do seems not very practical.
When you use pin 0 (RX) and pin 1 (TX) for something else, you can't upload a sketch to it anymore, unless you use a programmer. You would also need a crystal of 16MHz, two 22pF capacitors, one 100nF, a 10k resistor and probably a diode.
It is also possible to have a special bootloader and use the internal 8MHz oscillator instead of a crystal. That way the two pins of the crystals can be used as digital pins as well.

Example: ATmega328P with external crystal, and pin 0 and 1 preserved for uploading a sketch. Then you have pin 2 up to pin 13 plus A0 ... A5 that are 6 analog and digital pins. That is a total of 18 digital pins (of which 6 are also analog pins).

Do you need PWM for the pins to the leds ?

There are small Arduino compatible modules, with many pins. The Pro Mini, or Adafruit Feather, and many others.

CrossRoads, Koepel, thanks for the input, very helpful. I knew someone had already figured this stuff out.

The input switches will be wire "or'd" thru diodes to an NPN that pulls in a relay providing power to the uP & board. So they are switching from open to Vbatt, actually. The first thing the uP does on WAKE is light the decimal point on the single display (pilot lite) which also drives a 5th diode holding up the power relay circuit. The switches control a hydraulic powered system that remains as set once power is removed. So once an inactivity timer expires, the DP output is reset the power relay is released and it loop's until Vcc fails. I haven't heard of Atmel having 'brown out' issues, or anyone else for that matter, since the 90's & early 2k's, have you guys? [brown out: when a u-ctrlr tries removing its own power with asynchronous inputs re-applying Vcc at inopportune times.]

thanks again for the responses, Jim

byte ledPinArray[] = {2,3,4,5,6,7,8,9]; // ] <<<<<< }
byte buttonPinArray[] = {10,11,12,13]; // ] <<<<<< }

captainjim47:
The input switches will be wire "or'd" thru diodes to an NPN that pulls in a relay providing power to th.....

How about posting your schematic? With something of this complexity, you must have one. Words don't really work well for something like this. There are many useful schemes for achieving more input and output when the number of pins are limited.

Right now schematic is on quadrule pad... will post when it gets pdf'd. Tks, J