Getting Started With Arduino: Beginner’s Complete Guide

This is a comprehensive guide for getting started with Arduino programming for electronics beginners. If you’re just starting with Arduino and electronics programming (Embedded Systems), this is the ultimate beginner’s guide that you need to follow.

In this beginner guide, we’ll cover everything you need to know to get started with Arduino and know exactly how you should proceed further to learn more about Arduino Programming for electronics and be able to turn your ideas into amazing real-world projects that you can share with everyone.

Table of Contents

  1. What is Arduino?
  2. What Can You Do With an Arduino?
  3. Getting Started With Arduino
  4. Setting Up Your Arduino
  5. What You’ll Need For This Guide?
  6. Arduino Starter Projects For Beginners
  7. Download Attachments
  8. What To Do Next?

What is Arduino?

Arduino is a platform for building electronic projects that have been designed specifically to help beginners get started with programming electronics (Embedded Systems). It’s an open-source project which means users can contribute to the project or just use it freely to build their own electronics projects.

In other words, Arduino is not just the name of the board or the company behind the project. It’s a whole ecosystem that consists of: Arduino Boards (the hardware part), the Arduino Core drivers & libraries (the firmware part), the Arduino Programming Language (based on C++), and the Arduino IDE (integrated development environment). The aggregate of all these parts gives us what we call “Arduino“.

Arduino-Uno-Jpeg

The first released Arduino boards were based on AVR microcontrollers and Arduino C++ programming language for developing applications with these boards. Newer releases of Arduino boards come with different microcontrollers nowadays with so many options ranging from tiny low-speed microcontrollers up to multi-core ARM-based microcontrollers with very powerful computational resources.

Switching between Arduino hardware boards puts no extra burden on the user at all as Arduino core drivers are designed to be extremely portable so your code will run exactly the same even if you’ve switched the board model for whatever reason.


What Can You Do With an Arduino?

Just like other microcontrollers, Arduino is no exception as it can be used to create an infinite number of embedded systems applications. It’s even much simpler and easier to use for prototyping than the original microcontrollers’ toolchains themselves. Which makes Arduino the perfect candidate for makers around the globe to base their projects on.

The projects you can create with an Arduino board range from very simple LED flashing to complex robotics and control systems. These include, but are not limited to, the following:

• Traffic light
• Audio Synthesis & players
• Midi controllers
• Lighting systems
• Robotics & Control Systems
• Home Automation
• IoT and Wireless Control
• CNC Machines & 3D Printers
and more…

You can virtually create an infinite number of applications and turn your ideas into real applications that you can share with the world. By following this Arduino Programming series of tutorials, you’ll be able to formulate your project idea into SW/HW requirements. And you’ll learn how to do the requirement analysis and design Embedded Solutions to meet the project requirements on time and on budget.


Getting Started With Arduino

Arduino has been known for easing the way for beginners, hobbyists, and makers with non-engineering backgrounds to get started with electronics and programming embedded systems. However, there is still some basic common ground that we all need to have in order to make sure everyone is familiar with concepts and terminologies related to Embedded Systems & Electronics.

While working with Arduino, you’ll be creating Embedded Systems and dealing with Electronics. Both of these are very technical engineering disciplines and require a lot of research and study to master. But, luckily you don’t need a degree in any of which to get started with Arduino.

We’ll need to cover the fundamental concepts and physics rules that apply to the work we’ll be doing hereafter in this series of tutorials. To make sure all the readers are at the same common ground before jumping into Arduino tutorials & projects.

Here is a summary of what we’ll discuss in each of the following sections

Topic HeadlineWhat We’ll Discuss?
Arduino Hardware FundamentalsIn this section, we’ll discuss the HW fundamentals that you need to know to get started with Arduino
Arduino Software FundamentalsIn this section, we’ll discuss the SW fundamentals that you need to know to get started with Arduino
Arduino PrototypingIn this section, we’ll discuss how to prototype your Arduino project with real hardware
Arduino SimulationIn this section, we’ll discuss how to simulate your Arduino project in software. (it’s not mandatory but it can be really helpful)

1. Arduino Hardware Fundamentals

In this section, we’ll go through the hardware fundamentals that you need to know before getting started with Arduino. This guarantee that all the readers are on the same page and it’s going to maximize the outcomes of this Arduino series of tutorials overall.

1.1 Arduino Board Analysis

From a Hardware Perspective, we can look at the most popular Arduino board (Arduino UNO) and note that it has the following parts:

Arduino-Uno-Pinout-And-Specs

The Arduino UNO board has some digital IO pins which we’ll be using to interface various modules, sensors, and electronic circuits. And a USB port for serial communication and sending (flashing) new code to the microcontroller itself. One nice feature of the Arduino Uno R3 is the DIP package for the main microcontroller (Atmega328p) which can be replaced easily if you’ve damaged your microcontroller for whatever reason.

There is an ATmega16U which is another microcontroller on the board handling the USB-Serial communication and flashing new firmware to the Arduino main (Atmega328p) microcontroller. Therefore, there are “technically” two microcontrollers on the Arduino Uno board.

The power supply input jack will accept up to 12v of DC input voltage, but it’s advised to give it 5v, 6v, or 9v at maximum to reduce the power dissipation (LDO heating). There are 2 voltage regulators providing 5v output and 3.3v output in the power pins section.

We also have 4 LEDs, one for power indication, one for general-purpose usage connected to IO pin 13, and another 2 LEDs used as serial communication indicators for RX and TX. And only one button for resetting the Arduino microcontroller, so it will restart the execution of your last program from the very beginning of code instructions.

