One of the things I love about JavaScritpt is the fact it keeps finding applications in different domains. One such use is in Arduino, with Espruino (open-source JavaScript interpreter for microcontrollers), and an interesting new one is the AVR8js. AVR8js is an open-source Arduino simulator based on JavaScript that can run in the cloud or virtually anywhere javascript runs.
Arduino has become a household name in the makers and hardware industry mostly thanks to it’s low-cost, easy to use the platform and the amazing community it has created over the years. Nevertheless, not everyone can always get access to an Arduino or a sensor, shield, or something to test run an idea, giving rise to the possibility of using simulators.
Arduino simulators haven’t necessarily been a household name, mostly becomes it is super easy to get an Arduino, one is probably lying next to you, and most simulators don’t work as expected as you wish. In the last 10 years, I think I have roughly tried 2 0r 3 simulators in the past: Proteus VSM and Autodesk TinkerCad. One thing familiar with most of those simulator platforms is that they are closed projects, and you are the mercy of the creators, which is something AVR8js is attempting to solve.
AVR8js is an AVR simulator that allows you to compile and run Arduino code directly in your browser!. AVR8js is open source in nature, and you clone the project and make modifications as you wish. Currently, there are examples of simulating multiple LEDs and even serial output.
Uri Shaked is the creator of AVR8js. He writes:
When I write about JavaScript or other Web-related topics, I often include code samples that you can run and interact with. This allows the readers to tinker with the code and experiment further, as well as test their understanding of the subject.
I wanted to bring the same experience to my Arduino and electronics blog post. That’s how AVR8js, an open-source AVR simulator that runs inside the browser, was born.
The code editor used for AVR8js is based on the modern Monaco Editor, the editor used with Visual Studio and provides support for syntax highlighting, automatic indentation, auto-complete, and many more. The AVR code is compiled to machine code using the Arduino CLI. More information about the AVR8js core is provided in the original post from Uri here.
Although AVR8js is still at its early stages, it has the potential of growing big mostly because of it’s open-source and the fact that it can run anywhere. More information about the project is available on the Github repo.