How to Simulate Arduino to Blink an LED Using Wokwi 2020

Introduction: How to Simulate Arduino to Blink an LED Using Wokwi 2020

  1. No installations are needed πŸ˜€
  2. no downloads
  3. works on mobile πŸ“²
  4. just go to https://wokwi.com/

Supplies

Enthusiasm and any Browser

Step 1: How to Simulate LEDs in Wokwi Arduino Simulator

In this tutorial, You will learn how to add an LED, connect it to an Arduino pin, and toggle it.

We will use AVG Secure browser in the tutorial but any browser is just fine.

Step 2: Know the Basics of Wokwi Arduino Simulator

The Arduino Simulator window looks like this on the Wokwi platform. The left panel is for editing. You can edit your code, edit the connections, edit ✍🏽 the project descriptions, edit/add new header files/source files (this is also one of the advantages of wokwi Arduino Simulator over other kinds of simulators).

In the example image shown:

  1. blink.ino - Here you can edit the sketch. You can also paste the Arduino code from other websites or projects directly.
  2. Readme.md - Not a mandatory file but a useful practice to help yourself and others πŸ˜€ to give a brief description of the project
  3. diagram.json - Heart 🩺 of the connections. here is where you will call all the elements (LEDs, UNO, Mega, Sensors, things, and stuff like that. You tell the Wowki Simulator on where to connect them here.

The first files are straight forward and hence we will focus on the third file 🎯. In the next step, we will see the basic layout and sections of the diagram.json file.

Tip: diagram.json name shouldn't be changed.

Step 3: Basic Layout of the Wokwi Arduino Simulator's Diagram Editor

As you can see, at a higher level, in the wokwi Simulator we have the following three sections

  1. Basic information (something similar to metadata) - This is only for the information to give credits to the original co-author, mention the version)
  2. Parts section - Here is where you can add βž• the parts, here known as wokwi elements.
  3. Connections - You will connect the individual elements (complete the circuits)

In the next step, we will play around a little in the *.ino and the diagram.json tabs in the editor panel.

Step 4: Tinker With the Example Arduino Blink Code

A small change is done in the Arduino blink sketch. The delay🐾 is reduced. you can try something different too.

We will now jump to the diagram.json window, I would say the heart of the wokwi Arduino simulator. πŸ˜€

Step 5: Tinkering With the Diagram.json in the Editor Panel

The script file is easy to read and edit. The parameters can be kept all in one line or split into multiple lines(my favorite). As long as the script structure is followed with the appropriate code, it is fine.

In another step, I changed the LED type from red to blue. This will immediately reflect in the simulation window.

After changing the color parameter in the editor pane, the LED in the simulation window changed to blue 🟦.

In the next step, we will see the connections. This is the final step in completing the circuit. β­•

Step 6: Connecting the Wokwi Elements Together!

  1. The color of the wire can be changed
  2. The pins of the Arduino are pointed by UNO:1 or UNO:3 fro pin number 1 or pin number 3
  3. "uno" and "led" are the ID names. It can be literally anything. Meaningful ids are better
  4. The LED pins can be accessed as follows
    1. led:A - Anode pin
    2. led:C - Cathode pin

Note: The LEDs will work in the simulation as it is, but wait, in real life, we have to limit the current through the LED.

As of now, that's all. Our next step is to just hit the "START" button. πŸ˜€

Step 7: START Button! - to Unleash the Magic of Arduino Simulator

Press the START button to start the simulations. thank you for following the last step 🏁. if fact, this is the first step in getting involved in simulations, coding, open-source community coding, and beyond. πŸ˜…

Please spread the word about our Wokwi Arduino Simulator. For today, it is still a work in progress. It is getting better week by week.

Many people have directly and indirectly contributed to the Simulator. Please share your feedback via comments or direct messages. We will be glad to simulate πŸ˜‰that!

Thank you πŸ˜€

Other links you might be interested in πŸ‘‰πŸ‘‰πŸ˜€

https://www.instructables.com/Best-Free-Online-Wok...

https://www.instructables.com/Web-Based-Arduino-Si...

https://www.instructables.com/Online-Arduino-Simul...

https://www.instructables.com/How-to-Simulate-Ardu...

https://www.instructables.com/Famous-Simon-Says-Ga...

https://www.instructables.com/How-to-Runtest-Your-...

Be the First to Share

    Recommendations

    • First Time Author Contest

      First Time Author Contest
    • Backyard Contest

      Backyard Contest
    • DIY Summer Camp Contest

      DIY Summer Camp Contest

    Comments