Arduino – Getting started Guide


Getting Started with Arduino

Hi everyone!

UnoStack

Today is an exciting day. I was recently asked to write a series of articles focusing on Arduino for Connectedly and what better way to get started than to write up a quick getting started article!

What Does It Do

Have you ever wished you could remotely control devices at your home? Or wanted to log information like the outdoor temperature for a full year? Or maybe create a solar powered blinking t-shirt? These things are all relatively easy now thanks to Arduino.

What To Expect

I consider myself a tinkerer or maybe even a mad scientist in some circles. If you imagine my house as covered in electronics and gizmos… well you would be absolutely correct! I come from a software development background (you may recognize me from my BlackBerry 10 applications and games) and I have worked with electronics for a long time.

Throughout these articles, I will walk you through using an Arduino development board. We will start with the very basics, and move to the more advanced. And hopefully you will catch the excitement I have for this platform!

Over the next while you will learn:

  • · Getting started with an Arduino
  • · When to use Arduino and when to use Raspberry Pi
  • · How to program using a subset of C++ (it isn’t as scary as you might think. In fact, you may learn to love it!)
  • · How different electronic components work
  • · How to use a soldering iron properly
  • · How to manipulate the relationship between the two using logical ordering
  • Translation: You will learn how to make blinky lights and noisy things. In fact, by the time you reach the bottom of this article, you may have a blinky light already!

 

Recommended Reading

Please Note: For folks interested in Raspberry Pi, I highly recommend following the articles from my co-conspirator Jerry Hildenbrand starting with What is Raspberry Pi.

Difference Between Arduino and Raspberry Pi

At first glance, Arduino and Raspberry Pi may look the same. In fact, in many ways they are similar! They are about the same size. They have lots of pins and headers. And they run on 5 volts, 500mA.

However both are development boards with very specific purposes. Both can do amazing things, but if you know how to pick the right board for your projects, you will really be setting yourself up for success.

RaspberryPi

General raw horsepower aside, there is one very important difference between Arduino boards and the Raspberry Pi that sets them apart. The Raspberry Pi (or any ARM / PC development board for that matter) relies on a micro-processor. Micro-processors are very complex and they are meant for multitasking (such as running operating systems, arcade tables, or interactive smart TV’s). They do complex functions very well.

ArduinoUno

An Arduino compatible development board however is based on a micro-controller. A micro-controller by comparison is much smaller, but better suited for unitasking (yes, I just made that word up!) or single-tasked events. It is meant for ‘wait for this, then do that’ type functionality. And is often shrunken to fit smaller projects (such as wearables, automated watering systems, or simple robotics). I have even shrunk my own Arduino’s to the size of a quarter!

So if you want to build an arcade, a Raspberry Pi is the easier way to go. If you want to build a sensor that detects the number of people walking by your house, generally an Arduino is the easier way to go.

About ‘Arduino’

It is important to mention that the term Arduino refers to several items. It refers to the Arduino Brand, Arduino Development Boards, and the Arduino IDE.

clip_image008

Prior to 2005, to get a microprocessor to do something cool, hobbyists had to go through a lot of hoops. We often had to purchase expensive software, create very complicated functions and classes. We would need to procure obscure and expensive development boards. And we would follow complex documentation with limited help and guidance.

In 2005 that all started to change when the idea was brought forward by one of the students at Interaction Design Institute Iveria in Italy (sadly, now closed).

Over time Arduino expanded until it became the dominating learning platform for micro-controllers as used today! Arduino is a full open source IDE intended to be used on a standardized list of hardware components. It has a large growing community and a very simple approach towards development with a greatly reduced cost. Classes and libraries are pre-built, code is often shared freely between users, and the Inter-web is flooded with tutorials and guides.

Easier coding + faster learning = more projects, easier!

How They Work

BunchOfUnos

Generally speaking Arduno board’s work by being connected to your computer over a USB cable. You can then write code snippets (called sketches) using the Arduino IDE (download available for Windows, Mac OS and Linux) and upload it to run on the Arduino board. For basic use, all of the power used by the Arduino is collected over the USB cable.

In a basic scenario you could tell it to listen to an event on a pin of your choosing (it does this by checking for a voltage change – such as when someone presses a button and interrupts the electrical flow). It then responds to this event by sending out a voltage change on a different pin of your choosing (such as sending power to turn on a light).

The Arduino board performs this series of functions in a loop (over and over again repeating) based on what you told it to do. So anytime you press that button, it turns on the light!

Different Boards

As if we didn’t have enough to learn about from one board! Today there are 20 official Arduino boards available for purchase from wearables to handheld gaming systems. On top of this there are thousands of copies and clones from different manufacturers. And you can even create your own Arduino boards from scratch.

Some of these third party manufacturers (such as Sparkfun and Adafruit) even provide funding back to the Arduino team for their great products.

In these tutorials, I will focus on the following boards:

ArduinoFamily

Above shows a Raspberry Pi, several different models of Arduino development boards and a cell phone for size comparison.

From top left to right: Raspberry Pi, Arduino Mega, Arduino Yún, Arduino Uno, Bladuino Mini, Arduino Esplora (bottom) and my cell phone (bottom right) for comparison.