The Arduino UNO board is what we’ll be using in all tutorials hereafter but you can definitely pick another Arduino board and still follow our tutorials with no issues at all. Here is an article that will highlight the technical specifications and differences between Arduino boards.

1.2 Arduino Microcontroller Analysis

From an Embedded Systems Perspective, we can take a deeper look into the main microcontroller of an Arduino UNO which is Atmega328p. It has a simple architecture compared to other microcontrollers in fact. Here is how it looks internally.

Don’t get intimidated by the looks of it, it is rather more simple than it may seem. The AVR CPU is the core of this microcontroller which is connected to all Peripherals (Timers, IO ports, ADC, SPI, UART, etc.) and the RAM via the Data Bus. The CPU is connected to the Flash memory (where your programs will be stored) via the Program Bus.

The microcontroller’s CPU will read your code from the Flash memory instruction-by-instruction via the program bus. It’ll decode and execute each instruction and write the data to the RAM memory and peripheral control registers via the data bus. The data written to the RAM and peripherals registers is what makes the IO pin states change, serial data come out/in, and all the magic that Arduino does.

Everything the microcontroller does boils down to 1’s and 0’s moved from Flash to CPU and from the CPU to the RAM registers. It’s all about moving the right bits to the right registers at the right time.

Next, I’ll give you a brief description of the major parts of a microcontroller that you need to know.

AVR CPU

Arduino-AVR-CPU

This is the core of the Arduino board that does all the logic operations or in other words, it executes the program you’ve given to it. The Atmega328p core runs @ 16MHz at maximum and it performs up to 16 MIPS (million instructions per second). It has a digital multiplier unit for multiplication operations acceleration but it lacks an FPU (floating point unit).

This means floating-point arithmetic is going to be emulated in software and will take significantly more time than fixed-point arithmetic. But at the end of the day, it’ll handle any fixed-point or floating-point operations you may need in most applications.

The CPU core has also simple interrupt circuitry which enables it to receive interrupt signals from various sources. This allows an almost instantaneous response from the CPU to certain HW/SW events as we’ll be discussing in more detail in later tutorials.

Flash Memory (ROM)

Arduino-Flash-Memory-ROM

The Flash memory which is also known as ROM (Read-Only Memory) is where your code will eventually reside on the microcontroller. The Atmega328p has a 32kB flash memory that can be used to store your program (firmware).

The Flash memory has a 10,000 Write/Erase cycles lifetime which means it will permanently get damaged after exceeding this number of writing operations. Practically, it can take several years to reach this limit or even forever for most of us.

RAM Memory

Arduino-RAM-Memory

The RAM (Random Access Memory) is also known as SRAM (static random access memory) and it’s used by the CPU to store the program data, context, and it has the SFRs (special function registers) that are used to control all peripherals on the microcontroller.

The Atmega328p has a RAM memory size of 2kB which is not a lot but for most simple applications will be just enough.

It’s worth noting that the contents of the RAM memory get whipped out when the microcontroller is powered off or goes into a hard reset. If you’ve got a counter variable in software and it was counting when the microcontroller’s power went down, it’ll restart the operation all over again from the beginning of the code. The Flash memory (where the code is stored) on the other hand, is NVM (non-volatile memory) that doesn’t lose its data when the power goes off.

EEPROM Memory

Arduino-EEPROM

The EEPROM (Electrically Erasable Read-Only Memory) is another form of NVM (Non-Volatile Memory) that you can use to store data that you need to save even if the power goes off, it’ll stay there on the EEPROM.

The Atmega328p has a 1kB of EEPROM space that you can use for permanent data storage, which is more than enough for most applications. And you can still connect external EEPROM memory ICs if needed by your application.

❕ Note

Non-Volatile Memories are typically used when we need to save some data and need the microcontroller to remember it even if it lost power or got restarted. Typical use cases for data that we need to store in NVS include the following application examples:

  • Passwords (Credentials)
  • User Configuration
  • App-Level Parameters
  • Sensor Last Reading
  • State Variables (for some state machines)
  • Sensor Calibration Data
  • and much more…

The EEPROM has much higher Endurance (write/erase cycles) compared to the Flash memory, it’s almost 10x times more. The EEPROM has around 100,000 write/erase cycles for each memory location. This doesn’t mean you don’t need to be careful with it, always try to optimize and minimize the number of times you write to the memory.

❕ Note

Please, be cautious when using any sort of NVS memory as it can easily get damaged permanently if you’re not wisely using it. Try to avoid unnecessary regular writing cycles to the NVS unless it’s mandatory. Better implementations do have some wear and tear leveling algorithms in order to distribute the memory utilization across all of the sectors so you have a longer FLASH memory lifetime.

If you keep writing to the same memory section addresses over and over again, it’ll eventually get permanently damaged and this can happen rather quickly if no attention is paid.

Digital IO Ports

The Digital IO (input/output) pins enable the Arduino to get inputs and send output to the surrounding environments. It has a total of 14 digital IO pins that can be used either as output or input pins.

The pins are arranged into ports, each port is a pack of 8-pins as you have seen in the microcontroller architecture block diagram. But note that some IO pins of the Atmega328p are already used passively for the Arduino board hardware circuits and we’ve got only 14 IO pins free to use.

There are, however, IO expander ICs that can solve your problem if you run out of IO pins in your project for any reason. We’ll discuss external IO expanders interfacing in a future tutorial of course.

