This article was translated to English, and was originally published for deviceplus.jp.
Devices Plus introduced a variety of applications and examples of Arduino, but knowing the basics is still important for making anything!
This time, we’ll be delivering the basics of Arduino electronics. Mr. Kazuhiro Fukuda, who is famous for Arduino introductory books, will be instructing for this article.
In this article, we’ll be teaching you how to prepare the Arduino.
[Table of Contents]
Arduino is a specialized board for operating electronic components. Thus, it’s different from a normal PC.
The computer can be connected to a display, keyboard, etc. and can start up an OS such as Windows. A variety of functions is possible by running applications on this OS. The same is true for smartphones and tablets. In addition, when the user is developing, the development environment must be run on a personal computer to create the program.
On the other hand, Arduino doesn’t require a display or keyboard to be connected. In addition, there’s no need to run an OS such as Windows. Arduino writes a program for operation in the memory so that when the power is turned on, the program starts automatically and controls the electronic components etc.
Arduino doesn’t have an environment that can freely run apps such as an OS, so you can’t create programs on the dev environment.
When creating an Arduino program, start the Arduino dev environment “Arduino IDE” on your computer and transfer it to the Arduino via USB. Then, the program is saved on the Arduino memory and automatically executed after restarting Arduino, and you can control the electronic components.
To begin developing the Arduino program, start up the dev environment, “Arduino IDE.” Arduino IDE is distributed free of charge for Windows, macOS, Linux, and other operating systems. Today, we’ll be using the Windows version as an example.
On a web browser, access Arduino IDE’s distribution site. Click “Windows Installer” in “Download the Arduino IDE.” Next, you’ll be asked about donations, but you can download it free by clicking “JUST DOWNLOAD.”
Clicking the downloaded file starts the installer. After that, follow the steps of the installer to complete the installation.
A dialog box asking if you want to install the driver may pop up. In this case, click “Install” to install it.
When installation is complete, you can start by selecting “Arduino” from the Start menu.
The Arduino IDE has the following screen:
① This area is for creating a program: When you create a new file, “void setup ()” and “void loop ()” are displayed. In “void setup (),” describe the process that’s executed only once when starting Arduino. In “void loop (),” describe the process that’s to be executed on repeat. Write settings to setup () and normal processing to loop (). Note that a message starting with “//” will be displayed, but no problems will happen even if you delete the memo.
② Program checks and errors are displayed: If there’s a problem with the program itself, use the messages displayed here to find the mistake.
③ Check the created program: Click to check if the created program is correct.
④ Send the created program to Arduino: When the program is sent, it’s executed on the Arduino, and the electronic components can then be controlled. The program also checks if things are correct before transferring.
⑤ Create a new program: When you create a new tab, it’ll be displayed separately.
⑥ Read the file
⑦ Save the program to a file
⑧ Displays data from Arduino and displays “Silaru Monitor,” which can send commands to Arduino
⑨ When multiple programs are open, it’ll be displayed in separate tabs
⑩ Displays a menu for tab operations such as closing and switching tabs
Now, let’s try operating the electronic parts with a program actually made with Arduino IDE. Arduino Uno has an LED that can be controlled by a program that can turn it on and off, thus creating a program that blinks the LED every second. Start up Arduino IDE and input the program as follows.
Once entered, click “Validate” (check mark) on the toolbar to make sure there are no mistakes.
If there are no problems, transfer onto Arduino. To transfer the program, connect Arduino and your computer via USB. Then, Windows can recognize Arduino and communicate. To communicate, make settings in Arduino IDE. Select “Serial Port” from the “Tools” menu to list the currently available ports. Select the port where the name of the connected Arduino is displayed, such as “COM4 (Arduino / Genuino UNO)”.
Additionally, select the type of connection. Select the Arduino that you want to be used on the “Board” in the “Tools” menu. For Arduino Uno, select “Arduino / Genuino UNO.”
Now, click “Write to microcomputer board” (arrow icon) on the toolbar to transfer the program. When the transfer is complete, the program will run, and the LED will start blinking.
Connecting electronic parts with a breadboard
Electronic components are equipped with metal terminals. By connecting metal leads and other electronic components onto this terminal, electricity can pass through, and the electronic components can then be controlled.
To attach electronic components, use solder. Metal solder melts at a relatively low temperature of about 200 degrees. You can join these components by melting the solder using a soldering iron and pouring it into the terminal joint.
However, soldering is a time-consuming process and cannot be easily removed even if you want to remove the electronic components.
The bullet board is useful for checking the operation of electronic components and creating electronic circuits for prototyping work. There are many holes in the breadboard to allow you to insert electronic components. Since it’s just plugged in, it can be easily removed whenever it comes off.
A breadboard is generally connected to a large breadboard in the center and an elongated breadboard at the top and bottom. The center breadboard has vertical columns connected inside. For this reason, electronic parts inserted in the same row are connected. Also, there’s a groove in the center, and the upper and lower rows are divided across the groove.
The elongated breadboard has all the holes in the horizontal row connected inside. It’s used to connect to frequently used terminals such as power supplies.
Use a “jumper wire” when connecting to different rows of breadboards or Arduino. The jumper wire is a metal conductor; both ends are pin-shaped so that it can be connected to the breadboard hole or the Arduino terminal.
Breadboards and jumper wires can be purchased from electronic parts shops. If you choose a slightly larger breadboard, you won’t have to spend time buying more electronic components later. Dozens of jumper wires should be purchased.
Breadboard: A breadboard with 63 columns and 10 rows of holes; equipped with a breadboard with 50 columns and two rows above and below; can be purchased for $3.00
Jumper circuit: About 60 jumper wires of differing lengths; you can purchase for $2.20
Let’s set up a blinking “LED” using a breadboard. This time, we won’t explain how to use the electronic components to test that the electronic components can be connected and operated on the breadboard. Detailed functions and usage will be explained in future posts.
The following electronic components are used:
Red LED: This LED lights up red when electricity is applied. This time, we’ll use the 5mm diameter red LED “SLR-56VC3F.” It’s possible to substitute similar LEDs because they often operate in the same way.
Resistance 330Ω(1/4W): This is used to limit the electricity from flowing too much into the LED. We’ll be using a 330Ω resistor.
When you have all the LEDs and resistors, use a breadboard to connect to Arduino. When connecting electronic components, unplug the USB cable from the Arduino so that no electricity is supplied. If you work while electricity is flowing, you could damage your electronic components and Arduino if you make a mistake.
Insert as shown below:
LEDs have polarity. The long terminal is called the “anode” and connected to the positive side of the power supply, and the short terminal is called the “cathode” and connected to the negative side of the power supply. Note that if connected in reverse, it won’t light properly.
Connect a resistor to the tip of the LED cathode. Since the resistor has no polarity, it doesn’t matter which way you connect it.
Connect the anode side of the LED to the terminal where Arduino can control the electronic components. In this case, the jumper wire is used to connect to the terminal marked “13” of “DIGITAL” on the upper side of Arduino Uno. This terminal is connected in parallel with the LED mounted on the Arduino, and can control the electronic components connected to the outside with the same output. If the LED is externally attached to “13,” it’ll operate in the same way as the mounted LED.
Connect the resistor LED to the opposite terminal of the Arduino “GND” terminal using a jumper wire.
Once connected, write the LED flashing program to Arduino. Since it’s connected to the same terminal as the LED control on the Arduino, if you use the LED flashing program described above, the external LED will also flash. If you haven’t written a program, write the program referring to the procedure described above.
This will run the program, and the external LED will blink.
You’re now ready to use Arduino! In the next article, we’ll explain the “Basics of Electricity to Remember” and “Control Method of LEDs.”