I am not very skilled with the C Language and I was wondering if there is a way in which python could be used to program an Arduino. This would most likely require a different IDE in order to be able to debug the scripts them self.

  • 2
    There are couple alternatives for programming Arduino, one of them is BitLash and there is a basic interpreter. There are couple options when you search the Internet, but learning C/C++ will pay off in the end.
    – jippie
    Commented Feb 12, 2014 at 17:06
  • Thanks, I am actually getting a bit better at C, just not as good as I am with Python.
    – JVarhol
    Commented Feb 12, 2014 at 17:07
  • 2
    related, more general question: "Arduino programming options other than C++"
    – David Cary
    Commented Feb 15, 2014 at 4:15
  • Is a raspberry PI an option?
    – aaa
    Commented May 21, 2015 at 12:12

10 Answers 10


It's going to be extremely difficult to get any kind of Python script running directly on the Arduino. The reason is that it's an interpreted language, so you would need the interpreter on-board in addition to the plain text script. There's probably not going to be enough memory for all of that.

Your best bet would probably be finding a way to compile a Python script to native machine code (which is how C/C++ works). I believe there are projects around to do something like that for other platforms, but (as far as I know) none which does it successfully for Arduino yet.

You might find some more useful information on this question at Stack Overflow: Is there a way to "compile" Python code onto an Arduino (Uno).


Yes, it is (somewhat) possible to program the Arduino using Python. One such project on Github is the Python Arduino Prototyping API v2. It provides very basic functionality such as digital I/O and analog I/O.

This can be used for very simple projects.

*This project is a bit of a hack at "programming" the board using the serial connection. It passes the commands over the serial connection to a sketch running on the board which then "executes" the Python command.

  • So the board has to be plugged into a computer in order to actually run the code?
    – JVarhol
    Commented Feb 12, 2014 at 16:19
  • @JVarhol Oddly, yes.
    – asheeshr
    Commented Feb 12, 2014 at 16:23
  • 1
    Well, that pretty crappy. It would be easier to use a Raspberry Pi.
    – JVarhol
    Commented Feb 12, 2014 at 16:25

There is a project which brings a Python virtual machine to micro-controllers, including the Arduino Mega.

Here's a quote from the Ardunio Mega README, which gives a feel for what this could be like (though, I've not tested this!):

The following is an example session using ipm::

ipm> import avr, sys
ipm> avr.ddrA(0xff)
ipm> avr.portA(0)       # Pins 22-29 all at 0 V
ipm> avr.portA(0xa5)
ipm> sys.heap()
(2622, 7424)

I have used pyserial with great success in controlling the pins on the arduino. Your workstation (laptop, etc) runs a python script that then communicates in real time to the arduino.

It's not quite the same as running the script directly on the arduino but I was doing quite a bit more than I thought the arduino could handle (some music analysis, hitting a REST api, etc).


Another option to consider is the Arduino Yun. In addition to the AVR chip which most Arduinos have, it also includes a MIPS chip running Linux. Since it's linux, you can easily run python code, and any pure-python package can be easily installed.

However, all the interesting input/output capability is on the AVR chip, not on the MIPS chip. Projects such as Autobahn and LininoIO solve this problem by running a special program on the AVR chip which performs I/O operations under instruction from the MIPS chip.


Yes,its possible with the recent new ArduinoPro H7 which has abilities to upload a written programme in Python and JavaScript and its a dual core,32bit.

  • 1
    Java Script? really? did you try it?
    – Juraj
    Commented Feb 3, 2020 at 19:38

We know this is an open issue in Arduino programming and in the embedded world in general. There are various solutions available on the market like MicroPython but most of them are dedicated to specific boards and don't allow to keep the system real-time. We are working on a solution! VIPER is a Python Virtual Machine for Arduino DUE and all ARM 32 bit architectures that runs on top of a real-time operating system. This means that you can develop Python scripts that can be exexuted by Arduino DUE, UDOO, Spark (all boards) and also on the new ST nucleo boards. Moreover if you need high performances and you re skilled in C you can develop real-time modules for VIPER that can be called and managed by the Python scripts.

You can see VIPER in action here http://bit.ly/kickviper

  • 1
    It’s not an open issue. python is a horrible indentation language.
    – user2497
    Commented Jun 23, 2018 at 19:57

Yes. Python can be used to program an Arduino, simply by importing pyfirmata, which can interface the arduino with Python.

  • True. But that isn't what the OP is asking for. Commented Jun 8, 2018 at 2:40
  • I disagree. Using firmata is effectively "programming an Arduino" using python. In fact I was surprised to see nobody else suggested it. From a beginner's point of view it's pretty much the same. I'm thinking of using it to help teach my son programming as python is a bit easier than C. Commented Apr 17, 2020 at 11:37

You could learn from C (AVR) how sensors work but it needs much more time. Arduino IDE Code and Python Code for Arduino use C Code functions to make things simple. Python and Arduino IDE if use Firmata they use serial communication and you think you code self.


You gotta use pyfirmata because that's the only way to make your son a PRO engineer who makes robots. Also, python can do more advanced stuff so use pyfirmata.

Not the answer you're looking for? Browse other questions tagged or ask your own question.