A/C Converter (ADC)

Getting-Started-With-Arduino-Beginners-Tutorial-ADC-Block-Diagram

The A/D Converter or the ADC (Analog to Digital Converter) is one of the most critical resources on the Arduino’s microcontroller. It’s used for converting analog signals to digital data that can be processed by the CPU.

All signals are analog in nature and we need the ADC to capture this analog information and convert it to digital numbers that the CPU can understand & process.

The Atmega328p has an 8-Channel 10-Bit resolution ADC with internal temperature measurement capability.

Serial Communication

Arduino-Serial-Communication

The Atmega328p has several serial communication ports that include the following:

  • 1x UART (Universal Asynchronous Receiver Transmitter)
  • 1x SPI (Serial Peripheral Interface)
  • 1x TWI (Two-Wire Interface) = I2C (Inter-Integrated Circuit)

Each of which can be used to interface different sensors and modules with the Arduino microcontroller. We’ll dive deeper into the detailed operation and specifications of each serial communication port in separate tutorials.

Timers (CCP)

Getting-Started-With-Arduino-For-Beginners-Timers

The Arduino Uno (Atmega328p Microcontroller) has 3 timers with the following specs:

  • Timer0: 8-Bits
  • Timer2: 8-Bits
  • Timer1: 16-Bits

The number of bits for each timer dictates the range of counting it can have (for 8 bits: 0 up to 255, and for 16 bits: 0 up to 65535). And you can use the timers in timer mode to generate or measure time intervals between various events in software or hardware. Alternatively, you can use them in counter mode to count external pulses (signals or events).

The timer modules are also known to have CCP (Capture Compare PWM) functionality which can be defined as follows:

  • Input Capture Mode: In this mode, the timer will be free-running, and when a specific input pin state changes (rising, falling, or whatever you choose), the value of the timer register is captured and stored in a dedicated register. This mode is very useful for so many applications like measuring the pulse width of any digital signal for example.
  • Output Compare Mode: In this mode, the timer register value is constantly compared against a pre-stored value in the compare register. When the timer’s value matches the compare value, an event is triggered which will result in a pin state change (a specific pin will go high or low depending on your settings).
  • PWM Mode: In this mode, the timer is used to generate a constantly changing digital signal with a specific frequency and duty cycle. It’s called PWM (Pulse Width Modulation) and it’s widely used for so many applications like motor control, LED brightness control, and much more.

We’ll definitely dedicate multiple tutorials for a deeper discussion with many examples to demonstrate each of those modes in more detail in future tutorials.

Watchdog Timer (WDT)

Getting-Started-With-Arduino-Beginners-Tutorial-Watchdog-Timer

The Watchdog Timer (WDT) is a specific timer that is sued to guarantee that the microcontroller is executing the program normally and it’s meeting the application’s timing requirements.

The WDT will count until a specific time, when the time comes it will reset the microcontroller and the application will restart from the very first command. Which is not a good thing to happen indeed.

The WDT is designed to be kicked in software (reset its value) at fixed time intervals, if the CPU fails to satisfy this condition, the WDT will kick back a reset to the whole microcontroller. Let’s say we’ve programmed the WDT to overflow every 2ms, and we have only one task running every 1ms in which we do some operations and also kick the WDT.

The 1ms task should be executed in a total time period that does not exceed 1ms or this task will no longer be executed every 1ms and the timing constraint will be violated. If, for any reason, the CPU got stuck and the 1ms task took more than 1ms or even 2ms, what should happen? at the 2ms time mark, the WDT will trigger a reset and the whole program will re-run again from the beginning.

The WDT is a huge topic and there are countless applications that can’t run safely without it. We’ll definitely revisit this topic in a separate tutorial with a couple of examples to clarify it in much more detail.

1.3 Circuits & Electronics Basics

For Getting Started With Arduino as a Beginner, you need to know some circuits & electronics basics to be able to create your own circuits and projects. At the end of the day, the Arduino board is just a part of the whole embedded solutions that you’ll be creating. Therefore, you still need to know physics rules that apply to electronic circuits and some electronic devices basics as well.

Ohm’s Law

Ohm’s law is a fundamental law for electric circuits that states the following: ( Voltage = Current x Resistance )

It can be rearranged in 3 different ways as expressed by the triangle graphic above. You’ll most probably need this for designing simple circuits for LED drivers, motor control with transistors, and other applications that require circuit design.

Kirchhoff’sVoltage Law (KVL)

Kirchoff’s laws for circuits are also fundamental laws that you need to learn while getting started with Arduino. Especially, the KVL (Kirchoff’s Voltage Law). Which states that the summation of voltages across the entire circuit will always sum up to zero.

Arduino-Kirchoffs-Voltage-Law-KVL

In the example circuit shown in the figure above, we’ve got a simple LED circuit with a battery, LED, and resistor. The summation of voltage drops across each element will add up to zero. Which can be rearranged to be ( VR = VIN – VL ) to find out the voltage across the resistor given the battery voltage and LED voltage drop value.

It will help you in many situations while you’re designing some circuits for driving output loads with Arduino.

Voltage Divider Rule

The voltage divider rule is also a fundamental concept in electronic circuits that you need to learn. It states that the voltage drop established by connecting two series resistors with a voltage source will equal VOUT = VIN x [ R2 / (R1+R2) ].

Sometimes you need to set an analog voltage reference with a specific value, the voltage divider rule will help you achieve this target with ease. And it will also help you understand how potentiometers work as well.

