Arduino — Beginning with Basics



What is Arduino?

Arduino is an open-source electronics platform based on easy-to-use hardware and software. Intrinsically, Arduino boards read inputs such as — light on a sensor, a finger on a button, or a Twitter message and transform it into an output like — activating a motor, turning on an LED, publishing something online. Over the years Arduino has been the brain of thousands of projects, from everyday objects to complex scientific instruments. Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping, aimed at students without a background in electronics and programming. As soon as it reached a wider community, the Arduino board started changing to adapt to new needs and challenges, differentiating its offer from simple 8-bit boards to products for IoT applications, wearable, 3D printing, and embedded environments.

Why Arduino?

  • Inexpensive — Arduino boards are relatively inexpensive compared to other microcontroller platforms.
  • Cross-platform — The Arduino Software (IDE) runs on Windows, Macintosh OSX, and Linux operating systems.
  • Simple programming environment — The Arduino Software (IDE) is easy-to-use for beginners, yet flexible enough for advanced users to take advantage of as well.
  • Open source and extensible software and hardware — The plans of the Arduino boards are published under a Creative Commons license, so experienced circuit designers can make their own version of the module, extending it and improving it. The Arduino software is published as open source tools, available for extension by experienced programmers.

What is the Arduino IDE?

The Arduino Integrated Development Environment (IDE) is a cross-platform application (for Windows, macOS, Linux) used to write and upload programs to Arduino compatible boards, and can be used for other vendor development boards as well. It includes a code editor, a compiler, and an uploader. Code libraries for using peripherals, such as serial ports and various types of displays are also included. Arduino programs are called “sketches,” which are written in a language very similar to C or C++.

Arduino Uno

If you’re a beginner and are new to the Arduino family, the Uno serves as the perfect fit for your first Arduino. It’s got everything that you need to get started on your journey of exploring with electronics. It’s a microcontroller board based on ATmega328 (single-chip microcontroller formed with Atmel) and consists of 14 digital input/output pins, 6 analog inputs, a USB connection, a power jack, a reset button and more. It contains everything you need to support the microcontroller. All you have to do is simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

Image for post

In this blog, we’ll discuss the basic procedure to set up the Arduino and test-run a simple code, to verify the setup.

Steps for setting up Arduino

  1. First, download the Arduino IDE software from the Arduino website.
  2. Then, install it on your PC.
  3. Once you run the exe file and open the application, you’ll see the following layout

Image for post

4. An Arduino program includes two main functions:

setup() — The setup() function is used to initialize settings for the board. This function runs only once when the board is powered on.

loop() — The loop() function is executed after setup() completes, and unlike the setup() function, it runs continually.

5. Now connect your Arduino Uno to your PC with its USB cable. The USB connection with the PC is necessary to program the board and not just to power it up. The Uno automatically draws power from either the USB or you can connect an external power supply.

Image for post

6. Now go to Tools and select the Board

Image for post

7. Once you’re done with this, open your first sketch.

Go to File > Examples > 01.Basics > Blink.

The Blink example shows the simplest activity you can do on the Arduino board: it blinks the on-board LED.

8. After opening the example, verify and upload the sketch onto the board.

9. The program basically turns on the LED on board with the line digitalWrite(LED_BUILTIN, HIGH) and turns it off withdigitalWrite(LED_BUILTIN, LOW).

10. The delay() commands tell the board to do nothing for 1000 milliseconds (one sec).

Once you run the code, you should be able to see your on-board LED blink for a second. Using this program, you can verify whether your Arduino is functioning properly and ready for further use.

In this blog, we introduced you to Arduino, the Uno board and discussed its ease and versatility. We also explored the steps to setting up the board and verifying the process.