How to learn Arduino programming using a free Arduino Simulator in 2021?
Bust all the myths. You can learn to program Arduino faster than you ever thought. No hardware needed. I will show you how you can learn Arduino programming faster using an Arduino simulator and a collection of examples, which are sorted from simple to more complicated.

Introduction
The aim of this article is NOT to make you an expert in Arduino programming. I will take you through an Arduino journey. No previous Arduino experience is needed. You will learn Arduino faster, Faster than you had ever thought.
You will get simulation pages for all the examples too. What does it mean to you? You won’t just understand the aspects of an Arduino but you will also be able to play with it, The free Arduino simulator from the Wokwi is used as a learning companion.
Don’t worry if you don’t get everything in one go. You can go over it once. You will always be able to come back and play with the simulations. You will learn by doing. I effectively do this, providing you with easy-to-follow projects, starting from very easy ones to complicated real-life problem-solving projects. You can go through this article at your own pace.
As I said, you will not become an Arduino expert by the end of this article, BUT you will be confident to take on real-world challenges and solve them with Arduino in your own way. You can always hop on to the Discord Channel of the Arduino Simulator. Let us get started.
A small introduction to the Arduino boards you see around (skip if you want 😁)
there are so many boards out there and you can have a look once here: https://www.arduino.cc/en/products/compare
Arduino UNO board: This is the most common board you come across. It has a lot of companion boards to boost the number of applications you can develop. all the GPIO pins will be at 5 V. It also comes with holes used to mount firmly on surfaces and supports.
Arduino Mega Board: The Arduino Mega board has more code memory and RAM. It also has many more GPIOs and analog pins compared to Arduino UNO. The GPIO levels will be at 3.3 V. You can use this when you require more RAM or more GPIOs.
Arduino Nano: Arduino Nano is a tiny board and is helpful to squeeze into tiny projects easily. It has almost the same features as Arduino UNO except that it is tiny and has no mounting hole option and external DC supply connector.
There are eventually a lot more boards with several features and made for different applications. Let us start with a “Hello World”👋 program in the next session.
Arduino Project 1: Blinking an LED — Basics💡
Blinking an LED is the “Hello World” equivalent program. In this project, you instruct an Arduino to Turn ON and TURN OFF an LED with a suitable delay.
Before jumping to the code, I would like a show the basic structure of the Arduino code. The code you write is called a sketch. Every sketch will have two parts. setup()
and loop()
.
The code in the setup()
block runs only once - soon after power on or a Reset. This is used to initialise the variables, initialise the interfaces (serial, I2C, LCD etc).
The code in the loop()
block➿ contains code that will run repeatedly all the time. This part is actively used to control the Arduino board. All the logic you put, inputs you read or outputs you drive will be done in this section.
Here is the basic code for the LED blink example
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
In the setup()
function, the mode of the Arduino pin is configured as an output. This is achieved using the below function.
pinMode(LED_BUILTIN, OUTPUT);
Refer to PinMode tutorials for details and other options possible. The loop()
function has four instructions. The first instruction writes a logic HIGH to the pin which is connected to the LED. (here, logic HIGH means 5 V as Arduino is powered from 5 V supply and all Pins will output 5 V when configured as output and HIGH is driven on the pins.) see here for more information on the digitalwrite()
Delay function⌛ makes the Arduino wait for a certain amount of time. the parameter you write inside the parentheses will be in ms. hence, a value of 1000 will be treated as 1 second (1000 ms = 1sec)
Here is the link for the LED blink — Basics 💡
you can play around with the project. Here are the tasks which will be interesting to you to accomplish. You can always post your modified projects in the comments. I can have a look as well.
The below video will give you the preview:

Assignments you can create and submit for review
- Can you change the code so that, the LED will blink every 500ms⏳?
- Can you change the LED colour to blue🟦?
Arduino Project 2: buttons!
In this tutorial, we will take a project which has a press button 👇connected to the Arduino. Let us go 🏃♂️
Here is the link to the Arduino project with a push-button interface. 🔘 You can play with the project, tinker with it to make it your own. Let us have a look at the code.
Firstly, let us start with the setup()
function. You now know that the setup()
function runs only once. it helps in telling the Arduino about the inputs, outputs and other settings to be applied before it starts with the loop()
function. In this case, the setup() function looks like below:
The pinmode(BUTTON_PIN, INPUT_PULLUP)
tells the compiler that we want to set the BUTTON_PIN property to be an input and an internal pullup. It means when there is nothing connected on pin 4 of the Arduino, the voltage level on the Pin 4 will be pulled to high (5V). This keeps the code stable when there is external noise. #define
in the first line maps the BUTTON_PIN
to PIN 4
of the Arduino

