Snek Lang: feels like Python on Arduinos

Snake image credit: Snek project (

There’s a long time I’ve been interested on some interpreter similar to Python that could run on low end Arduino boards, such as Arduino Nano, Uno or Mega. I have tried “python-on-a-chip” ( / PyMite ( and TinyPy ( Some of these projects are quite old and none of them had the characteristics I wanted. Moreover, seems that they are not maintained anymore. I also tested Arduino-PyMite (, a version of PyMite that can be easily built and loaded on Arduino using Arduino IDE, but it is also not what I wanted.

But today I found a recent project by accident: Snek: A Python-inspired Language for Embedded Devices ( Created by Keith Packard, at the end of 2019, snek has a syntax similar to Python and implements a subset of Python language. I got impressed on how the tools are well organized and structured and about the robustness of the language running tests on an Arduino Mega and an Arduino Uno (

But what I loved most, is the interactive REPL over serial port using standard terminals. Just flash snek on an Arduino, open your terminal and “talk” to the board as you would on a Python REPL prompt. This is so much clean and practical!

Another great work of Keith was to provide tools to easily install / flash snek on Arduinos and other boards. There are also Ubuntu packages for snek, and even a PC interpreter to play with snek on a desktop computer.

In my case, I downloaded and installed the Linux version with these commands:

$ wget
$ chmod +x
$ ./

I installed snek on ~/Snek. After that, we can use tools to easily flash snek on our Arduinos! For example, to flash snek on an Arduino Mega, simply run:

$ cd Snek
$ ./snek-mega-install

Done! Now we can already access snek prompt with any serial terminal. In my case, I tried with minicom:

minicom  -b 38400 -D /dev/ttyACM0

Note that some snek versions are configured to 115200 bps and other, as I have seen on the source code are configured for 38400. The package mentioned above are set to 38400 for Arduino Mega and Uno. Anyway, I could then easily use the REPL to control a LED and read the Arduino’s ADC:

Blinking the LED on D13 pin:


> talkto(D13)
> while True:
+  on()
+  time.sleep(1)
+  off()
+  time.sleep(1)

Reading the ADC:

Snek input values range from 0 to 1 on the ADC, so 1 means 5V for the standard ADC and 0 means 0V. If we multiply the reading by 5.0, we will have the ADC reading in volts. Quick and easy!


> while True:
+  print(read(A0)*5.0)
+  time.sleep(0.8)

Detailed documentation and functions:

Snek’s author/creator presenting it:


Snek has also an editor written in Python, called snekde, but I am happy with the simple serial console. One interesting possibility is to create a web page using avrbro ( and Web Serial, allowing new users to flash snek on Arduinos directly from a standard web page!

Finally, I decided to implement some snek functions as BIPES blocks! Yes! BIPES meets Arduino thanks to Snek! And it worked nicely! Now we can use BIPES to program Arduino with Snek using blocks!

Here is a complete BIPS program, with 3 functions, generating and running code for Snek!

And a simpler example running:


My thanks and congratulations to Keith Packard for this great project! I also thank Jorge Marques ( | ) very much for the refactoring he has made on BIPES code, making it easier to add Arduino / Snek target boards with specific parameters, such as serial speed and buffer size configured at BIPES devinfo.json (

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s