This is only a preview of the December 2018 issue of Silicon Chip. You can view 37 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "An incredibly sensitive Magnetometer to build":
Items relevant to "Amazing light display from our LED Christmas tree...":
Articles in this series:
Items relevant to "A Useless Box":
Items relevant to "El cheapo modules, part 21: stamp-sized audio player":
Items relevant to "Low voltage DC Motor and Pump Controller (Part 2)":
Purchase a printed copy of this issue for $10.00. |
The Mega and Nano
The Arduino Uno is probably the most widely used micro in the world.
We’ve used it in quite a few of our projects. But you may not be aware
of its “little brother”, the Nano, or its “big brother”, the Mega 2560. Jim
Rowe explains the differences between these Arduino variants.
I
n this article, we’ll describe the latest “Revision 3” versions of all three
modules. We won’t mention the earlier versions or other variants like the
Leonardo or Duemilanove.
That’s partly because those other
variants are less popular nowadays
than the three modules discussed
here. Let’s start with the Nano, which
is smaller than and slightly cheaper
than the Uno.
The photos show just how tiny it is,
measuring only 45 x 18 x 18mm. Despite its small size, most of its capabilities are identical to those of the Uno.
In one respect, it’s actually better, offering eight analog-to-digital converter
(ADC) input channels instead of six.
It uses the same CPU as the Uno,
an ATmega328P but it has the 32-lead
TQFP (SMD) package version rather
than the 28-pin DIP version used in
the Uno. Two of those extra pins are
the additional analog inputs.
Like the Uno, it has 32kB of flash
memory, 1kB of EEPROM and 2kB of
static RAM, a RISC instruction set including two-cycle 8x8 multiplication,
23 programmable I/O lines, 32 8-bit
44
Silicon Chip
working registers, two 8-bit timer/
counters and one 16-bit timer/counter
(with prescalers), a master/slave SPI
serial interface and a byte-orientated
I2C interface.
But keep in mind that the Nano’s
small size means that its I/O pins are
broken out to two 15-pin SIL connectors. As a result, it’s not directly compatible with Arduino shields designed
to plug into the Uno. It also lacks the
Uno’s concentric DC power input socket and instead, receives its power via
the mini-USB socket.
There are adaptor shield modules
available for the Nano but it’s best regarded as the Arduino most suitable
for mounting directly on another PCB.
That’s the way we used it in our Brainwave Monitor project, described in
the August 2018 issue of Silicon Chip
(siliconchip.com.au/Article/11185).
Inside the Nano
The full circuit of the Arduino Nano
is shown in Fig.1. This circuit is for
the lower-cost Chinese-made version,
which uses a CH340G chip for the USB
interface instead of the FT232RL chip
Australia’s electronics magazine
used in the US/European version. Otherwise, the two versions are essentially
and functionally identical.
It has a 6-pin header for in-circuit
serial programming (ICSP) or SPI serial bus connections, a reset pushbutton switch (S1) and four tiny LEDs to
indicate power on, serial data transmit/receive and a general purpose/programming indication LED connected
to pin D13 (SCK). These are all identical in function with those on the Uno.
As mentioned above, all the micro’s
I/O pin connections are brought out
to pins on the two 15-pin SIL headers, J1 and J2.
So basically, the Nano can be regarded as a “Bonsai” version of the Uno (or
perhaps more appropriately “penjing”
given its Chinese origin). This, and
its more standard SIL header layout,
makes it better suited for building into
other projects.
The Mega 2560
The Mega 2560 is considerably larger than the Nano or the Uno, at 108 x
53 x 14mm. Not surprisingly, it is also
more capable.
siliconchip.com.au
Fig.1: complete circuit diagram of
the Arduino Nano. The genuine
Nano boards use a FT232RL for IC1
instead of the CH340G shown, but is
otherwise identical.
It uses an ATmega2560 micro, essentially a larger version of the ATmega328P chip used in the Uno and
Nano. It offers 256kB of flash memory
instead of 32kB, 4kB of EEPROM (vs
1kB) and 8kB of static RAM (vs 2kB).
So it has eight times as much flash
plus four times as much EEPROM and
static RAM.
Since the ATmega2560 comes in a
100-pin TQFP (SMD) package, it also
has many more programmable I/O
pins; 86 compared with 23. It also has
16 ADC inputs, compared with six for
the Uno and eight for the Nano.
Significantly, there’s now also a total of four programmable USART serial I/O ports, compared with the single port on the Uno and Nano. Other
siliconchip.com.au
features include four 16-bit timer/
counters instead of just one in the
Uno/Nano.
The ATmega2560 also has a slightly larger set of instructions: 135 compared with the 131 offered on the Uno
or Nano.
Three of the instructions are used to
access and manipulate the extra flash
memory of the ATmega2560. These instructions are EIJMP (extended indirect jump), EICALL (extended indirect
call), ELPM (extended lead program
memory). The last additional instruction (BREAK) is for use with the onchip debugger (JTAG).
But there’s still the on-chip twocycle multiplier, the same set of 32
eight-bit working registers, a master/
Australia’s electronics magazine
slave SPI serial interface and a byteorientated I2C interface.
So the main advantages of the Mega
2560 are the larger memories, the
much larger number of programmable I/O pins and of course the three
additional programmable USART serial I/O ports.
One interesting point to note about
the Mega 2560 is that it’s designed to
be compatible with Uno shield boards.
In effect, all of the extra analog and
digital I/O capabilities are added to
the right-hand end, as you can see
from the photo opposite.
This means that standard Uno
shields can be plugged into the sockets on the left-hand end of the PCB and
they will work normally.
December 2018 45
Fig.2: complete circuit diagram of the Arduino Mega 2560. The
ATmega16U2 (IC2) is used to handle USB communications.
The 6-pin ICSP/SPI header (just to
the right of the main CPU) is also in
exactly the right position to mate with
the socket on Uno shields.
The Mega’s additional USART port
connections are brought out to an extra
8-pin SIL socket at upper right, with the
I2C SDA and SCL pins at the far end.
The analog input connections are
brought out to another two 8-pin SIL
sockets along the bottom right, with
one of these sockets effectively replacing the 6-pin socket of the Uno.
The additional digital I/O connections
are brought out to an 18x2 DIL socket
mounted vertically on the far right of
the PCB.
46
Silicon Chip
So it’s all quite logical and fairly
easy to follow, as well as being almost
100% compatible with the Uno and
shields intended for use with it.
There are also expansion shields
available specifically for use with the
Mega 2560, which take advantage of
its extra capabilities. Banggood has
such a prototyping shield available for
around $6.00, together with a small (17
x 10) breadboard.
Inside the Mega 2560
The full circuit of the Mega 2560 is
shown in Fig.2. We’ve redrawn it from
the official circuit diagrams because
we found these a little hard to follow
Australia’s electronics magazine
in terms of signal flow.
As with most Uno boards, the Mega
2560 uses a separate ATmega16U2 processor to handle USB communications.
This is IC2, shown on the left-hand side
of Fig.2, with the main ATmega2560
(IC1) over on the right-hand side. All
of the circuitry on the left associated
with IC2 is virtually the same as that
of the Uno and that’s also true of the
power supply circuitry at lower left.
As with the Uno, the Mega 2560 can
be powered either via the USB connector (CON2) at upper left or via the
nominal 9V DC input connector CON1,
at lower left. And the circuitry associated with IC7b, Q1 and REG1 performs
siliconchip.com.au
automatic switching between these
power inputs.
Note also that the Mega 2560, like
the Uno, provides a second 6-pin ICSP/
SPI header for IC2, so that it can be
siliconchip.com.au
reprogrammed if necessary. This additional header is marked as ICSP1 in
Fig.2, whereas the ICSP/SPI header for
the main processor is over on the far
right and marked ICSP2.
Australia’s electronics magazine
As with both the Uno and the Nano,
the Mega 2560 has four indicator LEDs.
LED1 and LED2 are connected to pins
11 and 10 of IC2 and show activity on
the TXD and RXD lines used for communicating with the host processor.
LED3 shows when the module is
powered up, while LED4 is driven
via IC7a from the PB7/IO13 pin of
main processor IC1, to allow it to be
turned on or off by program control.
This is precisely the same as on the
Uno or Nano.
Over on the right-hand side of Fig.2,
you can see how all of the additional
December 2018 47
Shown above are the main differences between the Arduino Nano, Uno and
Mega. The prices shown are from https://store.arduino.cc, however, the modules
can be found cheaper elsewhere online
Below: the three Arduino boards shown at close to actual size for comparison.
While the Arduino Mega is directly compatible with the Arduino Uno, the
Nano uses a different pin layout and structure, even though its performance
specifications are identical.
I/O connections of the ATmega2560
(IC1) are brought out to the various
SIL sockets and the 18x2 DIL socket.
The two 8-pin SIL sockets for the
expanded range of ADC inputs are
shown at lower left, with the 8-pin
socket above them for I2C and the RX
and TX lines for the three additional
USART ports (RX1-TX3).
Then above these again there’s the
fourth 8-pin SIL socket and the 10-pin
socket, which basically duplicate the
functions of the same socket on the
Uno: RX0 and TX0, followed by IO215 and then GND, AREF, SDA and SCL.
To the right-hand side of IC1, in addition to its ICSP/SPI header (ICSP2)
there is the 18x2 DIL socket for the ATmega2560’s extra digital I/O pins, plus
two pins carrying the +5V supply line
(pins 1 and 2), and another two pins to
the module’s ground (pins 35 and 36).
So as you can see, the Arduino Mega
2560 is very much an expanded version of the Uno. It has very similar
processing power but with considerably more memory, three additional
USART ports, 10 additional ADC inputs and more than 60 extra digital I/O
lines. It is software compatible with
both the Uno and the Nano.
These features allow it to run much
larger sketches and control more peripheral devices. It’s the Arduino
you’ll probably need for applications
that are too large for the Uno or Nano.
It does cost about twice that of the
Uno but it’s still quite good value for
money when you consider what it offers.
The comparison table above summarises the features of the three Arduino versions we’ve discussed here.
At the bottom of the table, it shows
comparative price ranges for the three
versions but these will vary depending on exchange rates, vendors and
other factors.
Finally, note that Microchip recently purchased their rival Atmel, the
manufacturer of the ATmega chips
used in these boards; hence the links
below to the product pages refer to the
Microchip website.
Handy links
store.arduino.cc/arduino-nano
store.arduino.cc/arduino-mega2560-rev3
microchip.com/atmega328pb
microchip.com/ATmega2560
banggood.com/search/mega2560SC
1280-proto-shield.html
48
Silicon Chip
Australia’s electronics magazine
siliconchip.com.au
|