Learn Arduino quicker using a Free online Arduino simulator
Start Learning Arduino Right Away
Arduino is a very popular way to get started with Electronics. The good news is that you don’t need to buy any hardware and not even install any software to start learning Arduino. In this tutorial, you’ll learn how to use an online Arduino simulator.
Let us start with the in Simulator!
Let us see the joy of Arduino Our first Arduino project is blinking an LED💡.
When you open the link, you’ll see the simulation environment. Let’s start with a quick tour of the simulator:
Figure 1: Wokwi Arduino simulation screenshot
|Editor window||This is where you write your Arduino code. For instance, the code above blinks an LED. You can also paste the code you find in online tutorials and try it out! 👨💻|
|Simulation window||This is where the simulation takes place. You can add new parts, define the connections, and click on the green play button to start the simulation.|
|Serial monitor||The simulation window also contains a serial plotter and terminal window. it opens when there is a serial communication-related code initialization.|
|Control||Play button – starts or restarts the simulation ⏯
Stop button – stops the simulation🛑
Start from easy ones
After you feel confident with the basic LED example, you can gradually challenge yourself. Try adding a second LED, connected to a different Arduino pin (e.g. pin 12 and GND), and see if you can modify the code to alternate between the LEDs.
You can also experiment with different kinds of Arduino boards. For example, check out the Arduino MEGA blink demo, where you can see one of the strengths of the Arduino environment: the same piece of code and be reused for different boards.
The Serial Monitor and Arduino UNO
The serial monitor is a very useful tool. You can use it for easy debugging. You can start with this Serial Monitor demo project.
If you want to use the Serial Monitor in your code, you’ll need to initialize the Serial communication first. This is done by calling Serial.begin(115200); inside the setup() function, and before printing any message.
Then print messages by using Serial.println. E.g. Serial.println(1+2); or Serial.println(“Hello, Arduino!”);
Arduino and LCD Display on online Arduino Simulator
After you feel comfortable with LEDs, writing some basic Arduino code and using the Serial Monitor, you are ready to move on to move complex projects! Take a look at LCD1602 and Arduino UNO, which shows how we connect an LCD to Arduino.
Figure 2: LED blink on Arduino Mega
How to add some OLED Graphics Display into your Arduino projects?
While LCDs are great for the text-based interface, our favourite type of display is the white OLED display. A common OLED module is SSD1306. It comes in several form factors, with resolutions up to 128×64 pixels. The display is crisp and shows the text, graphics and even fancy animations.SSD1306 OLEDs are very eye catchy and the Wokwi Arduino simulator has many examples to help you get started with the projects involving OLED 1306 display projects. OLED – Hello World is one simple example with OLED display to get you started.
The second example is about displaying temperature and humidity. The next example is a very pretty example from the Adafruit library. All the projects can be edited by you and can be saved. Once you save it, it will create a new copy with a unique link to the project which you can share with anyone.
Figure 3: OLED SSD1306 simulation
How to add inputs to Your Projects?
Okay, we’ve seen several ways to add output to your project. Now let’s talk about getting user input. The basic input devices are slide switches and pushbuttons.
These devices are very versatile and you can combine them with the OLED display to create little games and use them as the basic building blocks of your project’s user interface. You can also use advanced inputs such as joystick and potentiometer in your projects.
Go ahead and try the membrane keypads. It provides a 4×4 matrix of keys, and you can use it to build projects such as an electronic safe, a calculator, a quiz, an alarm clock and so on. Remember you can also create a copy of any project by selecting the “save as” option from the menu, and then share the link with other people so they can enjoy your creations and provide you with helpful feedback about your code.
Figure 4: Arduino Uno and a slide switch
Arduino and Servo Motors on Arduino simulator?
Servo motors are a very popular way to move things in the physical world. They are relatively easy to use, require only 3 wires, and provide precise position control. You can see why they are used in robotics. You can begin your journey with servos by looking at the Servo motor and potentiometer example, check out the electronic safe project, and then try to create a project which controls multiple servos.
While the simulation is a great way to practice and improve your coding skills, Servos are much more fun when you try them in the real world. You can mount them to robotic arms, attach them to wheels, or use them to control puppets and make your Arduino-based Puppet theatre. We encourage you to try this too!
Smart LEDs: Beautiful Strips, circular Rings and more
Smart LEDs are full-colour (RGB) LEDs that can be connected in long chains while providing the ability to control individual LEDs. They are also called addressable LEDs (because you can send a command to change the colour for a specific LED in the strip), and they are very popular in decor and art projects.
There are several types of smart LEDs. The most popular is model WS2812, also known as NeoPixels. Other models include SK6812 (which are compatible with the WS2812), APA102 (with faster refresh rate), and HD108 (with 16-bit colour support).
The cool thing about NeoPixels (and similar smart LEDs) is that you only need a single Arduino digital pin to control them, even if you have a strip with hundreds of LEDs or a very large matrix. Speaking of, Smart LEDs come in a variety of shapes: strips, rings, matrices, spirals, or even individual LED units.
These LEDs also have tight timing requirements in their communication protocol. Fortunately, you don’t have to worry about it: there are popular Arduino libraries to help with that.
The FastLED library supports many types of smart LEDs and has a bunch of built-in functions and utilities for creating cool effects and animations. Start with the Blink example and then gradually move on to more complex examples (we have some links for you below).
Adafruit NeoPixel is another popular smart LED library. You can start with this Strand Test example which demonstrates various effects and includes comments to explain the code.
Once you nail down these, you can check out the other FastLED library examples, take a look at a few more Adafruit NeoPixel demos, and explore many cool FastLED projects from other people.
It’s also worth mentioning the FastLED has a vibrant Reddit community, /r/fastled, where you can ask questions and get help.
Summary of what you have learnt?
While learning, it is easier to look at one component at a time. There are dozens of components we haven’t even mentioned yet: many kinds of sensors, buzzers/speakers, real-time clock (RTC) modules, wireless communication modules, etc.
Here is some inspiration for you – complete projects that you can tinker with and learn from their code:
- Simon says Game – a fun memory game using four colourful LEDs, four pushbuttons, and a buzzer. Can you add a seven-segment display to show the score?
- Arduino Piano – 8 push buttons and a buzzer, that all it takes to create a single octave piano. Now here’s a challenge for you: add record/play functionality. For the extra score, store the recorded songs in the Arduino’s EEPROM memory.
- Digital Alarm Clock – An example of a multi-file project, showing how to use an RTC (real-time clock) module, a Seven Segment display, and how to create a simple functional user interface with 3 push buttons.
- Arduino Electronic Safe – Another multi-file project. You can learn how to store persistent data in the Arduino’s EEPROM memory, and create a PIN code entry mechanism using a membrane keypad and an LCD.
Need a helping hand!
A welcoming community is waiting for you on Discord.