LEDs

LEDs (Light Emitting Diodes) are very common electronic parts used in various projects and their working principle is rather simple. It just needs some attention for calculating the needed resistance in order to limit the current that will go through the LED to avoid damaging it.

For an LED to turn ON, you need to establish a positive voltage between the anode and the cathode that’s larger than the VF of the LED itself. The forward bias voltage drop VF varies from one LED to another depending on its color and semiconductor material. It ranges from 1.8v up to 3.3v.

Let’s consider a typical Red LED, it’s going to have a forward voltage drop of 1.8v. And as you can see in the figure above for an LED to turn ON bright, 10mA of current needs to flow through it. Given that the Arduino IO pins output high level is 5v, find out the resistor value that limits the current through the LED to only 10mA.

Here is what the circuit will look like.

Arduino-LED-Resistor-Calculation

We first need to find the voltage across the resistor (VR), which is easily achievable with KVL (Kirchhoff’s Voltage Law). Next, we’ll use Ohm’s law to find out the required resistor’s value. It turned out to be 320Ω, and the nearest standard resistor’s value is 330Ω. That’s why you always see Arduino LED circuits have a 330Ω resistor in series with the LED.

And you now know that it depends on the LED color and it may need to draw more current to give a brighter glowing effect, and this can be achieved by having a lower resistance value.

Transistors

Arduino-Transistors

Transistors are considered to be “Electronic Switches”, you can think of a transistor as a switch that can be turned ON or OFF with a digital signal we send from the Arduino microcontroller. Transistors are widely used in so many applications not only as switched but the very basic use of a transistor that we’ll encounter here in this series of tutorials is switching different loads on and off.

There are so many types of transistors depending on the technology/materials of fabrication. The most common transistor types we’ll encounter hereafter are the BJT (Bipolar Junction Transistors) and the MOSFET (Metal-Oxide Field Effect Transistors).

Generally, we’ll use the BJT transistor for switching light loads on and off. And will be using the MOSFETs for the heavy loads switching.

Analog & Digital Signals

Analog signals are continuous signals that can have any value within a certain range. For example, a potentiometer can be used to generate an analog signal that can have any voltage between 0V and 5V. Another example is a microphone, which generates an analog signal that represents the continuous variation in air pressure caused by sound waves.

On the other hand, digital signals are discrete signals that can only have two values: 0 or 1. These values are represented by two voltage levels, typically 0V and 5V for Arduino (it can be 0v and 3.3v for certain microcontrollers). Digital signals are used to represent information that can be expressed as a sequence of bits, such as text, images, or sound files. Digital signals are also used for controlling electronic devices, such as turning an LED on or off.

Arduino-Analog-vs-Digital-Signals

In order to work with analog signals, the Arduino has a built-in analog-to-digital converter (ADC) that can convert an analog voltage into a digital value that the Arduino can read. It’s worth noting that while analog signals can theoretically have an infinite number of values within a range, the resolution of the ADC on the Arduino limits the number of discrete values that can be accurately measured. Given that the Arduino’s ADC is 10 bits in resolution, therefore it can represent analog voltages into 1024 discrete digital levels.

Digital IO Pin States

The Arduino’s Digital IO pins can be in one of the following states at any given time:

  1. HIGH: When the pin is set to be in output mode, it can be driven to a High state (Logic 1) corresponds to an analog voltage level of 5v
  2. LOW: When the pin is set to be in output mode, it can be driven to a Low state (Logic 0) corresponds to an analog voltage level of 0v
  3. Hi-Z: or High-Impedance mode. When the IO pin is set to be input, the IO pin will go into Hi-Z mode which means it’s no longer connected to the IO pin output driver. This means it’s not 0 or 1, and the analog voltage on the pin is not predictable and will be susceptible to external noise.

From this, we conclude that when any IO pin is set to be input, it can’t be left in the Hi-Z (or Floating) state. The external noise will disrupt the system behavior and it will no longer be predictable. The solution for this is to make a pull-up or pull-down configuration for your input pin.

A single 10kΩ resistor will do the job. Check the figure below for a visual representation of the same information. (It was created for an ESP32 tutorial but the information is perfectly true for Arduino or any other microcontroller out there).

ESP32 Digital Inputs Outputs Arduino tutorial - Pull up and Pull down

1.4 Basic Electronics Parts

If You’re Just Getting Started With Arduino as a Beginner, you need to know the basic electronic parts that you’ll most probably use in all projects afterward. In this section, we’ll discuss some of these basic components that you need to know.

Breadboards

This is going to be your best friend in your journey with electronics and Arduino programming. It’ll help you easily prototype your project, and test everything out before making the move to PCB design for fabrication. You can easily catch errors and bugs in both software and hardware circuit and fix your design issues on a breadboard.

Resistors

Arduino-LED-Resistor

Resistors are used for current limiting and establishing a voltage drop of a certain value.

Potentiometers

Arduino-Potentiometer

Potentiometers are usually used to set an analog input voltage level that we read by the Arduino’s ADC converter. And can also be used for different other applications like setting the brightness level of an LED or LCD display screen for example.

LEDs

Arduino-LEDs

LEDs are the most commonly used output devices that we always use for displaying digital output, debugging the logical behavior of our code, and other applications.

Push Buttons

Push buttons are considered the simplest input device that you can use to give an input signal to your Arduino board so it can react accordingly. The 4-pin tactile push button is the most common form of it and it connects the 2 pins on the right to the left 2 pins while it’s held down. Releasing the button will disconnect the pins again back to the normal state.

