Getting Started with Arduino

By Lloyd Summers on 17 May 2014 08:38 am
5
loading...
0
loading...
8
loading...

Hi everyone!

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! Hopefully this will help the many of you that are looking to get into more DIY projects and especially Arduino.

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.

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.

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.

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

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:

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.

Click image to enlarge

  • 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.

  1. Procure an Arduino board with USB cable
  2. Download the Arduino IDE for your platform
  3. Connect the board to your computer using the USB cable
  4. Install the drivers if prompted

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.

  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

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 colorful logo where you can control the colors.

In order to follow next weeks article you will need:

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!

22 comments

HubyD

Nicely written. I once programmed for a Arduino board at work (something simple, to send signals from a button to a PC), and it was not that hard at all :)

rednaif

Awesome article. I have been meaning to get started with both of these. Looking forward to next week!

Daytona123

Fantastic stuff, Lloyd! There's been a few times in my life where I've thought 'I could probably make something to do this easier '. Arduino seems like the right tool for the job! Now I just need to see how difficult the code is to write, and I'll jump on the Arduino bandwagon for sure!

Posted via Connectedly App

ptboucher

This is a great article! For those of us who are not programmers/developers, but interested in learning more about it, this is a great source of information and guidance. Looking forward to reading the rest of the series. Thanks for the great read!

Drew Oswalt

Thanks for these articles. They really make me want to get back into computer hardware and minor programming

Kevin Michaluk

Great contribution to Connectedly! Awesome stuff. Keep them coming!

mtshelbygt

Very good article, I might actually look in to using one now.

Posted via Connectedly App

pkcable

I love it when one of my suggestions comes to fruition!

KermEd

Thanks for the support guys! Pkcable likes to encourage me - and this article is definitely a result of his support ;).

I had a couple of good questions come in:

What is Bladuino?

Bladuino is an example of a kickstarter clone. Arduino hardware is all open source, so Bladuino is an example of a low cost spin-off of an Arduino mini. It means spending 5 dollars instead of 20 for the same thing. Be cautious with spin offs though as many of these manufacturers don't return profit or code to support to the arduino team.

What about Soldering?

As for soldering. Starting next week you will learn everything about LED basics. Most of the demos I will give will have a no solder 'learning to assemble'. And then soldering will be used for the final assembly which is optional. But trust me soldering is easy peazy.

Parts list

Last, in the parts list above, I forgot the sparkfun RGB LEDs are Anode. Which means you will actually need 9x 330 ohm resistors. But I will also show folks how to create a glowing logo using non-RGB LEDS to make it an all LED article. That uses 3x 330 ohm. It will all make sense in part 2.

Any questions or issues just hit me up :)

Posted from BB10 / Connectedly APK

rizzo183

Thank you so much for this article and i'm definitely looking forward to the next ones. A humble suggestion though, maybe if you could use videos, it'd make these articles a 110% awesome! thanks again.

KermEd

Absolutely - you'll see me doing short videos anytime there is a hands on component. Next week's article should have one, time permitting :)

Posted from BB10 / Connectedly APK

splatmaster99

Huh, well done. I have a Pi sitting around that I can't wait to use for...What?

KermEd

Depending on how my schedule works out. I may be doing a Raspberry Pi build and an old 50 inch commercial LCD to create a touch arcade table.

I'm only hesitant to announce that too much because I may use a bigger microprocessor platform (probably off iteadstudio) to get better multi-touch support.

But I'm currently using a Raspberry Pi for a set of videos on how to make a ghost hunting box (NoIR camera, remote temperature sensor, EMF and EVP recording)

Posted from BB10 / Connectedly APK

trickedoutdavid

This is really great... Looks like I have my project for this summer. Thanks!!!

BeheGOD

Very well written, very lovely read!
In fact lot's of friends of mine are playing with/ doing projects on an arduino and recommended me to do so aswel!
Just one question to the community:
What do you use your Arduino or Raspberry PI for?

rbaldonado

Cool article, looking forward for more. Excited to see what connectedly has in store for arduino articles.

edyb

Nice article! I have both Arduino and RasPi and they are fun to use. The best thing is they are both cheap and provide infinite possibilities up to the imagination on how to use them. Also good is that it forces us to learn electronics and understand also circuit designs and specs, not just pure programming. That real world interaction is the key to these platforms and the huge amount of resources freely available. Keep the articles coming!

supernovo

Great article, thanks a lot. Actually I am planning to use an Arduino for my next DIY project: clockTHREE! Good read.

jevalladares

Interesting project, thinking of refreshing my coding skills to tackle a couple. Will be very eager to read future posts.

lanching123

Very interesting article really enjoyed some of the explainations

Stephen Lane

Nice article! Might give this a go!

Posted via Connectedly App

msgordon

I love Arduino. My daughter and I used one as part of her science fair project on how humans perceive light, and I also used one to make a nerdy valentine's day gift for my wife. The community around the Arduino platform is so helpful and creative, its hard to not get wrapped up in it all.