Introduction: Python3 and Arduino Communication

About: Learn, Share , think, try Make it Simple :)

Project Description

In this project we will be sending commands from Python3 to an Arduino board, which will make things easier to understand when communicating between Python3 and Arduino. We will make a "Hello world" of the Arduino platform which means turning ON/OFF built-in LED on the Arduino Uno.

So first of all let me tell you...

Why i made this project ?

Firstly, there are many tutorials uploaded on internet specially on youtube about this topic but they are using Python2 versions, and secondly, I had installed latest version which is Python3.7.2. There is a little bit of difference between Python2 and Python3 when you are using it to connect with Arduino. So after I solved the problem of sending command from Python3 to Arduino, I thought this should be shared to makers and the entire hobbyist community.

Let's start

Components you need :

  1. Arduino UNO board
  2. USB cable

That's all you need in terms of hardware :)

Step 1: Installation Procedure

How to install python3 version and PySerial package

Now you can search on YouTube about installation stuff. Above is video for installing both Python3 version and PySerial package.

Step 2: Coding in Arduino

Part1: Coding in arduino



Step 3: Coding in Python3

Part2: coding in python3


Step 4: Source Code of Arduino and Python3

Note

Make sure that first you upload Arduino sketch and then Python code. :)
Let me know on comment section if you are having any issue while making this project.

Attachments

Step 5: