Arduino – Lighting up LEDs

Arduino & Breadboard

In the first article, we described the current state of electronic kits and introduced some of the more popular kits on the market. This time, we will use the Arduino, a simple but versatile system, to make our first program.

I will cover each step in order, from obtaining the Arduino starter kit to project implementation. For those who think that programming is difficult, just follow along with me as we make a variety of things.

First of All, What Is Arduino?

Arduino

The Arduino kit basically consists of a microcontroller (MCU) board with requisite components for connecting to other boards (shields) and an integrated development environment (IDE) that facilitates programming and makes it easy even for beginners to create electronic projects.

Microcontroller boards are used all around us, for example in the thermostat in the refrigerator for sending commands to raise or lower the temperature. A keyboard has a microcontroller that tells the computer which key was pressed. Many electrical devices use a variety of sensors to accomplish different tasks. Arduino makes it possible to create a control program using Arduino software on a PC, which can then be sent to an Arduino board connected to LEDs, motors, temperature sensors, and other electronic parts.

What Can You Do With Arduino?

This is a very important question. Once you understand that Arduino is a microcontroller-based board that can be used to perform a variety of tasks, the next question is, ‘What exactly can it do?’

With electronic construction and programming, just like music or art, until you’ve already decided what you want to do or create beforehand, it can be difficult to proceed. But even though it’s ideal to already have a project in mind, coming up with something while you’re learning to build can still be an enjoyable process.

Although there are some obvious differences, building an Arduino board is like creating something with Lego blocks that uses a variety of different parts. In fact this flexibility and ease of design is key to Arduino’s popularity.

Now then, let’s look at how Arduino is being used in the world.

Arduino in Everyday Life

Many people use Arduino to perform everyday tasks.
Arduino is perfect for making tools like these.

1. Arduino Watering System

2. Use Arduino for gardening with “Garduino”

Garduino

3. Project combining Arduino and Ruby with an infrared remote control so that it can be controlled via the web

Arduino as a Hobby

Radio control is one of the most popular hobbies. And now we’ve finally reached an age where objects and devices can be controlled remotely using a smartphone!

4. Arduino Bluetooth RC Car (Arduino + Bluetooth + Android Smartphone)

Arduino and Art

In the field of art, Arduino is used by many professionals.

 

5. Ryuichi Sakamoto’s Art-Environment-Life exhibit. This installation about respect for nature was created after the great earthquake and tsunami.

From these examples you can see that with Arduino almost anything is possible. So, let’s give it a try ourselves!

Buying an Arduino, Performing the Installation, and Creating a Development Environment

There are two requirements to get Arduino running:

  1. Prepare the Arduino board and electronic parts
  2. Create a development environment (IDE)

Arduino Board and IDE

Buying an Arduino Board

First we will need an Arduino board. Our goal will be to make LEDs blink (commonly known as L-blinking), so let’s first prepare the Arduino board and the required parts.

Parts can be purchased from a local electronics store or online. For example, you can buy an Arduino board from Adafruit.

 

Arduino Starter Kit

An Arduino starter kit

For those who would just like to get started as soon as possible, I recommend the Arduino Starter Kit (approximately $90) that includes an Arduino board, LEDs, cables, and more.

For our first project, which involves using Arduino to control LEDs, an Arduino board and at least one LED will be needed. (Not ideal, but it will do for the time being.)

005

There are many different types of Arduino

There are many types of Arduino on sale, but this time we will use an Arduino UNO (approximatively $25).

Once we’ve setup the Arduino board, we’ll move on to the development environment!

Creating the Development Environment (IDE)

To install the development environment, download the Arduino installer from their website.

Normally the installation process is self-explanatory. But, if you hit any snags you can do a specific search like “Arduino install Windows 7” or “Arduino install Mac” to solve any problems that might be unique to your computer.

1. Download the Installer from the Public Site

Navigate to the following site and download the installer.

Arduino – Software

Arduino Download Page

Arduino IDE available for different OS

2. Installation with the Installer

Arduino Installer

Once installation is complete, this icon will appear. Let’s go ahead and open it.

Getting LEDs to Light Up!

The time has finally come to complete our objective of getting our LED to light up.

Arduino Construction Methods and Key Concepts

The basic flow for an Arduino project is as follows.

Arduino project

1. Decide What to Make

Our goal this time is L-blink, so we’ve satisfied condition 1. Next, let’s construct the electronic circuit board.

2. Create Electronic Circuit Circuit

Arduino Board Basics

Arduino includes a variety of inputs and outputs. Construction involves adding parts and connections to the board. (I’ll address the differences between digital and analog in a future lesson)

Arduino board

Our goal for now is to get an LED to light up. So, connect the long part of the LED to the terminal marked 13 and the short end of the LED to GND. This completes the setup of the hardware.
(In reality, connecting an LED directly will cause electricity to run through it and decreases the lifespan of the LED, but since this is just a test trial, we’ll do it this way for now)

Arduino LED

Looking at the LED we can see that the legs are of different lengths. This is so that we can distinguish between positive and negative. Depending on the part, there are times when we don’t need to worry about + and -. In the case of an LED, if we make a mistake with the + and -, it could damage the LED, so we must be cautious. (With that being said, parts will probably be broken many times. That’s one of the thrills of electronic tools…)

LED longer Leg positive

3. Create a Program/Sketch

Once the circuit board is complete, let’s make a program that will cause the LED to flicker.

In Arduino, a program is called a sketch. (This name was chosen to emphasize the ease with which a program can be made, just like a drawn sketch.) First, without thinking about anything, please enter the program below into the Arduino IDE.

I’ll explain the program point-by-point later.

Arduino IDE

After opening the Arduino IDE, a program can be entered into the white space.

In the end, this program will be written to the Arduino board and will cause the Arduino to function.

The Basic Screen of the Arduino IDE

Arduino IDE

Program to Make the LEDs Light Up

Arduino sketch LED

Once you’ve entered the program above, conduct a check to make sure that it is correct (The check icon is on the left). If there are no problems with the program then it can be uploaded to the Arduino with the icon on the right side of the screen.

Arduino IDE

4. Verify Operation

Once the program is uploaded to the Arduino, the LED will start to blink.
If it doesn’t blink, you should confirm that the LED isn’t broken, that the orientation (+ and – directions) is correct, and that the USB cable is plugged in properly. Then try uploading the program again.

Arduino Led Twinkling

It’s blinking!

We successfully made an L-blink! This is the basic flow of an Arduino project. Next time, I’ll explain more about programming and resistors, which will allow you to vary the current and voltage supplied to the LED to control the brightness!