1.5 Sensors, Actuators, and Drivers

While getting started with Arduino, you need to learn what are sensors, actuators, and drivers. And to know the different types and use cases for each of them.

What is a Sensor?

A sensor is an electronic device that converts a physical signal or quantity into an electric signal which can be either analog or digital. Most signals are analog in nature and sensors are designed to convert those quantities into electrical analog signals. There are so many types of sensors that can be used in electronics projects such as:

  • Light Sensors
  • Temperature, Humidity, and rain Sensors
  • Motion Detection Sensors
  • Distance & Object Detection Sensors
  • IMUs (Inertial Measurement Units)
  • Medical Sensors
  • Chemical Gases Sensor
  • Force, Flex, and Weight Sensors
  • and more…
 

We’ll interface a lot of sensors with Arduino in this series of tutorials. So make sure to follow along to learn more about various sensors interfacing with Arduino.

What is an Actuator?

An Actuator is a device that is used to actuate or change a physical state. It can be viewed as a converter for electric energy to other forms of energy (light, heat, motion, sound, etc). Examples of Actuators include, but are not limited to, the following:

  • Light Units (e.g. LEDs)
  • Loud Speakers
  • Motors (DC, Servo, Stepper, etc)
  • Solenoids / Valves
  • Relays (Contactors)
  • Electromagnets
  • Heaters / Coolers

There are so many actuators that we can use to make actions in the surrounding environment by the Arduino microcontroller. Usually, actuators are heavy loads that need a significant amount of current in order to operate or do the action they do.

Actuator’s load current is always beyond the digital IO pins’ capabilities of the Arduino microcontroller. You just can’t drive a 1A DC motor directly with the digital IO pin that usually has a maximum safe limit of around 20mA or 25mA. Therefore, we need what’s called “Drivers” for driving heavy loads (such as actuators) with the Arduino.

What Are The Drivers?

As we’ve stated in the previous section, an Arduino is not capable of directly driving heavy loads that require a significant amount of current with only IO pins. Instead, we need Driver circuits or devices to do this job and stand between the Arduino and the load device.

A driver can be as simple as a single transistor (BJT or MOSFET) or a more complex dedicated board for driving a specific type of load such as:

  • H-Bridges: For DC Motors Driving
  • ESCs: For Brushless Motors Driving
  • Stepper Driver Boards: For Stepper Motor Control
  • RGB Strip Drivers: For RGB LED Strip Control & Drive
  • Inverter Bridges: For PMSM or Converter Systems
  • Audio Power Amps: For Driving Loud Speakers

There are so many types of electronic load drivers that we can use with Arduino. And we will actually interface a handful of drivers in the upcoming tutorials in this Arduino Programming Series.

1.6 Displays and HMI

Arduino-Getting-Started-Display-Screens

There are several display units that you can use with Arduino to show information to the end user ranging from simple 7-segment display up to touch LCD screens and other advanced HMI (Human-Machine Interface) modules.

1.7 Arduino Modules & Shields

There are so many modules and Arduino shields to add even more functionality and capabilities to the Arduino microcontrollers. Thinks like SD cards, Serial converters, RTC (Real-Time Clock), Joystick controllers, USB host, external memory chips, and more.

Various modules and shields are typically used with Arduino boards to extend their features and be able to perform more functions with ease. We’ll interface so many modules & shields with Arduino in the upcoming tutorials in this Arduino Programming series, so make sure to stick around for more tutorials about it.

1.8 Wireless Communication & IoT

When you’re just getting started with Arduino, it’s always interesting to create things that you can control remotely. This is why you need to learn about wireless communication & IoT modules that can be used with Arduino to add wireless connectivity to your projects.

Wireless communication modules include, but are not limited to, the following:

  • RF Kits (433MHz Transceivers)
  • LoRA Wireless Modules
  • WiFi modules
  • Bluetooth/BLE modules
  • nRF24 modules

And more other wireless communication modules that we’ll be discussing in separate tutorials one at a time. To give you more in-depth information about each wireless communication technology, how these modules work, and how to use them with Arduino.

2. Arduino Software Fundamentals

Before getting started with Arduino programming, you need to learn some software fundamentals first. In this section, we’ll check out the various IDEs that you can use for Arduino development. And we’ll also discuss the Arduino program structure, libraries, and software tools that we’ll be using afterward.

2.1 Arduino IDEs

There are several Arduino IDEs (Integrated Development Environments) that you can use to develop your Arduino projects. We’ll stick to the standard Arduino IDE 1.8.x in this Arduino Programming series of tutorials. However, in this section, we’ll briefly mention the other IDE options that you can also consider.

Arduino IDE 1.8.x

Getting-Started-With-Arduino-Programming-Beginners-Tutorial-IDE
The Classic “Legacy” Arduino IDE

This is the Classic Arduino IDE that has been the standard and only option for years. Recently, after the release of Arduino IDE v2, the classic Arduino IDE v1.8.x is considered a “Legacy” Arduino IDE. This doesn’t mean it’s bad, going away, or will be discontinued. It is still however the most popular IDE among all other options and more beginner friendly even if it doesn’t look as modern as the others.

Arduino IDE 2.0.x

The Arduino IDE v2 is the newest Arduino IDE that was released back in 2021. It has a debugger feature (very HW limited), a dark theme, code auto-completion, better multi-file navigation, and more other features.

Arduino-IDE-v2
The New Arduino V2.0.x IDE

