An AVR8js-based Arduino simulator for edrys-Lite. It emulates an ATmega328P (Arduino Uno) in the browser using avr8js, with interactive Wokwi circuit components and no hardware required.
Import the module via:
https://edrys-labs.github.io/module-avr8js/index.html
The module accepts two configuration properties:
| Property | Type | Description | Default |
|---|---|---|---|
modules |
String | HTML string of Wokwi circuit elements to display | "" |
execute |
String | Edrys message topic the module listens on for code/hex | "execute" |
YAML example:
modules: |
<wokwi-led color='red' pin='13' label='13'></wokwi-led>
<wokwi-led color='green' pin='12' label='12'></wokwi-led>
<wokwi-led color='blue' pin='11' label='11'></wokwi-led>
<span id='simulation-time'></span>
execute: executeJSON example:
{
"modules": "<wokwi-led color='red' pin='13' label='13'></wokwi-led>\n<wokwi-led color='green' pin='12' label='12'></wokwi-led>\n<span id='simulation-time'></span>",
"execute": "execute"
}All elements are standard Wokwi web components placed in the modules HTML string.
| Element | Description |
|---|---|
<span id='simulation-time'></span> |
Displays elapsed simulation time and CPU performance (e.g. Simulation time: 00:05.123 (98%)) |
<wokwi-led color='red' pin='13' label='LED'></wokwi-led>| Attribute | Description |
|---|---|
color |
Any CSS color or name: red, green, blue, yellow, orange, etc. |
pin |
Arduino digital pin number (0–13) |
label |
Optional text label displayed on the component |
<wokwi-pushbutton pin='2'></wokwi-pushbutton>| Attribute | Description |
|---|---|
pin |
Arduino digital pin to drive HIGH when pressed |
<wokwi-potentiometer pin='A0'></wokwi-potentiometer>| Attribute | Description |
|---|---|
pin |
Analog pin (A0–A5) — returns ADC values 0–1023 |
<wokwi-ntc-temperature-sensor pin='A2'></wokwi-ntc-temperature-sensor>| Attribute | Description |
|---|---|
pin |
Analog pin (A0–A5) |
Interactive slider lets you set temperature from −40 °C to +125 °C. The module simulates the corresponding NTC thermistor resistance and updates the ADC value accordingly.
<wokwi-lcd1602></wokwi-lcd1602>I2C address: 0x27. Use the LiquidCrystal_I2C library in your sketch.
<wokwi-ssd1306></wokwi-ssd1306>I2C address: 0x3D. Use the Adafruit_SSD1306 library in your sketch.
<wokwi-servo pin='9'></wokwi-servo>| Attribute | Description |
|---|---|
pin |
PWM-capable pin. Pulse width 1000–2000 µs maps to 0–180°. Default: 90°. |
Use the Servo library in your sketch.
<wokwi-buzzer pin='8' frequency='1000'></wokwi-buzzer>| Attribute | Description |
|---|---|
pin |
Digital pin driven HIGH to activate audio |
frequency |
Tone frequency in Hz (default: 1000) |
Audio is generated via the Web Audio API. A user interaction (click) is required to unlock audio in the browser.
<wokwi-neopixel-matrix cols='8' rows='8' pin='5'></wokwi-neopixel-matrix>| Attribute | Description |
|---|---|
pin |
Data pin (WS2812B protocol) |
cols |
Number of columns |
rows |
Number of rows |
Use the Adafruit_NeoPixel library in your sketch.
<wokwi-ds1307></wokwi-ds1307>I2C address: 0x68. Initializes to the current system time. Use the DS1307RTC library in your sketch.
| Arduino Pin | AVR Port |
|---|---|
| D0–D7 | PORTD (PD0–PD7) |
| D8–D13 | PORTB (PB0–PB5) |
| A0–A5 | PORTC (PC0–PC5) |
modules: |
<wokwi-led color='red' pin='13' label='LED'></wokwi-led>
<span id='simulation-time'></span>modules: |
<wokwi-pushbutton pin='2'></wokwi-pushbutton>
<wokwi-led color='green' pin='13'></wokwi-led>
<span id='simulation-time'></span>modules: |
<wokwi-potentiometer pin='A0'></wokwi-potentiometer>
<wokwi-lcd1602></wokwi-lcd1602>
<span id='simulation-time'></span>Arduino sketch (requires LiquidCrystal_I2C):
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() { lcd.init(); lcd.backlight(); }
void loop() {
lcd.setCursor(0, 0);
lcd.print("ADC: ");
lcd.print(analogRead(A0));
delay(100);
}modules: |
<wokwi-ssd1306></wokwi-ssd1306>
<span id='simulation-time'></span>Arduino sketch (requires Adafruit_SSD1306):
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3D);
display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("Hello!");
display.display();
}
void loop() {}modules: |
<wokwi-servo pin='9'></wokwi-servo>
<span id='simulation-time'></span>Arduino sketch:
#include <Servo.h>
Servo s;
void setup() { s.attach(9); }
void loop() {
for (int a = 0; a <= 180; a++) { s.write(a); delay(15); }
for (int a = 180; a >= 0; a--) { s.write(a); delay(15); }
}modules: |
<wokwi-neopixel-matrix cols='8' rows='8' pin='5'></wokwi-neopixel-matrix>
<span id='simulation-time'></span>Arduino sketch (requires Adafruit_NeoPixel):
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel pixels(64, 5, NEO_GRB + NEO_KHZ800);
void setup() { pixels.begin(); }
void loop() {
pixels.fill(pixels.Color(255, 0, 0));
pixels.show();
delay(500);
pixels.clear();
pixels.show();
delay(500);
}modules: |
<wokwi-ntc-temperature-sensor pin='A2'></wokwi-ntc-temperature-sensor>
<span id='simulation-time'></span>modules: |
<wokwi-buzzer pin='8' frequency='440'></wokwi-buzzer>
<wokwi-pushbutton pin='2'></wokwi-pushbutton>
<span id='simulation-time'></span>Arduino sketch:
void setup() { pinMode(8, OUTPUT); pinMode(2, INPUT); }
void loop() {
if (digitalRead(2) == HIGH) tone(8, 440);
else noTone(8);
}modules: |
<wokwi-ds1307></wokwi-ds1307>
<wokwi-lcd1602></wokwi-lcd1602>
<span id='simulation-time'></span>- An external editor module compiles Arduino code and publishes the hex on the
executetopic (configurable). - This module receives the hex, loads it into the AVR8js emulator, and starts a 16 MHz simulation loop.
- Wokwi components react to AVR pin state changes in real time (GPIO, PWM, I2C, SPI).
- Serial output (
Serial.print) is displayed in the built-in terminal. - Interactive components (button, potentiometer, temperature slider) inject input back into the simulation.