Python - Arduino communication

Overview

PyPi module N/A
git repository https://bitbucket.org/arrizza-public/pycro-arduino
git command git clone git@bitbucket.org:arrizza-public/pycro-arduino.git
Verification Report https://arrizza.com/web-ver/pycro-arduino-report.html
Version Info
  • Ubuntu 20.04 focal, Python 3.10
  • Ubuntu 22.04 jammy, Python 3.10

Summary

A python interface to a microcontroller with a Hardware Abstraction Layer (HAL).

This module allows a python script to control an Arduino. It read or write any of the Digital or Analog pins. Use the python module https://bitbucket.org/arrizza-public/pycro-hal/src/master/ to communicate with an Arduino flashed with pycro-arduino.

See https://arrizza.com/pycro for the full communications protocol or the doc/comm_protocol.md in pycro-hal repo.

Build it

Currently only tested on an Arduino Nano board. You can try it on other Arduinos by changing this line in CMakeLists.txt.

set(MY_BOARD nano328)

Change CmakeLists.txt with the correct serial/UART port name:

set(MY_PORT /dev/ttyUSB0)

Then build/upload it:

./doit        # build and then upload it
./do_build    # only build it
./do_upload   # only upload it

Run it

See HAL README.md for more information about the communication with the Arduino from a Python script works.

- John Arrizza