In the loop()
function, we added the logic to read the value of the PIN 4 using a built-in function digitalRead()
. The value
will be either 1 or 0 based on the condition of the push button.
Assignments you can create and submit for review
- Change the logic so that, the LED will turn OFF when you press the button and will turn ON when you release the button
- Can you change the logic so that the LED will keep blinking as long as the button is pressed?
Additional reading: Read about the bounce feature here
Get to know the Arduino simulator
Documentation link: https://docs.wokwi.com/
The main site: https://wokwi.com/
Arduino library examples: https://wokwi.com/arduino/libraries
GitHub repo: https://github.com/wokwi
/* Please leave comments if you have any feedback */
___________________
At this point, I encourage you to develop a lot of applications based on your learning no matter how silly they are. Challenge yourself with tweaks (blink without delay function), blink without digitalWrite function etc) and you will be able to find answers too. If not, always ping on the Discord discussion page. People are friendly and will always try to help.
In the next few steps, we will interface more peripherals to the Arduino and explore them. Let’s go! 🚀
Arduino Project 3: Learn about printing text on serial data/serial plotter
You will find it really helpful to have an option to read some messages from Arduino. It can be a status message or a command to the user etc. You can use simple statements such as the code below to get some messages printed on the serial monitor. You also need to study two functions Serial.read()
and Serial.write()
functions.
Serial.println(1 + 2);
Serial.println("Hello, How are You!");
I have used it to display temperature from a sensor, distance calculated using ultrasonic sensor, battery voltage and more. This you can’t miss. This is a very important interface and a skill to have to continue with more complex projects.
You can play, send your own text messages in the project here.
Secondly, you can use the serial plotter so that you can graphically view the data on the computer screen. You can find the Arduino serial plotter example here. You will be surely excited to see how useful the serial plotter is as well as the Arduino simulator. This plotter can also be a plot of temperature or a potentiometer knob.
you can find a simple video here as a preview.

You can now spend more time adding some more code for the serial print options and explore the applications. you can always post the projects you created in the comments. you can always jump on to the Discord server, whenever you need a hand!
Assignments you can submit for review
- Create a project which will create a square wave
- Create a project which can print a text-based game based on the response from the user. You can be creative here ✍✍
Arduino Project 4: Play with the projects with LCD1602 (and LCD2004)
The LCD1602 is an LCD with the ability to display 20 characters each in two rows. t is a very basic yet very useful interface to know about. You don’t have to write all the code required to make it work. You can use standard Arduino libraries and the Arduino simulator to learn coding LCD and Arduino for your next project.
I advise you to go through the very user-friendly quick guide about LCD1602 and LCD2004 here before you continue. Read it through once or twice. If you have any doubts you know where the helping hands are.
Let us start with a simple example of displaying “Hello World”. Come back here after playing with the simulation.
Here is a quick video on how it looks on the simulator.

