Você está na página 1de 4

ARDUINO - is an open-source platform used for building electronics projects.

Arduino consists of both a physical programmable


circuit board (often referred to as a microcontroller) and a piece of software, or IDE (Integrated Development Environment) that
runs on your computer, used to write and upload computer code to the physical board.
The Arduino platform has become quite popular with people just starting out with electronics, and for good reason. Unlike most
previous programmable circuit boards, the Arduino does not need a separate piece of hardware (called a programmer) in order
to load new code onto the board – you can simply use a USB cable. Additionally, the Arduino IDE uses a simplified version of C++,
making it easier to learn to program. Finally, Arduino provides a standard form factor that breaks out the functions of the micro-
controller into a more accessible package.
Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message - and turn it into an output -
activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of
instructions to the microcontroller on the board. To do so you use the Arduino programming language (based on Wiring), and the
Arduino Software (IDE), based on Processing.
Arduino is a microcontroller, or mini-computer, capable of controlling a variety of devices like LEDs, servos, etc. We use Arduino
because it’s easy to use and well documented on the internet. Having good documentation allows the beginner user to get lots of
help while learning how to use an Arduino. Another reason we like it so much is because it is scalable to the abilities of the user. It
can be very basic, but also very advanced. It can do something as simple as make an LED blink and as advanced as operate a 3D
printer. You can add sensors, attach a Bluetooth module, really the possibilities are endless!

HISTORY
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping, aimed at students without a
background in electronics and programming. As soon as it reached a wider community, the Arduino board started changing to
adapt to new needs and challenges, differentiating its offer from simple 8-bit boards to products for IoT applications, wearable,
3D printing, and embedded environments. All Arduino boards are completely open-source, empowering users to build them
independently and eventually adapt them to their particular needs. The software, too, is open-source, and it is growing through
the contributions of users worldwide.
In 2005, building upon the work of Hernando Barragán (creator of Wiring), Massimo Banzi and David Cuartielles created Arduino,
an easy-to-use programmable device for interactive art design projects, at the Interaction Design Institute Ivrea in Ivrea, Italy.
David Mellis developed the Arduino software, which was based on Wiring. Before long, Gianluca Martino and Tom Igoe joined the
project, and the five are known as the original founders of Arduino. They wanted a device that was simple, easy to connect to
various things (such as relays, motors, and sensors), and easy to program. It also needed to be inexpensive, as students and
artists aren’t known for having lots of spare cash.
They selected the AVR family of 8-bit microcontroller (MCU or µC) devices from Atmel and designed a self-contained circuit board
with easy-to-use connections, wrote bootloader firmware for the microcontroller, and packaged it all into a simple integrated
development environment (IDE) that used programs called “sketches.” The result was the Arduino.
Since then the Arduino has grown in several different directions, with some versions.
PARTS OF ARDUINO

A. POWER RAIL
The power rail is how we get power from the Arduino to the rest of our devices.
 3.3V – This pin provides 3.3 volts. This is the “positive side” of power.
 5V – This pin provides 5 volts. This is also the “positive side” of power.
 GND – Ground. This is the “negative side” of power. Note that there are 3 GND pins on the board. It does not matter
which one you use, they’re all connected.
 Vin – This pin provides the voltage that is being supplied to the Arduino. So if a 9 volt battery is connected, it will provide
9 volts. This is also the “positive side” of power.
 Be careful not to give attached devices, such as LED’s and Servos, too much power, especially when attaching external
battery packs.
 Remember to mind your wires. If a wire attached to a positive pin touches a wire attached to a negative pin, you could
burn out your Arduino. This is called shorting the board.

B. All of these pins can INPUT and OUTPUT a digital signal.


 Pins with a ~ next to their number are able to OUTPUT a Pulse Width Modulation (PWM). They can be used to produce an
analog OUTPUT signal. These are the pins we use to control Servos
 Notice 0 and 1 are leY out. These pins are used for TX (transferring data) and RX (receiving data). We typically don’t use
these pins.
 If a pin’s mode is set to OUTPUT, then it will be able to send (write) data. For example, the Arduino sends out data to
make an LED turn on and off. If a pin’s mode is set to INPUT, then it will be able to read data. For example, you could use
a button that the Arduino would read as a signal.
 A Digital Signal has only 2 states. It is either 0 or 1, HIGH or LOW, on or off, True or False. For example, a button is either
pressed or not pressed and sends a HIGH or LOW signal.

C. All of these pins can INPUT an Analog signal.


 An Analog Signal, unlike a digital signal, has many states. So rather than just knowing HIGH or LOW, we can know the
exact value. For example, a light sensor can detect the intensity of the light is being exposed to.
 These pins are used for sensors that can read more than one state. For example, a light sensor, a potentiometer (or
knob), or a proximity sensor.
 Note that these pins are only used for INPUT (reading information) and not for OUTPUT (writing information).
LANGUAGE REFERENCES

Note:
Difference between Digital and Analog

Digital input signals are used to represent items that only have two (2) states, such as... ON (binary 1) or OFF (binary 0) states.
Similarly, Digital output signals are used to control items that again only have two states, such as.. START or STOP a device.
So, a digital signal is something like telling if a door is open or not.

