Jump to content

How to find the digital and analog pins on a standard Arduino board

0
  michael margolis's Photo
Posted May 17 2011 06:18 AM

The tables below show the digital and analog pins for a standard Arduino board and the Mega board.

The “Port” column lists the physical port used for the pin.

Analog and digital pin assignments common to popular Arduino boards

Arduino 168/328Arduino Mega (Pins 0-19)
Digital pinPortAnalog PinUsagePortAnalog pinUsage
0PD 0USART RXPE 0USART0 RX, Pin Int 8
1PD 1USART TXPE 1USART0 TX
2PD 2Ext Int 0PE 4PWM T3B, INT4
3PD 3PWM T2B, Ext Int 1PE 5PWM T3C, INT5
4PD 4PG 5PWM T0B
5PD 5PWM T0BPE 3PWM T3A
6PD 6PWM T0APH 3PWM T4A
7PD 7PH 4PWM T4B
8PB 0Input CapturePH 5PWM T4C
9PB 1 PWM T1APH 6PWM T2B
10PB 2PWM T1B, SSPB 4PWM T2A, Pin Int 4
11PB 3PWM T2A, MOSIPB 5PWM, T1A, Pin Int 5
12PB 4SPI MISOPB 6PWM T1B, Pin Int 6
13PB 5SPI SCKPB 7PWM T0A, Pin Int 7
14PC 00PJ 1USART3 TX, Pin Int 10
15PC 11PJ 0USART3 RX, Pin Int 9
16PC 22PH 1USART2 TX
17PC 33PH 0USART2 RX
18PC 44I2C SDAPD 3USART1 TX, Ext Int 3
19PC 55I2C SCLPD 2USART1 RX, Ext Int 2


Assignments for additional Mega pins

Arduino Mega (pins 20–44)Arduino Mega (pins 45–69)
Digital pinPortUsageDigital pinPortAnalog pinUsage
20PD 1I2C SDA, Ext Int 145PL 4PWM 5B
21PD 0I2C SCL, Ext Int 046PL 3PWM 5A
22PA 0Ext Memory addr bit 047PL 2T5 external counter
23PA 1Ext Memory bit 148PL 1ICP T5
24PA 2Ext Memory bit 249PL 0ICP T4
25PA 3Ext Memory bit 350PB 3SPI MISO
26PA 4Ext Memory bit 451PB 2SPI MOSI
27PA 5Ext Memory bit 552PB 1SPI SCK
28PA 6Ext Memory bit 653PB 0SPI SS
29PA 7Ext Memory bit 754PF 00
30PC 7Ext Memory bit 1555PF 11
31PC 6Ext Memory bit 1456PF 22
32PC 5Ext Memory bit 1357PF 33
33PC 4Ext Memory bit 1258PF 44
34PC 3Ext Memory bit 1159PF 55
35PC 2Ext Memory bit 1060PF 66
36PC 1Ext Memory bit 961PF 77
37PC 0Ext Memory bit 862PK 08Pin Int 16
38PD 763PK 19Pin int 17
39PG 2ALE Ext Mem64PK 210Pin Int 18
40PG 1RD Ext Mem65PK 311Pin Int 19
41PG 0Wr Ext Mem66PK 412Pin Int 20
42PL 767PK 513Pin Int 21
43PL 668PK 614Pin Int 22
44PL 5PWM 5C69PK 715Pin Int 23


The table below is a summary of timer modes showing the pins used with popular Arduino chips.

Timer modes

TimerArduino 168/328Mega
Timer 0 mode (8-bit)Fast PWMFast PWM
Timer0A analogWrite pinPin 6Pin 13
Timer0B analogWrite pinPin 5Pin 4
Timer 1 (16-bit)Phase correct PWMPhase correct PWM
Timer1A analogWrite pinPin 9Pin 11
Timer1B analogWrite pinPin 10Pin 12
Timer 2 (8-bit)Phase correct PWMPhase correct PWM
Timer2A analogWrite pinPin 11Pin 10
Timer2B analogWrite pinPin 3Pin 9
Timer 3 (16-bit)N/APhase correct PWM
Timer3A analogWrite pinPin 5
Timer3B analogWrite pinPin 2
Timer3C analogWrite pinPin 3
Timer 4 (16-bit)N/APhase correct PWM
Timer4A analogWrite pinPin 6
Timer4A analogWrite pinPin 7
Timer4A analogWrite pinPin 8
Timer 5 (16-bit)N/A
Timer5A analogWrite pinPin 46
Timer5A analogWrite pinPin 45
Timer5A analogWrite pinPin 5


Note that the Arduino column is for the ATmega 168/323, and the Mega column is for the ATmega 1280/2560.
Cover of Arduino Cookbook
Learn more about this topic from Arduino Cookbook. 

Create your own robots, toys, remote controllers, alarms, detectors, and many other projects with the Arduino device. This simple microcontroller board lets artists and designers build a variety of amazing objects and prototypes that interact with the physical world. With this book, you can dive right in and experiment with more than a hundred tips and techniques, no matter what your skill level is. You'll find the examples and advice you need to begin, expand, and enhance your projects right away.

Learn More Read Now on Safari


Tags:
0 Subscribe


0 Replies