Today I will show you how you can get started with the Internet of Things, and I will do it using the open source hardware platform Arduino. I will use the Arduino Yún board, but the setup I will show works with most of the original Arduino boards as well as compatible versions by other suppliers.
The only thing you really need to perform the lab that I will show you in this video is an Arduino board. Even the most basic board, the Arduino Uno will do, as it has an onboard LED, but I will use the Arduino Yún as it has a lot more potential what I will dig into more in upcoming videos. But if you want to get started with some hardware, you also need a breadboard, a LED (I will use a red one), a resistor (I will use one of 220 ohms) and two jumper wires.
The first thing you need to do is set up your Arduino board, and the procedure is a bit different for each board, so please check out www.arduino.cc for details on how to set up your board. The first step to set up an Arduino Yún board is to connect a power source to the micro-USB port (e.g. any Android phone charger will do), and then connect your computer to the wireless network created by the board, and it’s named something like ArduinoYun-XXXXXXXXXXXX. Then, browse to 192.168.240.1, login with the password “arduino”, choose “CONFIGURE”, and setup wireless network (which is usually your local router). Finally, when the board restarts, connect the computer to the same wireless network (router).
The next thing to do is to set up your development environment, and you start by downloading it from www.arduino.cc/en/main/software, and then follow the instructions (on Mac you just unzip the archive and drag the containing app to “Applications”). For Arduino Yún, you should use version 1.5.6-r2 (or later), and when you start it you choose Tools > Board, and the board that you have. Then you choose Tools > Port, and if you have the Yún, it should show up with its IP address.
Now it’s time to run your first program (or sketch as it’s called in the Arduino world), and for that you choose File > Examples > 01Basics > Blink. The code declares a constant (on the first line) for the 13th pin, and on startup (in the setup function) that pin is initialized for output (on line 5), so that we can set its state. On each eternal iteration (in the loop function) we first turn on the LED (on line 10), wait a second (on line 11), then turn off the LED (on line 12), and wait another second (on line 13). This means that the LED will blink each two seconds, and to run the program we first click the Verify button (with a checkbox) followed by the Upload button (with the arrow). The first time you upload to an Arduino Yún, you have to provide the password. After a while a small LED on the Arduino board should start flashing.
To make this more of a “things” example, here’s how you can also make an external LED blink. First you should disconnect the Arduino board from its power source to make sure that you don’t break anything while doing the connections. Then connect a jumper wire from the ground (GND) to the minus column and pin 13 to 1A on the breadboard. Also connect the resistor to minus and 2C, and the LED to 1E (the long part, which is the positive part, or anode) and 2E (the short part, which is the negative part, or cathode). Finally, reconnect the power, wait for a while, and then the LED on the breadboard should start blinking.
So there you have a first example of how to get started with the Internet of Things.