clip_image014

  • Arduino Uno
  • This is the Pontiac Sunfire of the Arduino family. Mid cost and generally a solid all-purpose Arduino. These are what most people ‘build’ with for experimentation. This will also be the model I will use for most of the demonstrations.
  • Arduino Mega
  • This has more pins than an Uno, and more memory than an Uno. But it costs more! I recommend these for more complicated projects. You see these used in 3D Printers (via RAMPS) and robotics.
  • Arduino Yún
  • This is the Porsche of the official Arduino family. It adds on-board Wifi, Ethernet, Extra USB port, and a MicroSD card slot. This board can take your projects to the next level. We will use this for news ticker boxes and Arduino projects that read data from the internet.
  • Arduino Mini
  • This is the mini-coupe of the Arduino family (if mini-coupes were half the price of a Sunfire). You can order these for as cheap as 5 dollars and are often featured during Kickstarter and Indiegogo campaigns. They are much smaller but typically pack the same punch as an Uno. These are the boards I typically leave to run in ‘finished’ projects.
  • Arduino Esplora
  • This is a very unique board. It is meant for one thing: Creating your own hand-held gaming system. I recommend pairing it with the Esplora TFT screen and printing a 3D case (if your lucky enough to have a 3D printer). The one restriction, these units have a lot of bells and whistles but the limited RAM can be an issue.
  • For more information, checkout the official comparison charts on the Arduino website.

Getting Started

Now that we have a good idea of what an Arduino board does and what models are available. The next steps are a bit more straightforward.

Issues: Windows 8 and 8.1 users may have an issue where the Arduino drivers will not install because they are not signed.

To resolve this issue, you need to enable unsigned drivers temporarily. This will require 2 system restarts.

  • 1. Move to the right to bring up the Charm bar
  • 2. Press Settings then Change PC Settings
  • 3. Select Update and Recovery and then select Recovery
  • 4. Under Restart for Advanced Setup, click on Restart now
  • 5. On the bluescreen select Troubleshoot then Advanced Options
  • 6. Select Startup Settings and use your keyboard to 7) Disable driver signing enforcement and wait for the restart

Testing the Blink Application

Arduino users have a simple application that is often used for testing if an Arduino is working properly. Most Arduino’s have an on-board LED on PIN 13, which means there is a sample program built into the IDE that should let you make a light blink on your Arduino.

clip_image016

  • 1. Launch the Arduino IDE application on your computer
  • 2. Press File then Examples and browse to Basics and select the Blink example
  • 3. Under Tools, Select your board
  • 4. Select your Serial Port. Note, if this is missing and you are using Windows 8 or 8.1 please see above. This means the drivers are not installed on your PC or the device is not recognized. You may want to try a second USB port to re-initialize the drivers. You may also have multiple ports listed if you have BlackBerry Link installed. Try the one with the highest number and work your way down.
  • 5. Press Upload (second icon from the left) to compile & upload the program to your Arduino

Code from Arduino.cc (download here):

/* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give it a name: int led = 13; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }

The upload will occur in two stages. Compiling (turning the code to machine language) and then Uploading (sending it to the Arduino board). And after half a minute an LED should begin blinking on your Arduino!

Initial Setup Complete! **

During this process, you should see the transmit and receive LED’s blinking. The lights on the Arduino should cycle (when it restarts) and then an LED should start blinking!

You will notice as well, if you disconnect the USB cable. And reconnect the USB cable, the Arduino remembers the sketch you uploaded. And goes back to its blinking cycle (don’t worry – you can always upload new and improved sketches back onto this Arduino).

Fun Related Projects

The following projects are highly recommended by me. They are great for learning and use the Arduino IDE. They make great projects to practice soldering, learning code, and assembling basic electronics.

Maggie Jr

Maggie

Order here! This great little project is affordable, easy to assemble, and will help you with your soldering skills.

Sparkfun Inventors Kit

Order here! This great little kit and downloadable PDF will make it super easy later on. It includes many little components, and a comprehensive instruction set for learning how to use sensors and components!

Next Steps

Before we start building something fun, we need to plan for the necessary equipment and components to start on the next project. This list will change from article to article.

For the next inspiration, I recently saw a request on CrackBerry to make a glowing logo for a smartphone. This sounds like a great project to learn about LED’s! So in the next article I will show you how to light up an LED and create a colourful logo where you can control the colours.

In order to follow next weeks article you will need:

o Tools:

Get a kit here.

  • · ** A small pair of wire cutters (optional)
  • · ** A pair of wire strippers
  • · ** A pair of needle-nose pliers
  • · ** A soldering iron
  • · ** A little bit of solder

Components:

** These items are only required if you want to create a ‘long term, I wanna keep it’ project.

I will also be using a piece of wood and some plastic to create the logo shape. But you can use scrap plastic (from a 4L milk jug for example) and some cardboard if you just want to use this for learning purposes.

Much later on I will show you how to build your very own Arduino from scratch, which will give you the ability to even make your own glowing LED case!

Thanks a bunch and stay tuned for more.

Lloyd