Brilliant Things People Built with AVR8js Arduino Simulation πŸƒβ€β™€οΈ

Virtual robotics lab at Dawson College, Soulmate's FastLED pattern editor, Electronic circuit simulator, and an Electron-powered desktop Arduino lab

Brilliant Things People Built with AVR8js Arduino Simulation πŸƒβ€β™€οΈ

Last year, I released the first version of AVR8js, an open source Arduino Simulation framework, written in JavaScript (TypeScript, to be exact). Back in the day, the demo couldn't do much more than blinking a few LEDs or writing output to the Serial console.

While I was busy working on the simulator itself (and some other stuff), I'm thrilled so see where other people have taken this open source library, and how they built useful applications and educational materials around it.

Here are some examples that I'm particularly excited about:

Dawson College Virtual Lab

Tawfiq Jawhar is building a beginner Arduino programming course for his students. He integrated VuePress with AVR8js and Wokwi Elements to create a learning environment with integrated exercises, where you can tinker with the code, run it in simulation and get immediate feedback.

Arduino programming lessons with interactive code simulation @ Dawson College

But it doesn't stop here! The next module, Engineering Physics Lab, combines AVR8js with matter-js, a 2D rigid body JavaScript physics engine, to create a virtual robotics environment. You will learn how to control servo motors, and combine them with ultrasonic sensor to solve fun challenges where you avoid walls and collect coins:

Gotta Catch 'Em All!

If you are interested to see how it was built, take a look at the source code on Tawfiq's GitHub. Tawfiq also expressed interest in contributing SD Card simulation to AVR8js.

AVR8js Electron Playground

This project, created by Anderson Costa from Brazil, aims to bring AVR8js simulation to the desktop. He collected various code examples and snippets and put everything together into a nice app that lets you tinker with many different pieces of hardware at once:

If you want to take it for a test drive, simply head to his GitHub repo, clone it, and run npm install followed by npm run dev. Then, play around with the built-in code examples by clicking one of the buttons on top (e.g. fire ?), then "COMPILE" and "RUN".

Anderson also experimented with running 6502 simulator inside the Arduino simulator (inception style), which currently runs a EhBASIC interpreter, and should theoretically be able to run Atari 2600 games and other cool stuff. I'm really looking forward to seeing where Anderson will take it!

Soulmate LED Pattern Editor

Soulmate is the brand name of programmable smart LED matrices, designed by Elliott Kember. He created an online editor which allows you to play around with different LED patterns programmed with Arduino and the FastLED library:

One online editor, so many patterns

Some of my favorite patterns include DNA, Flower, Metaballs and Digital Rain. There's also a handy step-by-step tutorial that walks you through the basics of programming your own LED patterns.

Electronic Circuit Simulation with CircuitJS1

Mark Megarry combined AVR8js with CircuitJS1, an electronic circuit simulator that runs in the browser. You can probably see why combining an Arduino simulator with an electronic circuit simulator can be a good idea, and this is what the result looks like:

You can attach any Arduino pin to any point of the analog circuit, and it works like a charm. For instance, the above example will drive pin 13 high when pin 7 is high (thus, making the switch control the state of the LED):

CircuitJS1 + AVR8js in action!

The circuit simulation engine is written in Java, and is compiled into JavaScript using GWT, Google Web Toolkit (yes, that project is still active!).

You can play around with his project here, or peek at the source code.

Info1 Board Going Virtual ?

Speaking of collages, Glenn Feunteun, an embedded systems teacher at the French UniversitΓ© de Bretagne Occidentale, is working on creating a virtual version of their Info 1 board, which they use for their introductory course:

An older version of the Info-1 Arduino MEGA ADK "Shield"

Glenn says, that since the COVID 2019 outbreak, the school has gone full remote and they are looking for ways to teach these concepts to students at home. This prompted the creation of the "Virtual Info-1", with pretty much the same hardware:

While working on this project, Glenn has contributed code to improve the simulation performance (here and here), helped with the AVR 16-bit timer implementation, and even created the Speaker wokwi-element.

And that's it!

When I started working on AVR8js, I wasn't sure whether releasing it as a MIT-licensed open source project was a good idea. One year later, I am so happy to see how talented engineers used this library in their projects, and I'm sure there's much more to come!

I'm now working on improving the Wokwi Arduino simulator, based on feedback from the FastLED community, and building a page where you can tinker with many popular Arduino libraries, as well as working on GoodArduinoCode.

If you build something cool with these technologies, please let me know. I'm waiting for your messages at uri+avr8js@wokwi.com!