You can definitely use the Arduino IDE v2 and still get the exact same results as anyone who uses the v1.8.x IDE. The example projects that we’ll be doing through this Arduino Programming series of tutorials don’t depend on IDE or board model you’ll be using at all.

The company’s efforts are now dedicated to this new product and going into polishing it, fixing any bugs or issues, and adding more features. So maybe in the future, we’ll see some major changes in the Arduino IDE v2 that will completely outshine the v1.8.x IDE which is currently the most popular IDE despite the fact that it’s considered a “Legacy” editor.

The Arduino IDE v2.0.x can also co-exist with the legacy v1.8.x IDE. You can have both of them installed on your machine as completely separate applications, so you can give it a try and see if it satisfies your needs.

Arduino Web Editor

Arduino-Get-Started-Web-Editor
The Arduino Web Editor

The Arduino Web Editor is an online Arduino IDE that is part of the Arduino Cloud Suite. It has very similar features and functionalities to the offline Arduino IDEs, except for being completely web-based and can be used online from any device.

You just need an Arduino account to get started with the Web Editor.

2.2 Arduino API

The Arduino Programming Language (Arduino API) is a variant of the C++ programming language with multiple built-in functions and libraries that you can use right away within Arduino IDE itself.

The Arduino API Documentation will indeed help you while getting started with Arduino and learn more about the core functions and building blocks that you’ll be using to create your own projects.

2.3 Arduino Sketches

In Arduino’s terminology, a program is called a “sketch“. It’s the main project file with .ino extension and it should be in a folder with the exact same name. You may have multiple files in your project inside the same folder which you can easily include (like header files or whatever).

Here is an example sketch from the Arduino example sketchbook. It’s an LED blinking example that toggles an LED connected to the built-in LED output pin (IO pin 13).

2.4 Arduino Program Structure

Any Arduino program should have, at least, the following two fundamental functions:

  • void setup() This function gets executed only once while the Arduino is booting up. Whether it has just been powered on or reset, the Arduino controller will start executing the logic inside this function right away just for once, and then it’ll move to the loop() function. It’s typically used for the initialization of libraries or variables that you’ll be using afterward in your code.
  • void loop() This is the core logic of your application that will be repeatedly executed forever.

You need to have both of the above functions in every Arduino program even if it’s going to be just empty. This is the bare minimum requirement for an Arduino program.

And of course, you can add your own functions, classes, or even libraries. And we’ll demonstrate later how to organize a large Arduino project into multiple files or even break down the functionalities into a modular piece and pack them up into separate libraries to be used in any project where needed or to share it with others.

2.5 Arduino Libraries

There are so many Arduino libraries out there both official and community-contributed. Those libraries extend the Arduino core API functions to far more complex and advanced features, allowing makers and developers to easily integrate sensors, actuators, communication protocols, and other hardware components into their projects.

To use a library, let’s say the LiquidCrystal.h LCD library, for example, you only need to include its header file as shown below.

And now you’re able to use the functions built-in the LiquidCrystal.h library.

2.6 Arduino Software Tools

There are some built-in software tools within the Arduino IDE that we’ll be using on a regular basis. You need to know those tools while getting started with Arduino programming. Those software tools are Arduino Serial Monitor, Serial Plotter, and the Arduino Library Manager.

Arduino Serial Monitor

The Arduino serial monitor is a very handy tool that’s already built into the Arduino IDE itself. So you don’t need any external terminal in order to communicate with the Arduino via the serial port. Just open the serial monitor, set the correct baud rate for communication, and you’re good to go.

Here is a simple Arduino Example code to print the message “Hello World!!” over the serial port and we’ll view it on the serial monitor.

Arduino-Get-Started-Hello-World-Serial-Print

Arduino Serial Plotter

The Arduino serial plotter is another handy tool that’s also built into the Arduino IDE itself. It enables you to plot variables sent over the serial communication port and have a graphical visualization of the variable’s value over time. Which can be really helpful for debugging or monitoring the behavior of your code.

Here is an example to demonstrate the functionality of this tool. I’ll create a variable and assign to it sinusoidal waveform data points and send them one by one over the serial port. And we’ll plot it graphically on the Arduino IDE’s Serial Plotter Tool.

And this is the result.

Arduino Library Manager

The last tool we’ll discuss here is the Arduino Library Manager which enables you to navigate Arduino libraries, search for new libraries, and install the needed libraries to your local Arduino directory.

You can use this tool to install official or community-contributed libraries with a few clicks. And you are still able to manually install self-developed or some special libraries that are not included in the library search.

Arduino-Getting-Started-Library-Manager-Tool

3. Arduino Prototyping

Arduino prototyping is the process of putting everything together on a hardware level to create a prototype for your project that you can share with others. It starts by wiring the electronic components and circuits on a breadboard for example until it’s ready for flashing the new code (firmware) to the Arduino board.

Arduino Beginner’s Hardware Kit

For getting started with Arduino, you’ll need to get yourself a hardware kit that includes the Arduino Uno board itself as well as some basic electronic parts to be able to create projects on your own.

Here are the recommended Arduino starter kit + Arduino sensors kits that you can get.

And you can definitely check out the complete kit list for this Arduino Programming series of tutorials at the link below.

Arduino Course Full Kit List Page

4. Arduino Simulation

Simulating your Arduino projects can be really helpful especially when you’re just getting started with Arduino. This step is not mandatory at all, however, running your project in a simulator environment will help you catch and fix some logic errors in the code or in the circuit wiring connections.

