Skip to the content.

Home

Python Interface for GPIO Circuits

This package provides two related capabilities. First, it provides a high-level, event-driven Python interface for GPIO circuits running on the Raspberry Pi. Sensors, motors, LEDs, switches, and many other components are covered.

Remote Control of GPIO Circuits via REST/HTML/JavaScript

Second, this package enables remote control of GPIO circuits via REST APIs invoked from HTML/JavaScript front-ends. Want to control your circuit remotely from your phone? Look no further. This package auto-generates HTML/JavaScript for GPIO circuits based on Material Design for Bootstrap. These HTML/JavaScript elements can be embedded in full web pages for remote control of the circuit. The remote control screen for the Freenove Smart Car is shown below:

freenove-smart-car

As another example, consider the 3D-printed robotic arm that I designed for the car:

Additional CAD parts that I have designed are listed here.

Use and Development

Raspberry Pi now provides a 64-bit Debian-based operating system (OS) via the Raspberry Pi Imager. The OS is quite good, though for some uses Ubuntu seems to work equally well if not better. I’ve written steps for both operating systems here and here, respectively. The raspberry-py package can be consumed in two ways:

  1. Add raspberry-py to a project as a PyPI dependency. This is the best approach if you only want to use the functionality provided by raspberry-py. The raspberry-py package is available here, and an example of adding the package dependency is provided here.
  2. Fork the present repository and then install it locally. This is the best approach if you want to enhance and/or fix the functionality provided by raspberry-py. In the following, XXXX is the user account into which the repository is forked:
    git clone git@github.com:XXXX/raspberry-py.git
    cd raspberry-py
    python3 -m venv venv
    . venv/bin/activate
    pip install -U pip
    pip install -e .
    

    From here, you can push back to your fork and submit a pull request to the original if desired.

CAD Parts and 3D Printing

I have designed a range of parts for integration with the Raspberry Pi. See here.