Source setup Linux - Erriez/R421A08-rs485-8ch-relay-board GitHub Wiki

Minimum easy setup relay commandline

Python 2:

$ python -m pip install pyserial

Python 3:

$ python3 -m pip install pyserial

Download and extract latest source code without GIT

Source code (tar.gz)

Note: Only the commandline versions can be started, such as:

  • $ python3 modbus.py --help
  • $ python3 relay.py --help
  • $ python3 examples/getting_started.py

Full setup including wxPython

Note: wxPython must be build from source which takes about 15..30 minutes.

Install system dependencies, including wxPython

$ sudo apt-get install python3-dev libgtk2.0-dev libgtk-3-dev freeglut3 freeglut3-dev libgstreamer-plugins-base0.10-dev libwebkitgtk-dev libwebkitgtk-3.0-dev libjpeg-dev libtiff-dev libsdl1.2-dev libnotify-dev

Clone GIT project

$ sudo apt-get install git
$ mkdir ~/projects
$ cd ~/projects
$ git clone https://github.com/Erriez/R421A08-rs485-8ch-relay-board.git

Install virtualenv

$ sudo apt-get install virtualenv

Create virtualenv with Python3

$ cd ~/projects/R421A08-rs485-8ch-relay-board
$ virtualenv --python=python3 venv

Activate virtualenv

$ source venv/bin/activate

Install Python requirements in virtualenv

(venv) $ python -m pip install -r requirements.txt

Start commandline scripts

(venv) $ python ./modbus.py --help
(venv) $ python ./relay.py --help

Start GUI

(venv) $ python ./relay_gui.py
(venv) $ python ./modbus_gui.py
(venv) $ python examples/wxpython_toggle.py

Setup wxFormBuilder

wxPython v4.0.1 (Phoenix) requires an updated wxFormBuilder which must be build from source. For this reason, apt-get wxFormBuilder cannot be used.

Install system dependencies

$ sudo apt-get install libwxgtk3.0-dev libwxgtk-media3.0-dev libboost-dev

Clone sources

$ git clone --recursive --depth=1 https://github.com/wxFormBuilder/wxFormBuilder

Build sources

cd wxFormBuilder
./create_build_files4.sh
cd build/3.0/gmake
make config=release

Start wxFormBuilder

cd ../../../output/bin/
./wxformbuilder

Create shortcut (Replace with the path to wxFormBuilder)

$ gedit ~/.local/share/applications/wxFormBuilder.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=wxFormBuilder
Icon=<PATH>/wxFormBuilder/src/wxFormBuilder.ico
Path=<PATH>/wxFormBuilder/output/bin
Exec=<PATH>/wxFormBuilder/output/bin/wxformbuilder
Name[en_US]=wxFormBuilder.desktop

Possible build fixes

# E: Unable to locate package libgstreamer-plugins-base0.10-dev
sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

# source/util.c:6:10: fatal error: Python.h: No such file or directory
#      #include <Python.h>
#               ^~~~~~~~~~
sudo apt-get install python3-dev

# No package 'gtk+-3.0' found
sudo apt-get install build-essential libgtk-3-dev

# configure: error: OpenGL libraries not available
# Error running configure
# ERROR: failed building wxWidgets
sudo apt-get install libglw1-mesa libglw1-mesa-dev
⚠️ **GitHub.com Fallback** ⚠️