A6 and A7 pins?

Oh – I just found out that on the nano pins A6 and A7 are analog only and cannot be used as digital like pins A0-A5. I was really wanting to use them in my project. Therefore, I am looking for away to make them act similarly to digital pins.

Looking at some info online, it appears that the pins (A6 and A7) do not have internal pull ups, however, I am guessing that if I connect a 10K resistor from the Vcc to A6 I can create a pull up causing an analogread() of HIGH. Then if I connect a switch (with GND) to the same A6 pin I could get a LOW reading by pushing the switch. Does this sound correct, and will it work for my purpose? Thank you for any replies

It makes sense what you have described. Now, do some experiments based on the idea you have presented and post the results.

2 Likes

It could well work as you have described.

Have you tried it ?

1 Like

Since you can only use analogRead() on A6 or A7 you won't get "HIGH" or "LOW". You will get "near 1023" and "near 0". You could use (analogRead(A6) > 512) to get a 0 (LOW) or 1 (HIGH).

2 Likes

Test Sketch (A6-pin with external 2.2k pull-up resistor):

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

void loop()
{
  if ((5.0 / 023)*analogRead(A6) >= 3.0)
  {
    Serial.println("HIGH");
    Serial.println((5.0 / 1023)*analogRead(A6), 1);
  }
  else
  {
    if ((float)analogRead(A6) <= 0.9)
    {
      Serial.println("LOW");
      Serial.println((5.0 / 1023)*analogRead(A6), 1);
    }
  }
  delay(1000);
}

Hi,
In addition to not having pull-up resistors,
ADC pins ADC7 and ADC6 do not have digital input buffers too.

1 Like

Thank you for the replies and test code. I will be working on this later tonight. I do have a question about the lack of digital buffers (as noted), what effect does this have. What do the buffers on the other pins do?

I don't see the buffers (analog) in Fig-1 below taken from data sheets. The analog signal is directly routed to the multiplexer.

ADCInpot
Figure-1:

1 Like

That's what @ruilviana said :wink:

1 Like

@ruilviana has talked about the absence of "digital buffer" and has not said anything about the absence of "analog buffer". :smile:

1 Like

Hi, @sterretje

I wasn't the one who said that!

As I'm not fluent in English, I hope I didn't misunderstand,
I just reproduced what is written in:

datasheet written by Microchip:

ATmega48A/PA/88A/PA/168A/PA/328/P DS40002061A

Page: 261
Title : • Bit 5:0 – ADC5D...ADC0D: ADC5...0 Digital Input Disable
line n.: 5

Note that ADC pins ADC7 and ADC6 do not have digital input buffers, and therefore do not require Digital Input
Disable bits.

or in the Atmega datasheet written by ATMEL

ATmega48A/PA/88A/PA/168A/PA/328/P
Atmel-8271I-AVR-ATmega-Datasheet_10/2014
Page: 252
Title : • Bit 5:0 – ADC5D...ADC0D: ADC5...0 Digital Input Disable
line n.: 5

Note that ADC pins ADC7 and ADC6 do not have digital input buffers, and therefore do not require Digital Input
Disable bits.

:face_with_monocle: :face_with_monocle: :face_with_monocle:

Hi, @GolamMostafa

I wasn't the one who said that!

As I'm not fluent in English, I hope I didn't misunderstand,
I just reproduced what is written in:

datasheet written by Microchip:

ATmega48A/PA/88A/PA/168A/PA/328/P DS40002061A

Page: 261
Title : • Bit 5:0 – ADC5D...ADC0D: ADC5...0 Digital Input Disable
line n.: 5

Note that ADC pins ADC7 and ADC6 do not have digital input buffers, and therefore do not require Digital Input
Disable bits.

or in the Atmega datasheet written by ATMEL

ATmega48A/PA/88A/PA/168A/PA/328/P
Atmel-8271I-AVR-ATmega-Datasheet_10/2014
Page: 252
Title : • Bit 5:0 – ADC5D...ADC0D: ADC5...0 Digital Input Disable
line n.: 5

Note that ADC pins ADC7 and ADC6 do not have digital input buffers, and therefore do not require Digital Input
Disable bits.

:face_with_monocle: :face_with_monocle: :face_with_monocle:

Don't worry. But I think that you did misunderstand my comment that was directed at GolamMostafa, not you.

1 Like

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