Wokwi Documentation

repository·main·Indexed 41 days ago

https://github.com/wokwi/wokwi-docs

Documentation for Wokwi, featuring guides on creating custom chips using JSON and C, the Chips API for analog voltage (pin_adc_read, pin_dac_write), attribute management (attr_init, attr_read), and the Framebuffer API for implementing virtual displays.

Tokens
73K
Snippets
220
Records
413
Agent score
53%

What's inside Wokwi

  1. Overview of Wokwi Electronics Simulator

    main
    Wokwi is an online electronics simulator used to simulate popular microcontrollers (Arduino, ESP32, STM32, etc.), parts, and sensors directly in your browser. It allows for rapid prototyping without the risk of damaging physical hardware and provides a way to separate hardware debugging from software debugging.
  2. Introduction to Wokwi for CI and GitHub Actions

    main
    Wokwi CI allows you to automate embedded firmware testing within continuous integration workflows like GitHub Actions and GitLab CI. It uses the same simulation engine as the Wokwi web simulator, running in the cloud and streaming serial output back to your CI system for verification. This enables you to run tests on every commit and receive instant feedback on code changes.
  3. BMP180 Barometric Pressure Sensor Overview

    main

    The BMP180 is a barometric pressure and temperature sensor that uses an I2C interface (address 0x77). It is compatible with BMP085 libraries. It is commonly used for weather stations, altitude measurement, and climate monitoring.

    Pinout

    NameDescription
    VCCVoltage supply
    3.3V3.3V supply
    GNDGround
    SCLI2C clock line
    SDAI2C data line

    Measurement Ranges

    • Temperature: -40°C to 85°C
    • Pressure: 30000 Pa to 110000 Pa (300 hPa to 1100 hPa)
  4. Wokwi TV Pinout and Operation

    main

    The Wokwi TV simulates a black and white analog PAL TV screen with a resolution of 768x576 pixels and a 4:3 aspect ratio. Unlike standard composite video, Wokwi TV separates the pixel data from the synchronization signals to simplify digital microcontroller implementation.

    Pin Configuration

    NameDescription
    INData (image) signal
    SYNCSynchronization signal
    GNDGround

    Usage

    • Use the IN pin for pixel data.
    • Use the SYNC pin for synchronization pulses.
    • The Arduino TVout library is recommended for driving these signals.
  5. Supported development frameworks for Wokwi for VS Code

    main

    Wokwi for VS Code integrates with various embedded development frameworks and toolchains, allowing you to simulate projects directly from your editor. Supported environments include:

    • PlatformIO
    • ESP-IDF
    • Arduino (including Arduino CLI and Arduino Extension)
    • MicroPython
    • Rust (specifically for ESP32)
    • Zephyr Project
    • Pi Pico SDK
    • NuttX
    • Sming Framework
    • STM32 (HAL and CMSIS)
    • Other toolchains
  6. Use the wokwi-lcd2004 LCD display component

    main

    The wokwi-lcd2004 is an LCD display component featuring 4 lines and 20 characters per line. It shares the same pinout and attributes as the wokwi-lcd1602 component.

    For detailed wiring and code implementation, refer to the wokwi-lcd1602 documentation.

  7. What is Wokwi in the Loop (WITL)?

    main

    Wokwi in the Loop (WITL) is a testing methodology that combines unit testing speed with hardware realism. It allows you to:

    1. Run firmware on a simulated hardware platform.
    2. Interact with firmware using virtual buttons and sensors.
    3. Verify behavior by checking serial output.

    For basic testing, use the wokwi-cli to start simulations and check serial output. For advanced testing, you can write automation scenarios to programmatically push buttons, change sensor states, and validate outputs.

  8. Configure grid snapping and rulers

    main

    The editor uses a default 2.54 mm (0.1 inch) grid for snapping parts and wires.

    • Toggle Grid/Rulers: Press G to show or hide the grid and rulers.
    • Disable Snapping: Hold Shift while dragging to move parts or wires freely.
    • Fine Snapping: Hold Alt or Ctrl while dragging to use a 1.27 mm (0.05 inch) grid.
    • Units: Click the units in the top right corner to switch between millimetres and inches.

    Note: The grid is automatically hidden when a simulation is running and restored when it stops.

  9. Understand the diagram.json file structure

    main

    Every Wokwi simulation project uses a diagram.json file to define the virtual hardware layout. This file specifies which components are present, their visual properties, and how they are electrically connected.

    The basic structure includes:

    • version: Always set to 1.
    • author: The name of the creator.
    • editor: Set to "wokwi".
    • parts: An array of component definitions.
    • connections: An array of wiring definitions.
    • serialMonitor (optional): Configuration for the Serial Monitor.
    {
      "version": 1,
      "author": "Uri Shaked",
      "editor": "wokwi",
      "parts": [],
      "connections": []
    }