In this post, we'll be learning the basics of the Arduino microcontroller. There are already tons of resources out in the web for getting started, so this will be more of a hub to connect to all that. First, we will talk about what an Arduino is. Then, we can choose the board that is right for your application. After that, we'll point you in the right direction to setup the board you chose. Finally, we'll offer some examples to get started.
Since there are so many different things to do, we'll need a variety of parts.
**- Arduino Board
- USB A-B Cable (most printers use this)
- USB Micro - B Cable (most android phones or digital cameras use this)
- Assorted electronics parts for examples (LEDs, Resistors, Potentiometers, Buttons...)**
Step 1: What Is Arduino?
Arduino boards are open-source electronics platform that can be used to easily interface with hardware and sensors to expand the possibilities of your project. Arduino started in Italy in 2005. It has expanded over the years, with multiple manufacturers and distributors around the world. Arduino also has the Arduino IDE, the software that you use to program the board.
The Arduino is a great educational tool to learn the basics of coding and electronics. There are lots of boards, starter kits, and shields to ensure that whatever your project is, you can find the parts for it. Arduino is simple enough that beginners can dive in easily, yet has enough options that advanced users can use it as well.
The Arduino software can be used with any Windows, Linux or Mac computer.
Step 2: Which Board Do I Use?
Through the years, there have been many revisions of the Arduino board. We will go over a few key differences between the boards. You can see a full overview of all the Arduino products here: www.arduino.cc/en/Main/Products
These boards are good for getting started with, and good for basic programming.
**Arduino Uno **
This is the basic beginners board. It has 14 digital input/outputs (6 of which can be PWM pins), 6 analog inputs, and a 16MHz clock. This allows it to interface with a variety of sensors and applications. The Uno operates at 5V, and can be powered via the USB port, or it can take an input voltage of 6-20V (7-12 recommended) on the Vin pin. The 5V pin can supply 1A max for powering external sensors and outputs, if more then that is required you need an external power supply. If you try to draw more then 1A, the board will be damaged. The Arduino Uno measures 2.7" by 2.1".
The Arduino Micro is a small control board for when space is at a premium in your project. It measures 0.7" by 1.9". The Arduino Micro has many of the same specifications as the Uno, with a few differences. The Micro has 20 digital input/output pins. 7 can be used as PWM pins, 12 as analog inputs. The serial communication with the computer is done differently, see the Arduino Leonardo board for more details.
Arduino Pro/Pro Micro
The Arduino Pro is a board with a few different versions. The Pro is a full sized board, compatible with the various shields. The Pro Mini measures 0.7" by 1.3", which makes it perfect for small projects. Each board comes in a 5V and 3.3V version. There are no headers attached to the board, which makes it slightly harder to use for prototyping, but gives it more flexibility when you are soldering the board into your project. The Arduino Pro has many of the same specifications as the Uno, with a few differences.The 3.3V version runs on a 8MHz clock, the 5V has a 16MHz clock. For power input, you need 3.3-12V for the 3.3V board, and 5-12V for the 5V board.
The Arduino Nano is used for when you want the size of an Arduino Micro, but the functionality of an Uno. It has 14 digital input/output pins (6 can be PWM), 8 analog inputs, and a 16MHz clock. It runs on 5V, taking an input power voltage of 7-12V. It measures 0.73" x 1.7".
More Advanced Boards:
These boards have more advanced features for your next level projects.
The Arduino Mega is used for projects with tons of inputs and outputs. All the specs are the same as the Arduino Uno, but it has 54 digital inputs/outputs (14 can be PWM), 16 analog inputs, and 4 UARTs for serial communication. It measures 2.1" by 4".
The Arduino Leonardo has the same specifications as the Arduino Micro. The big difference between the Leonardo/Micro and all the other boards, is that there is no external chip for USB programming. Everything is built in to one controller. This allows these boards to be connected through a "Virtual COM port", and allows the Leonardo/Micro to communicate as a keyboard/mouse to the computer. This also means that unlike the other boards, there is no reset when the serial port is opened. For debugging your programs, you need to do workarounds to see the Serial.prints() in your setup() routine.
The Arduino Due is the biggest and baddest of the boards. The most crucial difference between this board and the others is that it runs at 3.3V, not 5V. This means that you may need external circuitry to interface this with regular 5V sensors. You can still input 7-12V, but the input/output pins require 3.3V. The Arduino Due is the size of a Mega, 2.1" by 4". It has 54 digital inputs/outputs (12 can be PWM), 12 analog inputs, and 4 UARTs for serial communication. It runs on a 32 bit processor, running at 84MHz. This allows it to do bigger calculations (4 bytes at a time, rather then 2), over 5 times faster then the other Arduino boards. This makes the programs run up to 10x faster. The Due also has an unlimited number of interrupt pins, due to the second processor, allowing it to get even more feedback from the world around it.
The Arduino Ethernet board is like a Arduino Uno with an Ethernet shield built into it. There is also a micro SD card reader built in. It has the same number of inputs/outputs as the Uno, but 4 are used for communication with the Ethernet system, and 4 are used for the SD reader. This leaves 6 available digital input/outputs (4 can be PWM), and 6 analog inputs. By using the ethernet port, you can connect this board to the internet to open a whole new world of possibilities for your projects.
The Arduino Yun is a very special board. First, is a combination of two processors. One processor runs the Arduino programs, and the other processor runs a Linux distribution that allows you to write shell and python scripts. Second, it has built in WiFi and Ethernet capabilities, to make it easy to connect your projects to the internet. Finally, it has a built in SD card reader to expand the storage space of your programs. The Yun has 20 digital input/output pins (7 can be PWM), 12 analog inputs, and a 16MHz clock. It measures 2.09" by 2.87".
Now that we've gone over all the Arduino boards, it's time to move on to setting up the software!
Step 3: Software Setup
Once you've picked your board, you need to install all the software and drivers so that you can start programming!
Arduino has written the best getting started guide, see here for the various instructions for each board.
Once all the drivers and the Arduino IDE is installed, you can begin programming. Before you can upload code, ensure that the correct board and port is selected.
On the top menus, go to "Tools" - "Board", and choose which board you are using.
Then, go to "Tools" - "Port" and choose the port that corresponds to your Arduino. The getting started guide that is linked above has more information and troubleshooting options if you are having issues getting everything working.
Step 4: Basic Examples
The easiest example to test your board is the "Blink" example. Most boards have a built in LED, so you can use the "Blink" example to make sure that you can upload code to the board.
Find the example by opening the Arduino IDE, then going to "File" - "Examples" - "Basics" - "Blink".
You can change the Pin from 13 to whatever pin the LED is on on your board. The delay(1000) will pause the program for the specified amount of time. It is called in milliseconds, so 1000 means the program will pause for 1 second.