If the code doesn’t run logically in simulation, it won’t either do in the real world. However, the opposite is not always true. If your project runs in simulation perfectly, it doesn’t mean it’ll also do in the real world. There are many external factors that can affect the application running on a real Arduino board. Things like noise, bad wiring, damaged parts, and more other obstacles that can’t be predicted by your simulator.

Moreover, the simulation environment will have its own limitations at the end of the day. It’s going to have a limited number of modules and sensors to use with Arduino, not all Arduino boards are included, not sufficient measurement tools are available in simulation, and more other limitations.

But all in all, it’s a great tool for learning and getting started with Arduino even if you don’t have the Arduino board or the kit yet. You can just sign up on TinkerCAD and start building and simulating Arduino projects right away.

TinkerCAD Arduino Simulator

The simulator that we’ll be using, occasionally, during this Arduino Programming Series of tutorials is going to be the TinkerCAD Simulator from Autodesk.

We won’t be able to create all practical example projects for Arduino tutorials on this simulator due to its limitations. But it’s going to serve us really well in the beginner tutorials examples and that’s totally acceptable from a tool designed specifically for beginners.

Arduino Simulation in TinkerCAD Environment


Setting Up Your Arduino

Now, we’re done with the basics and fundamentals. And let’s get started with setting up the Arduino environment on your local machine. First of all, you need to download the Arduino IDE installer on your computer from this link.

Installing Arduino IDE

Follow the steps shown in the download link for the Arduino installer, and you’ll be able to install the IDE on your machine without any issues. Just make sure to have everything selected in the “Components to install” prompt. Which should be the default setting actually.

Arduino Driver Installation

At the end of the IDE installation process, you’ll be prompted to accept the USB driver installation for Arduino and a couple of other tools. Just accept and you’re good to go.

Connecting Arduino Board to the Computer

Connect your Arduino board to the computer with the USB cable and you should hear the USB device sound. Open the Device Manager and check Ports (COM & LPT), you should see an open port named Arduino UNO (COMx).

If you didn’t find your Arduino UNO board, this means an issue has occurred with driver installation. To fix this, you need to do the following:

  • Right-click on the Arduino UNO (COMx) > Update Driver Software
  • Choose Browse my computer for Driver software
  • Navigate to and select the Uno’s driver file (named ArduinoUNO.inf) located in the Drivers folder of the Arduino Software download

The driver installation will start automatically and it should be now fixed.

Arduino Board Selection in IDE

Open the Arduino IDE and head over to the Tools menu and select the Board submenu which will show you all available Arduino Boards that the IDE is supporting by default. Just choose the Arduino UNO board (in case it’s the board you’ve got around).

Arduino Serial Port Selection

Next, you need always to make sure that you’ve selected the correct COM port for your Arduino board. Otherwise, you’ll have consistent firmware uploading issues while flashing your code to the Arduino.

Here is how I’ve selected the COM port for my Arduino UNO board.

Arduino-Board-Port-Selection

Arduino Code Examples

There is a handful of ready-to-use beginner examples in the Arduino IDE itself as well that should help you get started with different Hardware interfacing and libraries.

You can access those examples from the File menu, then select the Examples option that will show you all the available example sketches that you can use as is. Or you can modify the code as per your needs and give it a test.

Arduino-Example-Sketches


What You’ll Need For This Guide?

To get started with Arduino and follow along with this guide tutorial, you’ll need the following HW and SW tools. We’ll be using those HW/SW tools to create the practice projects in the next section, so make sure you’ve everything around. Alternatively, you can use the simulation environment if your HW kit didn’t arrive yet.

Required HW Kit

1x Arduino Uno (or any other board)

1x Breadboard

5x Jumper Wires

1x LED + Resistors (330Ω, and 10kΩ)

1x Push button

Arduino Course Full Kit List

Required Software Tools

Arduino IDE

TinkerCAD Account (not mandatory)


Arduino Starter Projects For Beginners

For Getting Started With Arduino as a beginner, you should follow along with the example projects in this section. We’ll start with an LED blinking example, then we’ll add a push button to control the LED, and finally, we’ll send some text messages from the Arduino board to the PC.

1. Arduino LED Blinking Example

This is the first project for anyone just getting started with Arduino shall do. We’ll turn an LED on and off for a second each time. And will be using the built-in LED which is connected to Arduino’s IO pin13. But as it’s not fun enough, we’ll hook the pin to another external LED on a breadboard to show the same blinking effect on an external LED.

Wiring

Here is how to hook up the external LED output. (note that the LED current limiting resistor is 330Ω)

Arduino-LED-Blinking-Project-Wiring

Example Code

Here is the full code listing for this example.

Code Explanation

The code example simply set the Builtin-LED IO pin to be output and sends output signal High and Low with 1 second time delay after each state change.

setup()

in the setup() function, we initialize the digital IO pin ( LED_BUILTIN or pin 13) to be an OUTPUT pin.

loop()

in the loop() function, we use the digitalWrite() function to set the pin state to high and low. And we also use the delay() function to insert a 1000ms (1sec) time delay after each state change.

Simulation

Here is the simulation result for this project on the TinkerCAD simulator.

You can check this simulation project on TinkerCAD using this link.

Testing Results

Here is a demo video for testing this project on my Arduino UNO board.

2. Arduino LED + Button Example

