Arduino Part 2: Introduction and Hardware

Arduino Part 2: Introduction and Hardware

Max Vanatta

Purpose: This introduction to Arduino is meant as a first step in writing code and using electronics to enhance your project's behaviors.

While there are many tutorials available across the internet, and you will inevitably use a wide variety of these in your project work, this one is meant to ground you in the concepts of Arduino and highlight that no matter what level of computation background you have, you already have the skills to succeed.

The Arduino can be thoughts of as a rather simple object.  It can behave as simply as a person sitting in a room flipping light switches based on a set of instructions, and we are going to treat it with as low a level of apprehension.  

The Board

Imagine you have a friend in a room with multiple switches, but your friend is wearing a blind fold.  If you were to ask your friend to turn on a light, they would have to first know where the light is.  

For the Arduino, the location of the lights is actually the location of 'pins'.  Pins are the electrical connectors which line the sides of the Arduino and look somewhat like a one-prong outlet. There are three types of these pins:

  • Power Pins: These pins can provide power or a ground to any number of sensors. The pins which provide power are available in both 3.3 Volts and 5 Volts, please check your sensor for what it needs.
    The ground, labelled GND, is important because to make almost every single sensor or device work, you need to complete a circuitor complete electrical loop. This means you must connect a positive voltage, such as the 5V pin to a device, and then the other side of the device to the GND pin.  This would keep the device at a constant 5V, and not be controlled by the Arduino code.
  • Analog Pins: These pins can be seen as the eyes and ears of the board and allow high resolution inputs to the board in values ranging from 0-255.
  • Digital Pins: These pins can be both input and output for the board and there are two types. Most of these are only able to input and output High and Low, similar to on and off, or the stereotypical 0 or 1.
    Those labelled with a "~" are called PWM, Pulse Width Modulation, and can output information from 0-255.
    Additionally, these pins can provide up to 5V, meaning that they can be used to complete a circuit with the GND pin.

Adding Components

The Arduino board itself will do very little without adding additional components, but the choice of other components will depend on the goal of the project, so let's make a goal...

We need to blink an LED on and off every second continuously.

What you will need: Arduino, Breadboard, 3x m-m wires, 220ohm Resistor, 1x LED (don't know what all these are?  No worries, we will introduce them)

What is an LED anyways?  An LED, or Light Emitting Diode, is a device which converts energy(electricity) into light.  The word diode in the name also means that the electricity can only flow one direction through the device.  We can know which way due to the length of the electrical pins, longer is positive, or by a small flat spot on the LED itself, flat is negative.

Since we know that the LED will be receiving information from the Arduino (It needs to be told to turn on and off) we know that it will be at a digital pin.  Since these pins can be considered positive(5V), we also know that we will need to use a GND pin.

If we were to connect the LED directly between pin 13 and GND, this LED would receive the full 5V.  This is a problem because many LEDs are not made to convert that much voltage into light to the point where the LED would likely break. Let's avoid this!

To avoid this LED from being overwhelmed, we need to reduce the amount of voltage going through the LED, and this is done with a resistor.  A resistor is a device which converts energy to heat.  While this might seem like a waste of energy, we actually need this to not burn out our LED.

If we now look at the components needed to connect our circuit, there are too many to simply plug it into the Arduino.  This means we need a breadboard which is a board with many holes like the pins on the Arduino but with hidden connections between holes.  Orienting the board portrait style, the two columns on either side of the board are connected and are usually used to create a positive voltage area(red) and a GND area(black or blue).  The rows on either side of the middle line are connected as rows rather than the edges which are columns.

No we have all of our pieces and understanding of the board itself.  Let's build it.

  1. Connect a wire from the GND pin to the black/blue column of your breadboard.  
  2. Connect a second wire from the black/blue column to a row of the breadboard.
  3. Now we plug in the LED.  The short/negative lead of the LED should be in the same row as our previous wire.  The long lead should be in a different row
  4. The resistor should be plugged in so one end is in the same row as the long/positive side of the LED and the other is in a third row.  
  5. Finally connect a wire from this third row to Pin 13 of your Arduino.  

If done correctly this completes the circuit and will make our next step, coding the Arduino, our final step.