0% found this document useful (0 votes)
11 views10 pages

Arduino uno

Uploaded by

Parth Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
11 views10 pages

Arduino uno

Uploaded by

Parth Singh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 10

ARDUINO UNO

Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins
(of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB
connection, a power jack, an ICSP header and a reset button. It contains everything needed to support
the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC
adapter or battery to get started.

Different Types Of Arduino Boards

The list of Arduino boards includes the following such as

 Arduino Uno (R3)


 Arduino Nano
 Arduino Micro
 Arduino Due
 LilyPad Arduino Board
 Arduino Bluetooth
 Arduino Diecimila
 RedBoard Arduino Board
 Arduino Mega (R3) Board
 Arduino Leonardo Board
 Arduino Robot
 Arduino Esplora
 Arduino Pro Mic
 Arduino Ethernet
 Arduino Zero

Fastest Arduino Board


ARDUINO UNO

The Arduino Uno is a popular microcontroller board based on the ATmega328P. Here’s a
breakdown of its pins and their functions:

1. Digital I/O Pins (0-13)

 Pin 0 (RX): Receive pin for serial communication.


 Pin 1 (TX): Transmit pin for serial communication.
 Pin 2 to 7: General-purpose digital input/output pins.
 Pin 8 to 13: More digital I/O pins; Pins 9, 10, 11, and 12 can also be used as PWM
(Pulse Width Modulation) outputs.

2. Analog Input Pins (A0-A5)

 A0 to A5: These are used to read analog signals (voltages) and convert them to digital
values. They can also be used as digital I/O pins if needed.

3. Power Pins

 3.3V: Provides 3.3V regulated power.


 5V: Provides 5V regulated power.
 GND: Ground pins; there are multiple ground pins available.
 Vin: Input voltage; this is where you connect an external power supply (typically 7-
12V) if you're not using USB power.

4. Reset Pin

 RESET: This pin is used to reset the microcontroller. Pulling this pin low will reset
the board.

5. Analog Reference (AREF)

 AREF: Used to set an external reference voltage for the analog-to-digital converter.
By default, the reference voltage is the same as the operating voltage (5V or 3.3V).

6. External Interrupt Pins

 Pin 2 and Pin 3: These can be used for external interrupts. This means they can
trigger interrupts (like on a button press) to execute certain code.

7. PWM Pins

 Pins 3, 5, 6, 9, 10, and 11: These pins can output PWM signals. PWM is used to
simulate analog output by varying the duty cycle of the digital signal.

8. ICSP Header

 ICSP (In-Circuit Serial Programming): This 6-pin header is used for programming
the ATmega328P directly. It’s also used for firmware updates and other low-level
programming.

9. Serial Communication Pins

 RX (Pin 0) and TX (Pin 1): These pins are used for serial communication (UART).
RX is for receiving data, and TX is for transmitting data.

10. Crystal Oscillator

 16 MHz Crystal: This crystal oscillator helps keep the timing accurate for the
microcontroller.

11. USB Connection

 USB Port: Used for powering the board and uploading sketches. It connects to a
computer via a standard USB cable.
Here's a quick summary of the pin labels and their typical uses:

 Digital I/O Pins (0-13): General-purpose input/output.


 Analog Input Pins (A0-A5): Read analog sensors.
 Power Pins: Supply power and ground.
 RESET: Reset the board.
 AREF: Set an external analog reference voltage.
 External Interrupt Pins (2 and 3): Trigger interrupts.
 PWM Pins (3, 5, 6, 9, 10, 11): Simulate analog output.
 ICSP Header: For low-level programming.

This pinout layout allows the Arduino Uno to interface with a wide variety of sensors,
actuators, and communication protocols, making it a versatile tool for electronics and
programming projects.

Arduino IDE
The Arduino IDE is an open-source software, which is used to write and upload code to the
Arduino boards. The IDE application is suitable for different operating systems such
as Windows, Mac OS X, and Linux. It supports the programming languages C and C++.
Here, IDE stands for Integrated Development Environment.

The program or code written in the Arduino IDE is often called as sketching. We need to
connect the Genuino and Arduino board with the IDE to upload the sketch written in the
Arduino IDE software. The sketch is saved with the extension '.ino.'
Toolbar Button
The icons displayed on the toolbar are New, Open, Save, Upload, and Verify.

It is shown below:

How to select Board?


1. Find the board selector and click to open.
2. A list of ports will be displayed. If a board could be identified, the board name will be
displayed, otherwise, it will display “Unknown”.
3. Click on a port to select it:
 If a board was identified, it will automatically be selected. The selected board
name will be displayed. The “ ” indicates that a port is selected.

 If it is unknown, the “Select Other board and port” dialog will open.
See Manually select a board.
 If the board could be identified, but you are missing the board platform, you
may be asked to install it:
 Select Yes to automatically install the board package in the
background.
 Select Install manually to view the package in the Board Manager.
To learn more about installing boards, see Add a board to Arduino IDE

Manually select a board

In some cases you may want to individually control the port and board selection:
 Select a board that isn’t connected to your computer (you can still write and verify
sketches).
 The board cannot be automatically identified.
 The board associated with the port is incorrect.

Follow these steps:


1. Open the board selector and select Select other board and port.

2. Make your selections:


 Boards: Type in the text field to filter and scroll in list. Click on a board to
select it.
 Ports: Select a port (optional).
3. Click OK to save the changes and close the dialog.

Using the Tools menu

The menu bar can be used to perform many actions, including board and port selection.
Arduino Code
Time to dive into the code

🤓 For this tutorial we are going to use off the shelf example code. In the op
menu of the Arduino IDE you can choose:
 File ▸ Examples ▸ 01. Basics ▸ Blink

The IDE should open the code to blink the built-in LED automatically. Take
some time to read the code before you continue. Are you able to figure what
each line does?

1 // the setup function runs once when you press reset


2 // or power the board
3 void setup() {
4 // initialize digital pin LED_BUILTIN as an output.
5 pinMode(LED_BUILTIN, OUTPUT);
6}
7
8 // the loop function runs over and over again forever
9 void loop() {
10 digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
11 delay(1000); // wait for a second
12 digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
13 delay(1000); // wait for a second
14 }
In the code you see all kinds of commands. These commands are written in a
syntax that the computer understands. Misplacing a dot or comma could
result in the computer being unreadable to read your code
Comments in the code

Line 1, 2 and 8 start with two slashes //. This line of code is what we
call comment. Comments allow you to provide human readable additional
information which is completely ignored by the computer. Another form of
comment starts with /* and ends with */. Everything between the start and end
will be seen as part of the comment e.g.:
1 /*
2 This is comment
3 over
4 multiple lines
5 */
You can use this syntax for a single line comments as well:

1 /* This is a single line comment */

The setup() function

The code has been split into two parts: setup and loop.

When the program starts it executes the setup() function once. After this the
program continues with the loop(). The setup() is for example used to assign
pins.

In this example we are using the pinMode function to specify we want to use
the LED_BUILTIN pin as a OUTPUT. On the Arduino UNO, LED_BUILTIN is
an alias for 13 (the builtin LED pin). Therefore you could have typed 13 as
well. The advantage of using LED_BUILTIN is that it works on all Arduinos.
Even when the builtin LED is connected to another pin.
The loop() function

After the setup(), the program continues with the loop(). This function will be
called over and over again. Every time the function has finished, it will be
called again. The only way to stop the program is to disconnect the power or
to upload a new program.

If you look closely at the code you see two other functions being
called: digitalWrite() and delay(). digitalWrite() writes the value (LOW or HIGH)
specified to a given pin. The pin we are using is specified by the function's
first parameter, in our case LED_BUILTIN. The second parameter specifies
the written value, here HIGH. digitalWrite() in this case, makes sure that the
LED on pin 13 will be lit.

The next line shows the delay() function with a single parameter. Can you
think about what the value of this parameter represents?
Its value is the amount milliseconds the program has to wait. In our case this
is 1000 milliseconds, which is the equivalent of 1 second.

After this brief pause, the program continues and writes LOW to
the LED_BUILTIN pin. As a result the LED goes off.

Uploading code to the Arduino

Now our program is ready to upload to the Arduino. First we have to connect
our Arduino to the computer with the USB cable. Make sure you've selected
the correct board in the IDE:

 Tools ▸ Board ▸ Arduino/Genuino UNO

And the correct port:

 Tools ▸ Port

If you are not sure which port to use, try them all until you can successfully
upload your code.

The top left shows a round button with a checkmark. By pressing this button
you tell the IDE to verify your code for possible errors. The IDE only checks
if it can read your code. It does not check if you have written correct code for
what you are trying to program.

If everything works the IDE shows the Compiling completed message. You can
now upload your code by pressing the round button with the arrow to the
right. The uploading is complete when the Avrdude done. Thank you. messages
appears. Your program will immediately start after uploading. As a result you
should now see your Arduino LED blink with 1000ms intervals.

You might also like