Extend ATMEGA328P-AU pins

Hi Guys,

I'm looking a way extend the pin's ATMEGA328P-AU chip without using any other component like shift register (this will be my last solution).
My project will use the 23 IO pins available (in green) and i need at least 3 extra IO pins, So I have ADC7, AREF, ADC6, AVCC.


Questions:

  • ADC7 and ADC6: I know we can use analog pin as output pin, so OK.
  • AREF: I read better to stay away from it, so really NO?
  • AVCC: I will need to read voltage battery, can I use this pin instead of analog?
  • GND: and no way to use those GND as IO pin?

Wrong, those two can only be used as analog inputs.

If you show us your project details, it will be 1000x easier to help.

Where did you seen 32 "green" pins on the diagram?
This IC has 32 pins in total, including some pins, not available for using as GPIO: power(more than one), GND(also more than one), RESET, aref etc
ATMEGA328 has 23 GPIO only

Ah by mistake i mean 23.

Oh only Input, still useful I can switch with other pins used as input.

1 Like

Only pins, labelled in green, can be used as IO.

Please describe your project, perhaps you can merge the functions of the some pins to one

but only analog, not digital

Rhetorical, why don’t people include a schematic with their questions. :angry:

A single analog input can monitor many switches.

If the ATmega328P is short of IO pins, is there a compelling reason for using it in the first place ?

The more you describe about your project, the better the answers you will get.

Hmm thanks for the clarification. @b707 this is a old project I have to go to the details in order better describe it... I will check later if I can optimize it. I know I use piezo buzzer, LDR, few sensor, motor, few led that need to be controlled individually.

Is there another chip with more pins than ATMEGA328P?

image

ATMEGA1284-P

~ $11.00

1 Like

you did well to mention the price, I looked at it but it was too expensive for my budget.
But good to know. Thanks

Don't you have to go into details, just to do it?

too expensive for my budget

Can you quantify that?

If you use an ATmega328PB, you can get up to 27 IO lines.

  1. A6 and A7 become fully usable as GPIO.
  2. a pair of power pins become GPIO (compared to the non-B version.)
  3. the XTAL pins can become GPIO if you use the internal oscillator.
  4. RESET can become GPIO (not recommended!)

AREF is not repurposable on those chips.

You might want to look at ATmega4809 (as used in Nano Every) and the new AVRnnDy48 chips (which AFAICT have all the functionality of a 1284, but are much cheaper.

1 Like

This is perfect. I don't think I will need more than 4 extra pin, but if needed I can try the multiplex technique in order to use multiple input from one pin like suggested LarryD.
Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.