Saturday, February 2, 2019

Running Artisan on Raspberry Pi



This post describes how to install Artisan packaged releases and Artisan source on the Raspberry Pi. The process has been tested on the RPi 2B, RPi 3B,and RPi 3B+ but should work for on any RPi running Raspbian Stretch.

By Dave




Introduction


As a user of and contributor to Artisan I wanted to explore using Artisan on this platform.  Artisan installs and runs easily on the RPi.  Unfortunately there are a few pitfalls outside Artisan’s control that can get in the way.  In the end it is not too hard.  To save you time this article is a guide to easily getting everything installed and operating properly.

These instructions are based on the RPi configuration described below.  There may be some unique and different things required for other RPi hardware and software revisions.

Hardware
  • Raspberry Pi 3 Model B
  • 16GB Class 10 SD Card
  • Raspberry Pi 7” Touch Display  

Software
  • Fresh install of Raspbian “Stretch” with desktop (with or without recommended software)
  • Release Date 2018-11-13
  • Kernel Version 4.14
  • System and apps updated on first start as of 2019-02-02
  • Python 3.5.3 supplied with Raspbian Stretch
  • VNC supplied with Raspbian Stretch  

1. Setup the RPi


Setup of the RPi requires a wireless or attached keyboard and mouse.  If VNC is configured then the RPi can be operated from a host computer, which can be a real convenience.

Install Raspbian

 

To install a fresh copy of Raspbian on the RPi, download either "Raspbian Stretch with desktop"or "Raspbian Stretch with desktop and recommended software" from the Raspbian downloads page.  Follow the Install Instructions to flash an SD card.

If Raspbian is already installed on your RPi


It is a good idea to update the packages before installing Artisan

# sudo apt-get update
sudo apt-get upgrade

 

Optional: Enable VNC Server


VNC will allow you to share the RPi's screen with a remote device and will allow you to operate the RPi as if you were directly connected to it.  VNC Server is included with Raspbian.  You need only to enable it and install VNC Viewer on your remote device.  Once setup the VNC server will start and connect automatically when the RPi is booted.

Menu>Preferences>Raspberry Pi Configuration>Interfaces
  • Check Enable for VNC

Open a terminal window to setup and login to the VNC server.


Enter this command:

# vnclicensewiz

Follow the prompts to create or sign in to your VNC account and setup the name for this RPi.  Note that if you have not changed anything the default RPi user is pi.

Of course, you will also need to install VNC Viewer on your remote device.  VNC Viewer can be downloaded from here.

From this point forward you can perform all of the following steps from a remote device.


Recommended: Change screen resolution


If you use the official 7” Raspberry Pi display the default resolution is limiting.  The display is advertised as being 800x480, however there is no Resolution setting in the Raspberry Pi Configuration page that matches this. The default is 720x480.  It is possible to change the frame buffer size to squeeze more information on the screen.  You may want to experiment with these values.  As far as I can tell there is no perfect answer.

# cd /boot
# sudo nano config.txt

scroll down and change the framebuffer lines to 

# uncomment to force a console size
framebuffer_width=1024
framebuffer_height=614



2. Install an Artisan Packaged Release 

 

Install Artisan 


Open a terminal window and enter the following commands. Note that the filename used below will need to be adjusted to match the latest release.

# cd ~
# cd Downloads

# wget https://github.com/artisan-roaster-scope/artisan/releases/download/v1.5.0/artisan-linux-1.5.0_raspbian-stretch.deb

# sudo dpkg -i artisan-linux-1.5.0_raspbian-stretch.deb


(see "Artisan Install Instructions" for further details)



If you use Phidgets you must install the Phidgets22 Driver


# sudo apt-get install libusb-1.0-0-dev
# wget http://www.phidgets.com/gpgkey/pubring.gpg
# sudo apt-key add pubring.gpg

# sudo su -c "echo 'deb http://www.phidgets.com/debian stretch main' >> /etc/apt/sources.list.d/phidgets.list"

# sudo apt-get update
# sudo apt-get install libphidget22 libphidget22extra phidget22networkserver  
# sudo reboot


(see "Install Phidgets22 Drivers on Raspberry Pis" for further details; thanks wbcoffee)



At this point Artisan is ready to run from the menu Accessories>Artisan.



Artisan will look best in Full Screen Mode (View>Full Screen).

Note to artisan.plus users: the first time you login to plus you will be asked to choose a password for a new keyring.  It is recommended that you use the same password as for the RPi login.


3. Install Artisan Source and Python libraries


As an alternative to the installation from an official binary installer documented in the previous section, you can install Artisan from source as described in the following.


Download Artisan Source files


There are multiple ways to get the Artisan source files onto the RPi.    Shown here is a direct download.

# cd ~

# wget https://github.com/artisan-roaster-scope/artisan/archive/master.zip

# unzip master.zip

Git can be used on the RPi to keep the local files in sync with the latest source trunk.  Git is super easy to install on to the RPi (# sudo apt-get install git-core), however Git operating instructions are beyond the scope of this article.


Install PyQt5


# sudo apt-get install pyqt5-dev-tools


Download and Install the Phidgets Python libraries


Important - Be sure you install the Phidgets22 Driver as described above.  It is required to run from source.

Now install the Phidgets Python libraries.

# wget --trust-server-names https://www.phidgets.com/downloads/phidget22/libraries/any/Phidget22Python.zip




In the terminal window just above the prompt you can see the name of the file that was downloaded.  Highlight that filename, right click and select Copy.  Then type unzip followed by a space and again right click this time select Paste. 


You should now have the command shown below.

# unzip <name of the zip file downloaded>


Now we can install the Python libraries

# cd Phidget22Python/
# sudo python3 setup.py install
# cd ~    # return to the home directory


There is a problem with numpy (v1.15.4) and Raspberry Pi 3


The following needs to be done  

# sudo apt-get install libatlas3-base


(see "numpy 1.15.4 and Rasperry Pi 3" for further details)


Install the Python modules needed by Artisan


# cd artisan-master/src
# pip3 install -r requirements.txt
# pip3 install -r requirements-rpi.txt


Optional: If you use artisan.plus and run from source, security keyrings must be installed


# sudo apt-get install gnome-keyring
# pip3 install --upgrade keyrings.alt


artisan.plus users note: the first time you login to plus you will be asked to choose a password for a new keyring.  It is recommended that you use the same password as for the RPi login.

4. Run Artisan from the source


# cd ~/artisan-master/src
# python3 artisan.py

Artisan will look best in Full Screen Mode (View>Full Screen).

5. Issue with error messages to the console


Artisan will run from source but there are warning messages that get sent to the console.  The source is a QT configuration tool called qt5ct.  This program is new in the November 2018 Raspbian release and causes real trouble with many programs other than Artisan.  So far I haven’t seen any ill effects on Artisan from it.  The offending library can be deleted which stops the messages, but doing so affects several of the RPi applications (VLC and PDF Viewer among others).  As long as there is no bad interaction with Artisan we’ll leave it alone.  Since there is no console, the messages are not seen with the distribution build of Artisan.

For reference, these are the messages sent to the console when Artisan starts up:

libEGL warning: DRI2: failed to authenticate
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
inotify_add_watch("/home/pi/.config/qt5ct") failed: "No such file or directory"


Another console message that occurs during use is related to an unresolved Qt issue QTBUG-56893:

QXcbConnection: XCB error: 3 (BadWindow), sequence: xxxx, resource id: yyyyyyyy, major code: 40 (TranslateCoords), minor code: 0



Here is a video from another Artisan user who successfully installed Artisan on their Raspberry Pi.