Wokwi Documentation
repository·main·Indexed 41 days ago
https://github.com/wokwi/wokwi-docsDocumentation 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.
What's inside Wokwi
- 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.
Introduction to Wokwi for CI and GitHub Actions
mainWokwi 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.Use the wokwi-clock-generator component
mainThewokwi-clock-generatoris a configurable component used to provide a clock signal to other parts of your circuit in the Wokwi simulator. It outputs a single clock signal on itsCLKpin.BMP180 Barometric Pressure Sensor Overview
mainThe 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
Name Description VCC Voltage supply 3.3V 3.3V supply GND Ground SCL I2C clock line SDA I2C data line Measurement Ranges
- Temperature: -40°C to 85°C
- Pressure: 30000 Pa to 110000 Pa (300 hPa to 1100 hPa)
Wokwi Potentiometer Reference
mainThewokwi-potentiometeris a knob-controlled linear variable resistor. It can be used to simulate analog input for microcontrollers. Note that the same information applies to thewokwi-slide-potentiometer.Wokwi TV Pinout and Operation
mainThe 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
Name Description INData (image) signal SYNCSynchronization signal GNDGround Usage
- Use the
INpin for pixel data. - Use the
SYNCpin for synchronization pulses. - The Arduino TVout library is recommended for driving these signals.
- Use the
Supported development frameworks for Wokwi for VS Code
mainWokwi 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
Use the wokwi-lcd2004 LCD display component
mainThe
wokwi-lcd2004is an LCD display component featuring 4 lines and 20 characters per line. It shares the same pinout and attributes as thewokwi-lcd1602component.For detailed wiring and code implementation, refer to the
wokwi-lcd1602documentation.Use the wokwi-ir-remote component
mainThe
wokwi-ir-remoteis a 38KHz infrared remote with 20 function keys. It is designed to be used in conjunction with the IR Receiver module to simulate infrared communication in Wokwi projects.To use it in your simulation, add the
<wokwi-ir-remote />component to your diagram.<wokwi-ir-remote />What is Wokwi in the Loop (WITL)?
mainWokwi in the Loop (WITL) is a testing methodology that combines unit testing speed with hardware realism. It allows you to:
- Run firmware on a simulated hardware platform.
- Interact with firmware using virtual buttons and sensors.
- Verify behavior by checking serial output.
For basic testing, use the
wokwi-clito start simulations and check serial output. For advanced testing, you can write automation scenarios to programmatically push buttons, change sensor states, and validate outputs.Configure grid snapping and rulers
mainThe editor uses a default 2.54 mm (0.1 inch) grid for snapping parts and wires.
- Toggle Grid/Rulers: Press
Gto show or hide the grid and rulers. - Disable Snapping: Hold
Shiftwhile dragging to move parts or wires freely. - Fine Snapping: Hold
AltorCtrlwhile 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.
- Toggle Grid/Rulers: Press
Understand the diagram.json file structure
mainEvery Wokwi simulation project uses a
diagram.jsonfile 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 to1.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": [] }