What is Arduino？
Arduino is an open-source hardware and software platform designed for computer programmers, industrial artists, professionals and those interested in developing interactive devices and applications specific to an interactive development environment.
Arduino can receive input signals from various sensors and inputs. By controlling light sources, motors, or other actuators, Arduino can change the surrounding environment. Programs for the microcontroller on the Arduino board are written in Arduino’s programming language (based on “Wiring” - an open source framework for microcontrollers) and run in the Arduino development environment (based on “Processing” - an open source programming language and integrated development environment).
Arduino is able to run independently or communicate with software running on a computer (for instance, Flash, Processing and MaxMSP). The open-source Arduino IDE, which is free to download, makes it easy for you to write code, upload it to the board and come up with your own interactive devices.
What can you do with Arduino?:
◆ Make a line-following robot
◆ Make a fluffy toy that lights up
◆ Make your phone ring when you receive an e-mail
◆ Make a Metroid-style arm cannon
◆ Make a coffee maker that sounds an alarm when your coffee is ready
◆ Make device that can record your heart rate when you ride your bike
All of these things can be achieved with Arduino!
The Birth of Arduino
Arduino started in a small picturesque town in northern Italy as as a project for students at the Interaction Design Institute Ivrea. Members of Arduino’s core development team were Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, David Mellis and Nicholas Zambetti.
Massimo Banzi’s students often complained that they couldn’t find a cheap and easy-to-use microcontroller. In the winter of 2005, Banzi mentioned this issue while talking with David Cuartielles, a Spanish chip engineer who was a visiting scholar to Massimo’s university. They decided to design their own circuit board and brought Banzi’s student David Mellis into this project to design the programming language for their board. Mellis finished the source code within two days. It took them another three days to etch the circuit board. They named it Arduino.
Now, anyone is able to make magic with Arduino, even without knowledge of computer programming. With Arduino, you can make a device respond to its0 environment, make flashing light shows.
Ivrea is famous for the story of an oppressed king: In 1002 AD, King Arduino took the crown of Italy; however, in 1004 AD, he was dethroned by King Henry II of Germany.
There is now a bar named “de Re Arduino” on Cobblestone Street in Ivrea which was opened in commemoration of King Arduino. Massimo Banzi was a regular customer there, and he fondly named his open-source hardware platform after it.
Introduction to DFRduino
In these lessons we will use DFRobot’s own clone of an Arduino Uno board: “DFRduino Uno”. DFRduino operates in exactly the same way as an Arduino Uno. To save confusion with names, let’s just call it the microcontroller. Let’s examine its features:
Voltage supply is also shown on the diagram below. DFRduino can be powered either by a USB connection or through a 6～12V DC supply via the barrel jack connector. Also integrated in to the board are four LED lights and a reset button. The LED light marked with “ON” is the power indicator, which will be on once power is connected. The LED light marked with ”L” is an indicator for digital pin 13 which will be discussed in the next section. TX (transmit) and RX (receive) are indicator lights for serial communication. When we upload a program, these two lights will blink rapidly, showing that data is being transmitted and received between the board and your computer.
Sections with annotations below are parts that will be regularly used. Digital pins and analog pins marked on the diagram are what we call I/O (input/output). Digital pins are numbered from 0 to 13. Analog pins are numbered from 0 to 5.
1. Download Arduino IDE
You can download Arduino IDE from this website:
For Windows users, please click "Windows (ZIP file)". For Mac and Linux users, please select the corresponding link for your operating system.
Once downloaded, extract the files to a directory of your choice. Once extracted, open the directory. It should look like the image below:
2. Install Drivers
Connect the microcontroller to your computer using a USB cable. Once connected, the board’s power indicator light will turn on.
Open “Control Panel” and navigate to “Device Manager” to set up the drivers.
You will then see a dialog box pop up. Select the second item “Manually Search for Drivers”. A browse window will appear that requires you to point it to the correct directory.
Navigate the browse dialog to your Arduino directory. Inside this directory, there is a subfolder called “drivers” where the Arduino drivers are stored. Select this directory and then click “Next”.
Hopefully this window will appear. This shows that drivers have been successfully installed!
If you encounter issues, check this website for help: https://www.arduino.cc/
Return to “Device Manager”. The computer will have assigned a serial port to the microcontroller (your computer will show it as Arduino Uno). The serial port will vary depending on your computer, but should appear as “COM”, followed by a number.
3.Introduction to Arduino IDE
Inside your Arduino directory, open “Arduino.exe”. The application will open and the code editing interface will appear.
If you wish to change the language of the interface, select “File” and then “Preferences” to open preferences.
The dialog box shown below will pop up. Select “Editor Language”, choose your language and then click OK.
Close Arduino IDE and then reopen it for the changes to take effect.
We will use Arduino IDE a lot in these tutorials, so lets learn about its features:
Arduino IDE allows you to edit and upload programs to your microcontroller. Arduino IDE calls programs “sketches”, but in these tutorials, we will simply say “program” or “code”, rather than “sketch”, but they really mean the same thing.
The interface shown in the picture above is where you’ll write and upload code within Arduino IDE. The main white area is where you input code. We use the C programming language to program the microcontroller, which we will discuss in more detail in later chapters. When you press “verify” or “upload” , the code instructions you have written will be translated in to machine language by a piece of software called a “compiler” so that the microcontroller can understand it. This process is called “compiling” or “verifying”. Messages shown in the black area will show information about the compiling and upload process.
4. Upload a Blink Program
Let’s upload a simple program to become familiar with the uploading process and to test the microcontroller. This code will turn the “L” LED light on the microcontroller on and off. The location of the “L” LED is circled in the diagram below.
Connect your computer to the microcontroller via the USB.
In the Arduino IDE, go to File > Examples > 01.Basics > Blink.
As this is an example program, there will be no syntax errors in the code. When we write code ourselves we can click “Verify” to check if there are any syntax errors. Try it now.
Hopefully you will see this message:
Before code is uploaded to the microcontroller, the IDE will automatically verify it.
If there are any errors in your code, a big ugly orange message box will appear above the compiler window indicating a problem, and your code can not upload until it is fixed!
Before we can upload a program, we need to tell the computer where to send it. In Arduino IDE, we need to select which type of Arduino board we are using as well as the serial port that the board is connected to.
Navigate to Tools > Board and then select Arduino UNO from the list. That’s it!
(There are many different types of Arduino board of all shapes and sizes. Some have more RAM and more I/O pins and can hold larger programs.
We are using an Arduino Uno variant, so we must select Arduino Uno from the boards list.)
Now select the serial (COM) port. Navigate to Tools > Port and your available serial ports will be listed. Usually this will be “COM” followed by a number. Select the available port.
In our example the board is connected to the computer on COM36.
We should now be able to upload code to the microcontroller.
Click upload in Arduino IDE. If all is well, the code will verify and then upload to the microcontroller.
When the upload has completed successfully, the microcontroller will automatically reset
and the code will execute. Is the light blinking?
This concludes the blink tutorial.
To review, there are three fundamental steps to upload
code to your microcontroller:
1. Verify code
2. Select board and COM port
If you have any questions or comments about this arduino tutorial, feel free to comment.
There is also another arduino starter kit for you to choose.