Analog signals are variable, they have multiple states. Analog input signals can represent such items as temperature or level or
rate of flow. Analog output signals are also variable and can be used for such things as opening a valve to a desired position.
Then, an analog signal is something like telling how much the door is open (or closed).
In our day to day life, we mainly do analog measurements and all analog signals includes the digital ones like a door is 0%=closed
or 100%=open.

However, digital signals are more suitable for computers (PC/PLC, etc).
An analog signal can only be read by an analog I/O, but a digital one can use both analog or digital I/Os. There is sometime a
possibilities to convert an analog signal into a series of digital ones. Because, in practice, you never connect a digital signal to an
analog I/O because the analog I/Os are way more expensive than digital ones.
So for a rule of thumb,
Whenever possible use a digital I/O, since it’s cheap.
In other case, use an analog I/O if the option to convert the signal in a series of digital signals isn’t possible.

DIGITAL I/O

Digital Input - allows microcontroller to detect logic states.


Digital Output - allows microcontroller to output logic states.

 digitalRead() - Reads the value from a specified digital pin, either HIGH or LOW.
Syntax: digitalRead(pin)
Parameters pin: the number of the digital pin you want to read
Returns HIGH or LOW

 digitalWrite() - Write a HIGH or a LOW value to a digital pin.


If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V (or 3.3V on
3.3V boards) for HIGH, 0V (ground) for LOW.
If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pullup on the input pin. It is
recommended to set the pinMode() to INPUT_PULLUP to enable the internal pull-up resistor.
If you do not set the pinMode() to OUTPUT, and connect an LED to a pin, when calling digitalWrite(HIGH), the LED may appear
dim. Without explicitly setting pinMode(), digitalWrite() will have enabled the internal pull-up resistor, which acts like a large
current-limiting resistor.
Syntax: digitalWrite(pin, value)
Parameters pin: the pin number value: HIGH or LOW
Returns Nothing

 pinMode() - Configures the specified pin to behave either as an input or an output.


As of Arduino 1.0.1, it is possible to enable the internal pullup resistors with the mode INPUT_PULLUP. Additionally, the INPUT
mode explicitly disables the internal pullups.
Syntax pinMode(pin, mode)
Parameters pin: the number of the pin whose mode you wish to set mode: INPUT, OUTPUT, or INPUT_PULLUP.
Returns Nothing
ANALOG I/O

 analogRead() - Reads the value from the specified analog pin. Arduino boards contain a multichannel, 10-bit analog to
digital converter. This means that it will map input voltages between 0 and the operating voltage(5V or 3.3V) into integer values
between 0 and 1023. On an Arduino UNO, for example, this yields a resolution between readings of: 5 volts / 1024 units or,
0.0049 volts (4.9 mV) per unit. See the table below for the usable pins, operating voltage and maximum resolution for some
Arduino boards.
The input range can be changed using analogReference(), while the resolution can be changed (only for Zero, Due and MKR
boards) using analogReadResolution().
On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 microseconds (0.0001 s) to read an analog input, so the
maximum reading rate is about 10,000 times a second.
Syntax: analogRead(pin)
Parameters pin: the name of the analog input pin to read from (A0 to A5 on most boards, A0 to A6 on MKR boards, A0 to A7 on
the Mini and Nano, A0 to A15 on the Mega).

 analogWrite() - Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a
motor at v speeds. After a call to analogWrite(), the pin will generate a steady square wave of the specified duty cycle
until t call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin. The frequency of the PW signal on
most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980
Hz.
On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and the
Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite() on
pins 9, 10, and 11.
The Arduino DUE supports analogWrite() on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DA DAC1
are Digital to Analog converters, and act as true analog outputs.
You do not need to call pinMode() to set the pin as an output before calling analogWrite().
The analogWrite function has nothing to do with the analog pins or the analogRead function.
Syntax: analogWrite(pin, value)
Parameters pin: the pin to write to. Allowed data types: int.
value: the duty cycle: between 0 (always off) and 255 (always on). Allowed data types: int
Returns Nothing

 analogReference() - Configures the reference voltage used for analog input.


Syntax: analogReference(type)
Parameters type: which type of reference to use
Returns Nothing

ZERO, DUE & MKR FAMILY

 analogReadResolution() - is an extension of the Analog API for the Arduino Due, Zero and MKR Family.
Sets the size (in bits) of the value returned by analogRead(). It defaults to 10 bits (returns values between 0-1023) for
backward compatibility with AVR based boards.
The Due, Zero and MKR Family boards have 12-bit ADC capabilities that can be accessed by changing the resolution to 12.
This will return values from analogRead() between 0 and 4095.
Syntax: analogReadResolution(bits)
Parameters bits: determines the resolution (in bits) of the value returned by the analogRead() function. You can set this
between 1 and 32. You can set resolutions higher than 12 but values returned by analogRead() will suffer approximation.
Returns Nothing

 analogWriteResolution() – is an extension of the Analog API for the Arduino Due. It sets the resolution of the
analogWrite() function. It defaults to 8 bits (values between 0- 255) for backward compatibility with AVR based boards.
Syntax: analogWriteResolution(bits)
Parameters bits: determines the resolution (in bits) of the values used in the analogWrite() function. The value can range
from 1 to 32. If you choose a resolution higher or lower than your board’s hardware capabilities, the value used in
analogWrite() will be either truncated if it’s too high or padded with zeros if it’s too low.
Returns Nothing

Você também pode gostar