PiGO 2 - module for controlling LEGO® Power functions models/robots with Raspberry Pi

Part of the GH site of Jan Tomsa

PiGO module

Description

PiGO2 enables construction of LEGO® models controlled by an application running on Raspberry Pi.

In PiGO version 2, Raspberry Pi hosts a Python web application (built with Flask framework) offering a REST-like API to control motors attached to the connectors of PiGO and to read the values from GPIO connected sensors.

The programming can be done in Snap! using custom blocks that invoke the functions of PiGO through http GET requests.


PiGO2 Snap! blocks

Usage

The control logic of the LEGO model is programmed in Snap! using 'Domain-level' custom blocks.

These blocks are programmed using combination of standard Snap! blocks and PiGO2 custom blocks.

PiGO2 custom blocks accomplish the communication with the Raspberry Pi through HTTP requests.

List of PiGO2 custom blocks:

  • GPIO_write ... write value to GPIO pin
  • GPIO_read ... read value from GPIO pin
  • GPIO_set_mode ... setting the mode of a GPIO pin to INPUT/OUTPUT
  • PiconZero ... control 2 DC motors via standard DC connectors of Picon Zero + 3 DC motors using the H-bridges connected to Picon Zero's servo control connectors.
  • AFmotor ... control a DC motor connected to Adafruit Arduino shield connected to Raspberry Pi with USB or via I2C.


Overall functionality

TODO: Motors

TODO: ... controlled by PiconZero + dual H-bridge controller

TODO: ... controlled from web app "web.py"

TODO: ... controlled through REST-like API

TODO: ... called via HTTP from Snap! block PiconZero

TODO: ... called via HTTP from Snap!


PiGO module

Construction of PiGO2

PiGO2 is basically an slighthly improved Picon Zero pHat with 2 added H-bridges which enables it to control 2 DC motors via standard DC connectors + 3 DC motors connected to Picon Zero's servo control connectors.

To control the LEGO Power Functions, the Motor power outlets are attached to the connectors from spare LEGO Power Functions cables.


The software of PiGO2

Flask

piconzero library

Source code @ GitHub


Under construction

This page keep improving but is still under construction.

(03.08.2019)

Please come back soon.


... back to main page

Main