Spend more time with the LCD. get to know clearly the differences between LCD with a parallel data interface and LCD with an I2C interface. next time, when you go buy them, you will know which one to ask. I2C ones are always easier. They take fewer wires too.
Assignments you can submit for review
- Create a project with 1602 LCD which will scroll your name
- create a project with 1602 LCD with custom characters (hint: follow the guide here to find out about creating custom characters)
- Create a counter project. Connect a push button and display the number of presses on the LCD since power on.
- Display the time elapsed in seconds on the LCD since power on
Arduino Project 5: Learn about membrane keypads and Arduino
The membrane keypads are present everywhere. the keypads find their application in POS, lockers, data loggers and more. The membrane keypads also find applications in control panels, remotes and more!
Let us learn more about it and also build interesting applications using Arduino and a membrane keypad.
Start first with just playing with the existing calculator project on Arduino. If you notice, you can also see that this project involves an LCD as well. The LCD was covered in the previous project. More and more peripherals will be involved in complex projects. Hence a good tip is to learn the basics of each peripheral separately and combine them to build a useful application or a solution.
Here is a video of the project under discussion.
If you look in the editor window, you will see this code section which takes care of the membrane keypad initialisation.
/* Keypad setup */
const byte KEYPAD_ROWS = 4;
const byte KEYPAD_COLS = 4;
byte rowPins[KEYPAD_ROWS] = {5, 4, 3, 2};
byte colPins[KEYPAD_COLS] = {A3, A2, A1, A0};
char keys[KEYPAD_ROWS][KEYPAD_COLS] = {
{'1', '2', '3', '+'},
{'4', '5', '6', '-'},
{'7', '8', '9', '*'},
{'.', '0', '=', '/'}
};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, KEYPAD_ROWS, KEYPAD_COLS);
The keypad library is one of the standard library provided by Arduino. If you look, closely you will see the definition of row pins, column pins and the list of characters in an array. This is where we tell the microcontroller about the layout of the keys.
In the next line, we marry all the properties we defined in the previous lines and instantiate a keypad object. there are several versions of keypads available, and you may have to choose the definition of the keys array as well the simulated Wokwi element accordingly. below are a few examples of possible keypads you will see normally:



Refer to the Wokwi docs on membrane keypad for making your own custom keys for the simulator.
The initialisation is done and now you should look at the functions which are helpful to find out the keys pressed. Several helpful functions will accomplish all the functions we need to interact with the membrane keypad. In the given calculator example, find out all the helper functions used. The Arduino safe project also involves a keypad membrane but different keys. Also, study the functions used there related to keypad object. These will give you fair examples of how the functions are used in real-life examples.
I would argue to pause reading right now and complete the previous examples projects (calculator and the Arduino safe project study wrt keypad functions). Come back later.
Assignments you can submit for review
- Change the positions of the keypad in the calculator project so that 7, 8 and 9 will go to the top row and 1, 2 and 3 will come to row second from the bottom. Also, update the keypad in the simulator. you can get help from here for the simulated part. you can always jump to the Discord channel when you need a hand.
- Create a project with the membrane keypad as a control panel. Pressing the number on the key should blink the LED those many times the number.
- Share your own creative use cases as well
Arduino Project 6: Learn about Servo motors
The servo motors move the Arduino projects. Servo motors are very much user-friendly compared to other motors. The programming is easy. The software drivers are easily available.
The Servo motors consist of a small intelligent comparator inside which can be programmed using a PWM signal. The angle of rotation is controlled by the pulse width of the PWM signal. This means that even if there is a slight offset in the rotation angle (due to the load or due to a small shock) it will be corrected in the next few milliseconds. This Servo motor feature makes it a good candidate for several applications such as robotic arms, dispensers and more.




