Skip to content

Hardware Usage Mega

yshen-1 edited this page Feb 12, 2018 · 15 revisions

This document maps the hardware usage on the Arduino Mega which interfaces with the RC receiver, signal lights, brakes, steering, and battery monitor.

For more hardware details, see the ATmega 2560 Datasheet and the Arduino Mega schematic.

RC Channels

Channel Purpose Notes
1 Steering
2
3
4
5 Auton Switch
6 Brake Switch

Pins

Pin Number Pin Name / Alt. Capability Arduino Direction Purpose
1 PG5 ( OC0B ) D4 (PWM)
2 PE0 ( RXD0/PCINT8 ) D0 (RX0) In RBSM
3 PE1 ( TXD0 ) D1 (TX0) Out RBSM
4 PE2 ( XCK0/AIN0 )
5 PE3 ( OC3A/AIN1 ) D5 (PWM) Out Brake Indicator Light (LED Green)
6 PE4 ( OC3B/INT4 ) D2 (PWM) In Steering RC Pulse
7 PE5 ( OC3C/INT5 ) D3 (PWM) LED Blue
8 PE6 ( T3/INT6 )
9 PE7 ( CLKO/ICP3/INT7 )
10 VCC VCC N/A Power
11 GND GND N/A Power
12 PH0 ( RXD2 ) D17 (RX2) In Debug Serial
13 PH1 ( TXD2 ) D16 (TX2) Out Debug Serial
14 PH2 ( XCK2 )
15 PH3 ( OC4A ) D6 (PWM) Steering Center
16 PH4 ( OC4B ) D7 (PWM) Backup (5V, Servo Enable)
17 PH5 ( OC4C ) D8 (PWM) Out Brake Solenoid
18 PH6 ( OC2B ) D9 (PWM) LED RED
19 PB0 ( SS/PCINT0 ) D53 (SS)
20 PB1 ( SCK/PCINT1 ) D52 (SCK)
21 PB2 ( MOSI/PCINT2 ) D51 (MOSI)
22 PB3 ( MISO/PCINT3 ) D50 (MISO)
23 PB4 ( OC2A/PCINT4 ) D10 (PWM) Steering Encoder A
24 PB5 ( OC1A/PCINT5 ) D11 (PWM) Out Steering Servo
25 PB6 ( OC1B/PCINT6 ) D12 (PWM) Out Steering Encoder B
26 PB7 ( OC0A/OC1C/PCINT7 ) D13 (PWM) Out Debug IO
27 PH7 ( T4 )
28 PG3 ( TOSC2 )
29 PG4 ( TOSC1 )
30 RESET RESET In Reset
31 VCC VCC N/A Power
32 GND GND N/A Power
33 XTAL2 XTAL2 In Crystal
34 XTAL1 XTAL1 In Crystal
35 PL0 ( ICP4 ) D49
36 PL1 ( ICP5 ) D48
37 PL2 ( T5 ) D47
38 PL3 ( OC5A ) D46 (PWM)
39 PL4 ( OC5B ) D45 (PWM)
40 PL5 ( OC5C ) D44 (PWM)
41 PL6 D43
42 PL7 D42
43 PD0 ( SCL/INT0 ) D21 (SCL) In Brake RC Pulse
44 PD1 ( SDA/INT1 ) D20 (SDA) In Auton RC Pulse
45 PD2 ( RXDI/INT2 ) D19 (RX1) In Wheel Encoder
46 PD3 ( TXD1/INT3 ) D18 (TX1) Backup (12V)
47 PD4 ( ICP1 )
48 PD5 ( XCK1 )
49 PD6 ( T1 )
50 PD7 ( T0 ) D38
51 PG0 ( WR ) D41
52 PG1 ( RD ) D40
53 PC0 ( A8 ) D37
54 PC1 ( A9 ) D36
55 PC2 ( A10 ) D35
56 PC3 ( A11 ) D34
57 PC4 ( A12 ) D33
58 PC5 ( A13 ) D32
59 PC6 ( A14 ) D31
60 PC7 ( A15 ) D30
61 VCC VCC
62 GND GND
63 PJ0 ( RXD3/PCINT9 ) D15 (RX3)
64 PJ1 ( TXD3/PCINT10 ) D14 (TX3)
65 PJ2 ( XCK3/PCINT11 )
66 PJ3 ( PCINT12 )
67 PJ4 ( PCINT13 )
68 PJ5 ( PCINT14 )
69 PJ6 ( PCINT 15 )
70 PG2 ( ALE ) D39
71 PA7 ( AD7 ) D29
72 PA6 ( AD6 ) D28
73 PA5 ( AD5 ) D27
74 PA4 ( AD4 ) D26
75 PA3 ( AD3 ) D25
76 PA2 ( AD2 ) D24
77 PA1 ( AD1 ) D23
78 PA0 ( AD0 ) D22
79 PJ7
80 VCC VCC N/A Power
81 GND GND N/A Power
82 PK7 ( ADC15/PCINT23 ) A15
83 PK6 ( ADC14/PCINT22 ) A14
84 PK5 ( ADC13/PCINT21 ) A13
85 PK4 ( ADC12/PCINT20 ) A12
86 PK3 ( ADC11/PCINT19 ) A11
87 PK2 ( ADC10/PCINT18 ) A10
88 PK1 ( ADC9/PCINT17 ) A9
89 PK0 ( ADC8/PCINT16 ) A8
90 PF7 ( ADC7 ) A7 TDI (JTAG)
91 PF6 ( ADC6 ) A6 TDO (JTAG)
92 PF5 ( ADC5/TMS ) A5 TMS (JTAG)
93 PF4 ( ADC4/TMK ) A4 TCK (JTAG)
94 PF3 ( ADC3 ) A3
95 PF2 ( ADC2 ) A2
96 PF1 ( ADC1 ) A1
97 PF0 ( ADC0 ) A0 In Battery Voltage ADC
98 AREF AREF
99 GND GND N/A Power
100 AVCC VCC N/A Power

Timers

Timer Size Alt. Capability Used? Purpose
TIMER0 8 bit PWM Yes System Timer
TIMER1 16 bit PWM / IC Yes Servo PWM
TIMER2 8 bit PWM / Async
TIMER3 16 bit PWM / IC Yes RC Input Capture
TIMER4 16 bit PWM / IC Yes RC Input Capture
TIMER5 16 bit PWM / IC Yes RC Input Capture