Note: There are FIVE features you may not have heard about.
The comparator module.
Timer 2 asynchronous input.
Timer 1: 32kHz crystal clock.
Internal oscillator.
More than Two external interrupt pins.
Arduino Uno Board
Arduino Uno Specs: Arduino Internals
Parameter
Value
Microcontroller
ATmega328P
USB Voltage Supply (VDD)
5V0 [1]
External power (Vin/power jack)
7V ~ 12V
Connector
USB-B
Clock
16MHz
Mips
16MIPS
Flash (~0.5k for bootloader)
31.5kByte
SRAM
2kByte
EEPROM
1kByte
Total I/O pins
20 18 [2]
Digital I/O only pins
14 12 [2][3]
Analogue pins (also digital I/O)
6 [3]
Digital I/O pins PWM capable
6 [3]
Timers - 8 bit (T0, T2)
2 [4]
Timers - 16 bit (T1)
1
USART (i.e. RS232) for USB
1 USART [5]
I2C
1 I2C
SPI
1 SPI
ADC
10 bit SAR
Analogue Comparator
1
Current per pin (Abs. max)
40mA [6]
Total Current (Abs. max) ATMega328p
200mA [6]
Temperature range
-40ºC ~ 85ºC[7]
[1] All pins except the reset pin which can withstand 13V for
High-Volt-Programming.
[2] 2 digital I/O are dedicated to the USB interface.
[3] I/O pins are
multi-functional. Analogue & PWM pins are also digital capable pins.
[4] Timer 2 can accept an asynchronous input signal, and can use a 32kHz crystal.
[5] The USART is dedicated to communication over the USB interface (pins 0 &1).
[6] ATmega328p datasheet chapter 29 electrical Characteristics.
[7] This is for the ATMega328p and not necessarily for the whole board!
Arduino Uno Specs : Memory
The Arduino Uno has three types of memory.
Flash
SRAM
EEPROM
Flash is the memory that permanently stores your programs i.e. it retains information when the power is off. It is also
erasable which gives you the ability change its contents i.e. you can
download your programs into Flash just by re-writing the Flash (all done
for you in the Arduino IDE).
About 0.5k of the flash is dedicated to the bootloader operation
which allows the Arduino IDE to upload programs the Arduino Uno. So you
lose a small amount of Flash for the convenience of push button Flash
programming.
Note: ~0.5k of the Flash is used for the bootloader for USB communications
SRAM is Static Random Access Memory. This is where all your
variables are stored i.e. when you need a counter, its value must
change over time - this is the memory that is used. When you power off
the Arduino Uno the values store are lost.
EEPROM is Electrically Erasable Programmable Read Only Memory. This
is a bridge between the Flash and the SRAM. You can update EEPROM and
when powered off the values are retained. The difference between Flash
and EEPROM is that while both wear out over time, EEPROM lasts far
longer. EEPROM is used for storing information that may change, but not
often, and is used to setup a system e.g. calibration values or current
colour etc.
The Arduino Uno has 20 I/O pins but on the board but only 18 are
available as 2 are used for the USB interface. You can see that there
are 14 digital I/O labelled P0 to P13. There are also 6 analogue pins
labelled A0 to A5. Together these make up the 20 I/O pins.
Sometimes there is confusion when an analogue pin is used as a digital
I/O pin, but the analogue pins are all capable of being used as digital
pins as well as analogue inputs. So in fact there are:
20 18 digital I/O pins (when A0 ~ A5 are used as digital I/O).
You can use only 18 digital I/O as pins 0 and 1 Serial Tx and Rx are dedicated to the USB serial communications interface.
Warning: pins 0 and 1 can not be used - they are dedicated to USB.
When you want to use a PWM output pin, there are 6 available, then you
need to use one of the 12 digital I/O and use it as a PWM output. On the
Arduino board the pins that can be used as PWM are labelled '~'.
If you used each pin as assigned to its unique function then you end up with
Digital I/O
14 (2 out of 8 are dedicated for Rx & Tx for USB)
Of these 6 of them can be used as PWM.
ADC input
6 (these can be set to digital I/O as well but labelled A0-A5)
Total
18 (should be 20 but 2 are used for Rx,Tx)
It's up to you to choose how you use these pins as they are multi functional.
Also don't forget that some pins have even more underlying functions. Some major functions are:
I2C interface: A4 and A5 are used as SDA and SCL.
SPI interface: 13, 12, 11, 10 are used as SCK, MISO, MOSI, SS.
Tx and Rx: Serial communications to USB pins 0 and 1.
You can't really use the Tx and Rx pins for anything else as they are
connected to the other chip on the Arduino board (ATMega16U) which
handles the USB interface and allows the ATmrega328p to be programmed via the USB cable.
If you really need an SPI interface or I2C interface but can not use
the dedicated pins then you can use a software version for each that can
be used on any digital pins. Of course operation will be slower as it
does not use the dedicated internal hardware.
Note: For I2C and SPI you can use bit-banged software on other pins.
Also don't forget pin 13 is attached via a resistor to an LED.
Warning: Pin 13 is connected to the on board LED (LED_BUILTIN).
Arduino Uno Specs :
Power Supplies
USB Power (5V) Supply
The Arduino Uno requires a 5V supply which allows a high frequency of operation - 16MHz - (See Supply voltage de-rating in this page).
There are three voltage sources for the Arduino
USB power
Power Jack DC voltage
Vin
In all cases the aim is to get a 5V supply running on the board.
You can supply the on board 5V regulator from either the power jack
or the Vin pin and in both cases the voltage range should be: 7V ~
12V.
When you use a USB connection (with no voltage at Vin) then the USB
5V supply is used directly on the board i.e. it's completely powered via the USB
interface.
You can either power the Arduino Uno through the USB interface via
the USB-B connector or supply your own voltage to Vin. You can also
apply Vin while still using the USB interface (Vin/power jack overrides the USB
voltage - a diode disables the USB voltage).
USB Power (5V) Advantage
When you use the USB interface as a power source it is super
convenient since you don't have to have an external power source. This
is the best way to start using the Arduino Uno as it is the simplest -
all you need is a PC, a USB and the Arduino board - then you can start
programming!
USB Power (5V) Disadvantages
Voltage level
The disadvantage in using the USB as a power source is that the
voltage can be a little low (especially when using a cheap powered hub
which won't have a great specification). It means, if you make
measurements with the ADC the accuracy won't be good. If you change the USB port in use you could also get a different reading!
Current available
The current available from the USB interface is limited to a maximum
of 500mA (USB spec). In rare cases you might want more current e.g.
driving power hungry shields, and it this case apply 7V to the Vin input
of the board. When you do this the internal 5V regulator is activated
and can supply more current.
TIP: Apply 7V to Vin to activate the internal 5V regulator for more current.
You can apply from 7V to 12V to the Vin/power jack input, but as your current usage goes
up, so does the power dissipated in the 5V regulator. That means the
regulator could heat up too much so to stop that, reduce the Vin voltage
to the minimum (7V) and reduce the current used by your circuits.
Note: The internal regulator gives a more accurate 5V output than USB hub.
The other reason for using Vin is to get a more accurate 5V voltage. You
might want to use an external voltage applied to Vin as the internal
regulator specification will be better than the USB voltage spec, so you
can make
better measurements using the ADC.
Arduino Uno Specs : Output Voltages
As already discussed, the Arduino Uno requires a 5V voltage supply
which is usually provided by the USB port directly. You can use this
voltage to power your projects from the 5V pin.
If you power the board from 7V ~ 12V (Vin or power jack) then you
activate the internal 5V voltage regulator (so you can plug in a wall
brick for power and allow the Arduino Uno to be standalone without
needing the USB connection).
Also on board is another regulator: The 3V3 regulator that you can
use specifically for connected chips that can only use up to 3.3Volts.
However be careful of level translation between the 5V arduino Uno and
the attached device. You may need level translation FETs (or a board with these FETs and resistors on between the chip and the Uno).
Arduino Uno Specs : ADC
The Arduino ADC is a 10 bit successive approximation analogue to digital converter. It will make a reading in 104us.
There are 6 pins that you can use as analogue inputs - each one is
read using a multiplexer to direct the analogue signal at the
pin to the input of the ADC module.
Note: When using I2C, pins A4 and A5 are used as SDA and SCL.
You usually setup the ADC to use the main power supply as a voltage
reference (5V) but you can feed in your own reference to the AREF pin.
This is especially useful if you need to get accurate analogue readings
as you can feed in a reference of known accuracy (whereas the main power
supply may vary - making your reading inaccurate).
Alternatively, you can use the internal 1V1 bandgap reference to get a better
reading, but the initial accuracy of this module is 10%. You can find
out how to calibrate it here for far higher initial accuracy.
Arduino ADC oversampling
There is a very special technique using oversampling and averaging
that allows you to increase the effective number of ADC bits. The
advantage is that you get more ADC bits for free, while the disadvantage
is that it takes more time to get a reading.
Arduino Uno Specs : Timers / PWM
There are three timers in the Arduino Uno and they also generate PWM signals. Here are nine things you need to know about Arduino Uno/Nano PWM pins.
Timers 0 and 2 are 8 bits long, while Timer 1 is 16 bits long. The
longer timer can therefore count higher or can be thought of as having a
higher PWM resolution.
The timers within the Arduino Uno (actually the ATMega328P) are
actually complex counters that can count up or down. They also have
associated comparison registers that activate when a specific timer
value is reached. This allows generation of PWM signals using the timer
output.
Each timer can have two PWM outputs since there are two comparison
registers per timer. These are labeled "Output Compare <timer
number> <A|B>.
So the two PWM outputs for timer 0 are:
OC0A - A PWM output using Timer 0
OC0B - A PWM output using Timer 0
Since there are three timers we also have
OC1A - A PWM output using Timer 1
OC1B - A PWM output using Timer 1
OC2A - A PWM output using Timer 2
OC2B - A PWM output using Timer 2
So we have a total of 6 PWM outputs as expected (when looking at the Arduino pinout).
TIP: To activate a PWM output use the Arduino analogWrite function.
The Arduino analogWrite
function sets up a PWM signal which is a digital signal with varying MS
ratio. By filtering the output with a capacitor you can obtain a
continuously variable analogue output voltage (0V to 5V).
You can only use the dedicated PWM pins (3, 5, 6, 9, 10, 11 ) for
analogWrite since these are the dedicated timer compare outputs as
described above.
One small but interesting piece of information is that all timer
frequencies for PWM are 490Hz except for those associated with timer 0
which use a frequency of 980Hz.
The reason is that Timer 0 has an extra function in the Arduino
architecture and that is to actually measure time. The functions millis() and delay() require a timekeeping ability accurate to 1ms and 1.0/980 = 1.0204ms - which is approximately 1ms.
Asynchronous Timer 2
Another under used feature is the asynchronous input of Timer 2. This
bypasses the internal stabilisation circuitry that other inputs use
(hence the term asynchronous). It sounds like a bad idea but is actually
very useful.
Since goes through a prescaler on the input it can be used to measure (or count) very high
frequency signals.
The Timer 2 prescaler block is a 10 bit counter so the input frequency can be divided down by a maximum of pow(2,10) = 1024.
Note: You can use the asynchronous Timer 2 counter in sleep mode.
The circuitry of the asynchronous counter/Timer 2 input is not shut down
during sleep so you can still count/time even while the chip is in shut
down.
The device can wake up from a timer overflow or output compare which means the chip can count while asleep!
External 32kHz crystal on Timer 2
If you connect a 32kHz crystal across the TOSC1 and TOSC2 pins (with
two suitable load capacitors) then you can have an accurate clock watch
type real time clock operation.
Instead of buying a DS1307 real time clock you can implement the same functionality simply by writing a bit of code!
Arduino Uno Specs : Internal oscillator
The Arduino Uno has an internal RC oscillator (8MHz) calibrated to ±10%.
You can calibrate this to ±1% yourself since there are adjustment
registers in the chip.
It means you could create projects without an external crystal saving some pins for stand alone operation.
Arduino Uno Specs : I2C
The I2C interface
is one of the most useful interfaces because many chips employ this I2C
interface
allowing connection of only two wires to multiple chips.You can add
lots of ICs without having tons of wiring and running out of
microcontroller pins.
Adding multiple I2C chips to the same 2 wires is limited by only
the capacitance added by each device. In practice this means chips on a
single PCB are fine and will work well.
Warning: Although unlikely, some chips can have the same I2C address. There are I2C bus separation chips available for this situation.
The I2C protocol allows communication in both directions between the
master controller and slave devices so you can have very complex systems
e.g. gathering data from an ADC and sending data to a display; all on
same two wires.
On the Arduino Uno the two I2C pins are A4 and A5 - these pins are
also routed to the two pins beyond pin 13 closest to the reset button.
There's no clear reason why - other than it brings all the serial
interfaces to the same side of the board i.e. SPI and UART.
Note: I2C is a multi-drop bi-directional communications bus.
On the Arduino Uno, typically the I2C interface runs at 400kHz but
you can increase this by changing the value of a clock register
associated with the I2C module - this is not often necessary and depends on your project requirements.
Arduino Uno Specs : SPI
The other, very useful interface, is the Serial Peripheral Interface
which is really just a serial input/output module that has clock and
data and select signals. Unlike the I2C interface the data lines are not
bi-directional, rather there are separate lines for data-in and
data-out.
The only similarity that SPI has to I2C is that it is a serial
interface. It is not bi-directional and is not multi-drop. The advantage
is that is far faster (10MHz c.f. 3.4MHz - I2C). However I2C is usually
used at 400kHz.
This is the main interface used to program a raw Arduino chip. You
can find out how to use an Arduino as a ICSP (In Circuit Serial
Programmer) here
[advanced]. On the Arduino Uno board there are two 6 pin headers and
these both contain an SPI signal set and they allow the on board
microcontrollers to be programmed (without a bootloader).
The 6-pin header nearest the reset button is for programming the AT
chip responsible for the USB interface while the other one programs the
bootloader into the ATMega328p - the main processor in the Arduino.
The data lines are conveniently labelled:
MISO and
MOSI.
Master In, Slave Out
and
Master Out, and Slave In.
The other important signal is the Slave Select pin, MISO and MOSI are
only active if the SS signal is active. This is the mechanism that
allows multiple SPI chips to use the same MISO and MOSI bus (each chip
will use a different SS signal - the alternative is to daisy chain).
The big advantage the SPI has over I2C is that it is far faster ~ 10MHz.
Note: SPI is fastest: 10MHz. I2C in high speed mode is 3.4MHz.
Again, like the I2C interface, there are many chips that use the SPI interface.
Arduino Uno Specs : USART
On the Arduino Uno the USART is dedicated to the USB communications
so you can't use it for anything else. However if you use an ATMega328p
in stand alone mode (i.e. not an Arduno Uno but a chip on a solderless
breadboard) you could then use the UART pins.
In this case the USART module can be configured for different numbers
of bits and can even implement a multi-processor communication system.
You can find out how to program a stand alone chip here [advanced].
Arduino Uno Specs : Comparator
The analog comparator is never talked about in Arduino projects. It
seems to be seen as a bit of a redundant, uninteresting module - maybe
it's not.
It is a high speed analogue voltage comparison system that is far
faster than using the ADC and waiting around for ~100us for a result. In
fact the comparator reaction time is 500ns [Table 30-1 datasheet
ATMega328p].
Note: The analog comparator can make a comparison in 500ns.
Additionally the inputs to the comparator can be taken from any of
the existing analogue inputs. As well as this, it can output an
interrupt for fast processor reaction to comparator events.
The analog comparison voltage is taken from pins AIN0 and AIN1 but
these can also be bypassed to take a voltage from the internal band gap
reference and also from the analog inputs.
AIN0 is on Arduino pin 6 - the same pin as OC0A (See timers above).
AIN1 is on Arduino pin 7
ACO : The raw comparator output can start an input capture on T1.
ICP1 : The processed comparator output can start an input capture on T1.
Note: Pins 6 & 7 are separate from A0~A5, so can be used with ADC pins.
Since the analogue comparator inputs are entirely separate from the
ADC pins you could switch between then to make fast comparisons while at
the same time still utilising the ADC.
So if you need to make a voltage comparison very fast, this is the module to use.
Arduino Interrupts
There are two external interrupts INT0 and INT1 but did you know
there are many more and that you can use them on virtually any pin!
They are useful if you want to make your program react instantly to an external event e.g. an emergency shut down switch.
You can also use Arduino Timer Interrupts
to create specific time period interrupts. These are a bit more
difficult to set up but they let you time actions for precisely
repeatable periods. This is useful for example for display refresh or
repeated ADC sampling.
Arduino Uno Specs : Dimensions
Arduino Uno Dimensions
Board Length : ~70mm (does not include connectors sticking out!).
Board Width : ~53mm.
Board Length with longest connector (USB) : ~75mm.
Height (board+ UBS-B):~12mm The USB-B connector is the highest component.
Board Thickness:~1mm
[ direct measurements from board in the hand : This is a clone but
should be representative; look at eagle files online for source of pcb
and hence target dimensions.]
Arduino Uno Dimensions tell you how big the board is in terms of
millimeters but you can't really tell how small it is. So here's a
picture of my dusty, trusty Arduino Uno R3 (clone) in my hand:
However, you may think it is small but I have been using a Nano for
breadboard projects for a long time because it is about a 1/4 the size
(or smaller) and has the same functionality as the Arduino Uno (and it
plugs directly into a solderless breadboard). It actually has two more
analogue pins brought out to external pins as well!
Arduino Nano Dimensions
Board Length : ~43mm (does not include connectors sticking out!).
Board Width : ~17mm.
Board Length with longest connector (USB) : ~44mm.
[ Again these are direct measurements from board in the hand ]
Here's an image showing the size of the Arduino Nano:
A PIR sensor lets your Arduino sense movement without contact. This tutorial covers PIR sensor basics, connecting one to an Arduino board and coding a motion detector.
Arduino Hall Effect Sensor: Add magnetic sensing superpowers to your Arduino projects with an easy-to-use hall effect sensor. With full code and layout...
Get started with an Arduino humidity sensor using the DHT11, which reports both humidity and temperature. Complete guide with full code for using this sensor
Comments
Have your say about what you just read! Leave me a comment in the box below.
Don’t see the comments box? Log in to your Facebook account, give Facebook consent, then return to this page and refresh it.