Let’s start “Arduinos”
We are going to discuss that what
they are, what they can do, and the basics of how to set
one up to do simple things. We can
make a lot from it and it is not very complex.
So what is an Arduino?
We will briefly discuss Microcontrollers.
This is a microcontroller:
Microcontrollers are integrated
circuits that are basically tiny computers.
They can run small, simple software
programs.
They are low powered enough that
they can be powered by a battery for days, but they
are fast enough to process data much
faster than any human being can think.
Now back to Arduino.
Arduino is a company in Italy that
designs and sells circuit boards that make microcontrollers
easy to use.
They call these circuit boards
Arduinos and there are a lot of different types of Arduinos.
For example, you've got simple
Arduino boards like the Arduino Uno, which is cheap and good
enough for most projects.
You could use an Arduino Uno to
control motors, lighting, cameras, or even build a simple
Robot.
And then you have more fancy
Arduinos with more powerful processors which have WIFI,
Ethernet and much more.
The company Arduino open sources all
of their hardware designs, which means that you don't
just have to buy from them, there
are countless 3rd party companies that make their own variants
of the Arduino hardware designs.
They can't call them Arduinos, but
functionally they are the same thing and are cheaper.
There are also these things called
Arduino "shields", which are basically circuit boards
That can be plugged into your main
Arduino circuit board, and let you do more stuff.
For example, “Ada fruit” makes
shields that let you control motors and servos, which expands the working of Arduino.
And “Spark fun” has shields that
let you turn your Arduino into a simple cell phone or
an MP3 player.
Okay, so that was a quick discussion
about Arduino the company, and Arduino hardware.
But there's more!
There's also the Arduino software the development environment and this is what makes Arduino
good for beginners.
Historically, if you wanted to
program microcontrollers, you'd have to type out a lot of binary and memorize a lot of hard to remember registers and instructions.
Then you'd have to use special
programming hardware with custom made cables to upload
your program onto your
microcontroller.
Arduino, the company, got rid of all
of that.
They have created software that
works on Windows, Mac, and Linux, which makes uploading your
code as simple as connecting a USB
cable and clicking a button.
They created a programming language
that lets you configure all of the Arduino hardware
products in the same way.
And although it's not as simple as
learning Python, the Arduino software is one of the
easiest programming experiences
you'll ever have.
Ok, so hopefully that clarifies what
Arduino means in different contexts.
“Arduino
UNO”
Now when people say they used
"an Arduino" for their project, they are probably talking
about this Arduino Uno.
It's the perfect Arduino hardware
for this beginners tutorial.
You can get them from Amazon
cheaply, and if you have the money I recommend buying one
of the many Uno kits out there where
you get a lot of different pieces of hardware to play
with.
Okay, so you've got your Arduino
Uno.
The first thing I want to do is get
you familiar with the hardware.
You will often hear Arduinos being
called microcontrollers, and that's technically incorrect.
Arduinos are circuit boards that
have microcontroller chips on them, but they also have a lot of
other stuff on there too.
Arduino UNO uses a series of
microcontrollers called ATMEGA AVRs.
They are made by a company called
Atmel.
You can buy just the bare chips on
their own for about a dollar but then you'd have to
do a lot of soldering.
Connected to the microcontroller is
a crystal resonator.
This controls how fast the microcontroller is running.
Now to upload the software
you create to the main microcontroller, there's actually
another microcontroller!
There chip that lets you connect
your USB cable to the Arduino board, and communicate
via USB.
It lets you upload your programs
onto the main microcontroller, and once you have your
program running, this chip is what
allows you to send messages back and forth between
your computer and your Arduino.
And this is extremely important for
debugging.
One great thing about Arduinos is
that you can power them purely from your USB cable.
But!
If you don't want your project
always attached to a computer, you can just use an external
9 volt DC power source with the
barrel jack over here.
The Uno has a built-in voltage
regulator that will reduce the voltage to 5 volts.
And if you ever want to
"reboot" your Arduino's program, you've got a reset button.
If you have time, it's worth
studying the Arduino Uno schematic.
Don't worry if it looks complicated,
you don't need to understand most of it, I'm trying
to get you to understand what the
Arduino designers did.
They took an off the shelf microcontroller that requires a lot of extra parts to get
working, and they put all of those
things together in an easy-to-use way.
And if you choose to learn more
about electronics, you can create circuit boards like this too.
Next, let's talk about the pin
connectors.
Over here you have the power pins.
If you want, you can connect wires
here to power other circuitry with 5 volts or 3.3
volts.
Just make sure whatever your
power doesn't draw more than a few milliamps!
A few LEDs are okay, but a large
motor would damage the Arduino.
TX and RX are for sending and
receiving serial data.
You could use this port to send and
receive data from a GPS module, Bluetooth modules,
WIFI modules and more.
Pins 2 to 13 are for digital inputs
and outputs.
Normally when people think of binary
you think of just spitting out 0s and 1s.
But!
With most microcontroller pins you
can actually activate the third state, and use them as a
digital input.
So you can use this pin as an output
where it spits out 5V for a digital 1, or 0V for
a digital 0.
Or, you can internally configure the
Arduino to expect a voltage on the pin, and that voltage
could be interpreted as a 1 or a 0.
It's a system called tristate logic,
and it's worth reading up on, but Arduino makes it
really easy to change between inputs
and outputs in software.
Here we have 6 analog input pins,
and these are used to measure continuous voltages anywhere
from 0 to 5V.
I'll write more about this later in
this article.
Finally, some of the pins have a
tilde in front of them, and this means that you can use them
to output pulse width modulated
square waves, which I will also show later in this.
Okay, enough about the hardware.
Most of the work you do with your
Arduino will actually be in the software.
So start out by downloading the
Arduino software from Arduino. cc.
During the installation, you can
expect a lot of prompts like this to show up, where you
are asked if you want to install
various drivers.
Just say yes to everything.
Once you are done, connect the
Arduino to your computer with a USB cable.
Next, start up the Arduino
development environment.
The first thing you want to do is
make sure that the software tries to connect to the
the right type of Arduino.
Go to Tools, Boards, and we are
going to be using an Arduino Uno.
Next, we have to make sure the
Arduino environment can actually connect and communicate with
your Arduino.
Go to Tools, Ports, and select the COM
or serial port where your Arduino is connected.
If there isn't an Arduino listed
here, you may have a problem with your drivers, or you
can try plugging your Arduino into a
different USB port.
The Arduino software has a ton of
fantastic, easy to follow demo programs, and studying
This is the best place to start
learning how to code.
Arduino calls them
"sketches" which is just a fancy name for a program that you upload
to your Arduino.
That brings us to the end of the article. Hope that you will like it.
No comments:
Post a Comment