You can now refresh more about the servo motors on the documentation page for Servo motors. And here are two more references to understand the basics of servo motor operation (link 1, link 2). here are the different versions of the horns you find for the servo motors.
You can find a basic project created for a servo motor here. The code is very simple and can be understood step by step.
#include <Servo.h>
This is the standard library for the Servo motor from Arduino. You don’t have to write all the libraries by yourself!
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
Once you create a servo object, you can assign an Arduino pin to it using the below setup()
function.
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
the below code sweeps the Servo
void loop() {
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
Here is a quick short video on how the project looks!

We used a method called write()
to tell the angle of rotation to the servo motor. here are all the methods you need to know to complete your Servo motor projects successfully.
To start with you can play with the simulator by limiting the angle of rotation to 90 degrees in either direction. you can also explore the other methods. Each method has an example in the links above.
Assignments you can submit for review
- Create a project which will turn the servo motor angle will change based on the range with ultrasonic sensor
- Create a project where you can drive four servo motors in the same angle direction
- Create a project using LCD, membrane and Servo motor. The user should be able to enter the angle (
0
to180
) using membrane and the LCD should display the entered values. The servo should turn by so much angle later. - Share your creative projects as well
Arduino Project 7: Learn about driving smart LEDs (1/3)
Let us start with a single LED. Before that, a bit of eh introduction to the FastLEDs. Smart LEDs are a great way of creating beautiful projects for various applications. It can be a frame for a great table or a roof. Beautiful rings or some decor as well.
NeoPixel LEDs and smart LEDs are addressable LEDs which has made the hardware setup very simple and sound.
FastLEDs have only three connections
- Power supply
- Data line
- Ground
The Power supply supplies 5 V or 12 V depending on the parts.
In simple terms, the Arduino will send out RGB values for each LED serially over one line. If there are 2 LEDs, the Arduino will send the data of the first LED (RGB) and then sends the data of the second LED (RGB).
For a series on connected n LEDs, the data would like something like this:
R1G1B1-R2G2B2-R3G3B3-……RnGnBn
Once this data passes through the first LED, the output from the first LED to the second LED looks like this:
R2G2B2-R3G3B3-….RnGnBn
The same thing happens with every LED in series and the final LED will only receive RnGnBn.
_____
Let us start with the signal LED project
Project Link: https://wokwi.com/arduino/projects/296747499944673801
Code
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 1
// For led chips like WS2812, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN
// Clock pin only needed for SPI based chipsets when not using hardware SPI
#define DATA_PIN 3
#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
// Uncomment/edit one of the following lines for your leds arrangement.
// ## Clockless types ##
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed}
void loop() {
leds[0] = CRGB::Red;
FastLED.show();
delay(500);
leds[0] = CRGB(241, 28, 206);
FastLED.show();
delay(500);
leds[0] = CRGB(28, 25, 226);
FastLED.show();
delay(500);
leds[0] = CRGB(35, 201, 13);
FastLED.show();
delay(500);
leds[0] = CRGB(241, 245, 10);
FastLED.show();
delay(500);
}
You can find a quick look below

CRGB leds[NUM_LEDS];
The above code declares the number of LEDs needed in the project
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); // GRB ordering is assumed
The above code maps the LED data pin to the FastLED library.
FastLED.show();
Drive the LEDs with the updated data.
GO through the projects present in https://wokwi.com/arduino/libraries/FastLED
Assignments you can submit for review
- Create a project with one smart LED and Arduino Nano
- Create a project with one FastLED and a potentiometer. Change the colours based on the potentiometer values
Arduino Project 8: Learn about driving smart LEDs (2/3)
With a single LED, you could not harness the complete power of the addressable LEDs. You will now look at the code where you will drive LED strips. In these projects, you will be able to create a 1-dimensional pattern. There are projects which run for several meters. In the simulations, there will be no problem with the power requirements or the heat generated by the LEDs. In a practical case, each LED generates heat equivalent to the product of the current and the forward voltage of the LEDs.
you can always visit Reddit FastLED page for any help or hop on to the Discord server for any feedback or solutions.
Project link https://wokwi.com/arduino/libraries/FastLED/ColorPalette
The project looks like shown below:

There are several examples of FastLED projects. To start with, go through the code for the example given above. try to change the logic, time, patterns or transitions. If you find the example bit over the head, do not worry. we will discuss one more example below. This is a simpler one.
Project link: https://wokwi.com/arduino/projects/287938818561016332
Looks like below:
The code for the above code is given below
// Source: https://github.com/s-marley/FastLED-basics
#include <FastLED.h>
#define NUM_LEDS 18
#define LED_PIN 2
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(50);
}
void loop() {
leds[0] = CRGB::Red;
leds[1] = CRGB::Green;
leds[2] = CRGB::Blue;
FastLED.show();
}
The above code is simple to start with. isn’t it? you will be able to update all the LEDs with the colours you like. Later, you can create a for loop which will create a simple pattern. There are several resources to explore more capabilities of the FastLED libraries.
Assignments you can submit for review
- Create a project with >30 LEDs in a strip that will lit only one LED at a time in a cycling fashion.
- Create a project with more than 60 LEDs. Try to create an asymmetric pattern.
- What is the maximum number of LEDs you can drive with an Arduino UNO board connected to a PC USB port?
Feedback: The work is still in progress👷♂️. I would pause now to hear!👂
I would love to hear from you about the article? was this helpful👍? Which areas do you think can be improved 🔧to help learning go faster? Do you have any specific improvement ideas💡?