In this second project, we’ll add a push button to the circuit and use it to control the LED. What we’ll implement is called a “momentary button action” in which the LED will turn on as long the button is held down and it’ll go off whenever the button is released. The button will be connected to Arduino’s IO pin 4, and the LED will stay on the same pin 13.

Wiring

Here is how to hook up the external LED output. (note that the LED current limiting resistor is 330Ω). The push button here is connected in a pull-down configuration with a pull-down resistor of 10kΩ.

Arduino-LED_Button-Example-Wiring

Example Code

Here is the full code listing for this example.

Code Explanation

The code example simply set the Builtin-LED IO pin to be output and defines BTN_PIN to be IO pin4 and sets it as an input pin. Then we read the digital state of the Button pin and turn on the LED while the button is pressed, when the button is released, the LED will be driven low again.

This is the button pin definition (assignation)

setup()

in the setup() function, we initialize the digital IO pin ( LED_BUILTIN or pin 13) to be an OUTPUT pin. And the BTN_PIN to be an input pin.

loop()

in the loop() function, we continuously read the state of the button’s pin. While it’s held down (state=1), the LED will be turned ON. When the button is released, the while loop condition breaks and the LED will be driven back to the LOW state.

Simulation

Here is the simulation result for this project on the TinkerCAD simulator.

You can check this simulation project on TinkerCAD using this link.

Testing Results

Here is a demo video for testing this project on my Arduino UNO board.

3. Arduino Serial Communication Example

In this last project, we’ll set up a serial communication between the Arduino and PC to send a message from the Arduino board to the PC and display it on the serial monitor.

Example Code

Here is the full code listing for this example.

Code Explanation

The code example simply configures the serial port to operate at a 9600bps baud rate and start the serial communication. And send a text message only once within the setup() function.

Simulation

Here is the simulation result for this project on the TinkerCAD simulator.

Arduino-Serial-Print-Example-TinkerCAD-Simulation

You can check this simulation project on TinkerCAD using this link.

Testing Results

Here is the result of testing this project on my Arduino UNO board.

Arduino-Get-Started-Hello-World-Serial-Print


Parts List

Here is the full components list for all parts that you’d need in order to perform the practical LABs mentioned here in this article and for the whole Arduino Programming series of tutorials found here on DeepBlueMbedded. Please, note that those are affiliate links and we’ll receive a small commission on your purchase at no additional cost to you, and it’d definitely support our work.

Download Attachments

You can download all attachment files for this Article/Tutorial (project files, schematics, code, etc..) using the link below. Please consider supporting my work through the various support options listed in the link down below. Every small donation helps to keep this website up and running and ultimately supports our community.


What To Do Next?

To conclude this gigantic tutorial, we can only say that it’s only the first step in the Arduino Programming journey. The following tutorials in this series will help you get started with Arduino programming and learn more topics with practical examples and step-by-step explanations.

If you did really enjoy this tutorial or found it helpful, please share it with your network!

Let me know if you’re facing any issues or have any questions in mind. And stay tuned for the upcoming tutorials!


FAQ & Answers

How To Get Started With Arduino?

1. Buy an Arduino Starter Kit
2. Install Arduino IDE Software
3. Run Arduino Built-in Examples
4. Try Arduino Project Simulation (Optional)
5. Follow Getting Started With Arduino Programming Tutorials
6. Create Your Own Projects
7. If Needed, Get Help On Arduino Forum or Documentation

Is Arduino Good For Beginners?

Arduino is by far the best platform out there for absolute beginners who want to learn about electronics programming (Embedded Systems). If you’re seeking a degree in Embedded Systems or Electronics Engineering, you may consider other bare-metal microcontroller programming environments instead of using Arduino. Otherwise, it’s always better to get started with Arduino for beginners, makers, or anyone from a non-ECE background.

What Should I Learn Before Arduino?

There are no explicit prerequisites for learning Arduino Programming and you can really get started with Arduino in a couple of days. However, it’s recommended to have some basic knowledge in the following topics: Circuits & Electronics, C/C++ Programming Language, and Introduction to Embedded Systems. Basic knowledge in those 3 topics will accelerate and supercharge your learning journey with Arduino.

Is Arduino Code C or C++?

Arduino uses a variant of the C++ programming language, sometimes it’s referred to as Arduino C. When you compile an Arduino Sketch (program) it will get translated into machine code at the end.

Can I Pursue Arduino Programming as a Career?

The short answer is No. However, you can still create amazing prototypes for projects that can have the potential to turn into great products that make you a fortune. At the end of the day, Arduino is just a prototyping platform that is not optimized for product development but for prototyping ideas instead. Being an expert in Arduino programming can get you some side freelance projects. But if you’re in love with Arduino and would like to pursue a career in a relevant industry, you should pursue Embedded Systems, IoT, or Robotics which are highly relevant careers with huge market share and high future potential.

Share This Page With Your Network!
Join Our +25,000 Newsletter Subscribers!

Stay Updated With All New Content Releases. You Also Get Occasional FREE Coupon Codes For Courses & Other Stuff!

Photo of author
Author
Khaled Magdy
Embedded systems engineer with several years of experience in embedded software and hardware design. I work as an embedded SW engineer in the Automotive & e-Mobility industry. However, I still do Hardware design and SW development for DSP, Control Systems, Robotics, AI/ML, and other fields I'm passionate about.
I love reading, writing, creating projects, and teaching. A reader by day and a writer by night, it's my lifestyle. I believe that the combination of brilliant minds, bold ideas, and a complete disregard for what is possible, can and will change the world! I will be there when it happens, will you?

Leave a Comment