GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - wokwi/avr8js: Arduino (8-bit AVR) simulator, written in JavaScript and runs in the browser / Node.js

BranchesTags
Open more actions menu

Latest commit

 

History

352 Commits
352 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.husky
.husky
 
 
.vscode
.vscode
 
 
benchmark
benchmark
 
 
demo
demo
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.gitpod.yml
.gitpod.yml
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
eslint.config.mjs
eslint.config.mjs
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
prettier.config.js
prettier.config.js
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.spec.json
tsconfig.spec.json
 
 
vitest.config.ts
vitest.config.ts
 
 

Repository files navigation

AVR8js

This is a JavaScript library that implementats the AVR 8-bit architecture.

It's the heart- but not the whole body- of the Arduino simulator at https://wokwi.com.

Build Status NPM Version License: MIT Types: TypeScript Gitpod ready-to-code

Example Applications Using AVR8js

  • Wokwi Arduino Simulator - Arduino simulator with a choice of hardware that can be wired up dynamically in your browser!
  • avr8js-electron playground - a Downloadable Electron Arduino simulator app
  • AVR8js-Falstad - combining the Falstad circuit simulator with AVR8js!
  • The Engineering Physics Department of Dawson College's Arduino Course - an introduction to Arduino with a focus on robotics

How to Use This Library

This library only implements the AVR CPU core. You have to supply it pre-compiled machine code to run, and implement functional simulations of any external hardware. You will probably also want to add audio/visual representations of external hardware being simulated.

A rough conceptual diagram:

Pre-Compiled machine code --> AVR8js <--> Glue code <--> external hardware functional simulation <--> simulation state display for the user

You may be interested in exploring the wokwi-elements collection of web-components for visual representations of many common hardware components. (Note: these are visual only elements- you will need to add the appropriate functional simulation and glue code.)

Walkthrough Video Tutorial

A step-by-step video tutorial showing how to build a simple Arduino simulator using AVR8js and React:

AVR8JS Walkthrough Video

And a related blog post.

Unofficial examples

These examples show working examples of using avr8js in an application. Many of them also demonstrate how to use the wokwi-elements and include working examples of functional simulations of the components, and how to hook them up to avr8js.

  • Minimal Example
  • 6 LEDs
  • LED PWM
  • Serial Monitor
  • NeoPixel Matrix
  • Arduino MEGA NeoPixel Matrix
  • Simon Game - with pushbuttons and sound
  • XMAS LEDs
  • Assembly Code
  • EEPROM persistence

Note: they are all hosted outside of this repo.

Running the demo project

The demo project allows you to edit Arduino code, compile it, and run it in the simulator. It also simulates 2 LEDs connected to pins 12 and 13 (PB4 and PB5).

To run the demo project, check out this repository, run npm install and then npm start.

Which chips can be simulated?

The library focuses on simulating the ATmega328p, which is the MCU used by the Arduino Uno.

However, the code is built in a modular way, and is highly configurable, making it possible to simulate many chips from the AVR8 family, such as the ATmega2560 and the ATtiny series:

  • ATtiny85 Simulation

Check out issue 67 and issue 73 for more information.

Running the tests

Run the tests once:

npm test

Run the tests of the files you modified since last commit (watch mode):

npm run test:watch

For more information, please check the Contributing Guide.

License

Copyright (C) 2019-2025 Uri Shaked. The code is released under the terms of the MIT license.

About

Arduino (8-bit AVR) simulator, written in JavaScript and runs in the browser / Node.js

blog.wokwi.com/avr8js-simulate-arduino-in-javascript/

Topics

arduinoatmegaatmega328pavrjavascriptmicrocontrollersimulationtypescript

Resources

Readme
MIT license

Contributing

Contributing
Activity
Custom properties

Stars

856 stars

Watchers

20 watching

Forks

136 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.