Tag Archives: python

OctoPrint installation on Orange PI PC – Printer Settings

After  defining the local hostname resolution

Local Hostname Resolution

at this point it is necessary to configure the printer.

WARNING: Use of the settings shown is at your own risk. We assume no responsibility if these settings cause malfunctions or breakage of the printer.

At the first access to OctoPrint, the basic parameters for managing the printer are requested. In our case, we connect the Orange PI PC to an Anet A8 3d printer via the USB port. At the first access to the address


 a configuration mask is shown

octoprint-accesspressing next we access the next screen where to define the user who manages the printer with his password

octoprint-accesscontrolWe press Keep Access Control; the next step is  the control of the Internet connection in which we disable the Connectivity Check

octoprint-accessconnectivityWe have to import our cura profile for Anet A8 and set  the path to the executable CuraEngine, compiled in the previous article

Octoprint Installation



The imported profile must be generated by Cura 15.04.x or older. Below is the link to the various versions of the Cura software


We can now define the parameters of the printer, in our case Anet A8

octoprint-printer1We set the bed size and print volume

octoprint-printer2The speed of movement using the control panel is defined in the next step; we set up conservative parameters

octoprint-printer3Finally, we set the extruder parameters


At the next screen we set the commands to be sent to Debian directly from OctoPrint; they are set as follows


where in the password you must enter the password to run the root commands on Debian.

The folder in which Octoprint has been installed is inserted for the software update

octoprint-swupdateWe do not insert anything for the webcam

octoprint-webcamFinally, the configuration is completed with the Finish button.

octoprint-finishFor more OctoPrint settings and addons refer to the site


In the next article we’ll print a test model.

OctoPrint installation on Orange PI PC – Local Hostname Resolution

After configuring haproxy for the use of content in http on the standard port

HAProxy Installation

we configure the Linux machine to publish the hostname on the network with the avahi daemon.

On Linux and OSX machines this service is natively visible, while for Windows systems it is necessary to install the Bonjour service

Bonjour application for windows

On the Orange PI PC the avahi daemon must be installed with the command

We change the name to which our 3D print server must match in the two files /etc/hosts and /etc/hostname

In our case the name orangepcpc has been changed to 3dprinter.

Restarting the linux box, the services are accessible  using the name 3dprinter.local.

avahiIn the next article we’ll show a printer configuration

Printer Settings

OctoPrint installation on Orange PI PC – HAProxy Installation

After the automatic start of OctoPrint configuration

OctoPrint Autostart

at this point we can set up the system to answer to the standard port of an Http server.

For this purpose we install and configure the HAProxy reverse proxy


Proceed to the installation

Edit the /etc/haproxy/haproxy.cfg file and add to the default the directives including also the use of webcam

Restart the proxy with the command

Restart the Orange PI. If everything is configured correctly, the 3D print server answers on port 80  of the Orange Pi PC ip address


haproxyIt is possible to map the Octoprint service on port 5000 only to the loopback interface by editing the file ~/.octoprint/config.yaml

and adding the host reference under the server directive

Restart OctoPrint

Now the 5000 port is mapped only with the address

In the next article, we’ll configure Linux to publish the hostname on the network so that it can be accessed through this reference without using the IP address

Local Hostname Resolution

OctoPrint installation on Orange PI PC – Autostart

After the installation of OctoPrint and CuraEngine in the previous article

OctoPrint Package Installation

we treat now the configuration of the 3d print server.

As first operation, we set up the automatic startup of OctoPrint.

Run the following commands

Edit the /etc/ defaults/octoprint file changing the pointing to the executable to start OctoPrint using vi

or nano

and edit the file from


taking into account also the different user being used.

Add the script to startup automatically OctoPrint

Start OctoPrint  with the command

Check that OctoPrint is active on port 5000 of the Orange PI PC by accessing the address

Rebooting the Orange PI PC, the OctoPrint server now starts automatically.

In the next article, Linux will be configured to connect to OctoPrint on the Http standard port, i.e. on  port 80

HAProxy Installation

OctoPrint installation on Orange PI PC – Python package installation

This article describes how to enable the Orange PI PC board to work as 3d printers network server.

A  software that provides this functionality is OctoPrint


From the OctoPrint site we can download an image for Raspberry PI with the system already ready; in the case of the Orange PI PC we have  to install and configure OctoPrint on a Linux image.

You can also use a Linux image available for Orange PI PC and run the steps related to OctoPrint package installation, but you have to check the prerequisites for Octoprint python package installation.

We instead built for this article an image using the Armban scripts.

As a first step, prepare the micro sd card with an Armbian image. In the specific case, we’ll use a Debian Jessie image created using the Armbian script, as indicated on the link

Armbian building

and described also in a previous article

Building Armbian image for Orange PI PC

We followed these steps to build the Armbian image on Ubuntu Xenial 16.04; from  a Linux command shell

In the building options choose

armbianopipcfosWe selected the default kernel configuration

armbianopipckernelChoose an Orange PI PC board

armbianopipcboardWe used the mainline kernel

armbianopipcmlkerneland Debian Jessie as distribution

armbianopipcjessieWe built an image with desktop envinronment

armbianopipcjessiedeAfter this option, the script proceeds to the compilation. The generated image is Armbian_5.34_Orangepipc_Debian_jessie_next_4.13.12_desktop.img. This image can be downloaded from the link

Armbian image for Orange Pi PC

Start Armbian and create the user for the Jessie image; in this case we choose octoprint/password as user.

If necessary, reconfigure the keyboard with the command

and proceed to upgrade the system

If the system needs to be configured via a wireless connection, the connection must be active at startup. For this purpose in our case we used the Wicd daemon

Wicd Debian

Remove the network-manager package

This command uninstalls network-manager and network-manager-gnome.

Check that the wireless interface is not present in


Proceed to Wicd installation

Check that the octoprint user is present in the netdev group

In our case it is already present, giving as a result


If not present, add it with the command

Start  wicd

Logon to the armbian graphic desktop and start the wireless configuration with the command


Configure and save the network connection from the graphical interface.

If you want the remote desktop follow the steps listed in the article

Remote desktop setup for Armbian on Orange PI PC

We can now install Octoprint. Follow the steps available at the link

OctoPrint installation on Linux

Install the prerequisites

Create under /opt the octoprint folder and assign the ownership  to octoprint

In a Linux shell command go to /opt/octoprint  folder and download the software


Create the  .octoprint folder

Add  octoprint to the following groups  to manage the 3d printer using the USB port

Check  the correct installation by running the command

The OctoPrint server can be reached on port 5000 at the IP address of Orange PI PC



Install the Cura Engine at this point; place yourself in the octoprint user’s home and download the source package

Unpack the package

Go into  the unpacked folder

Run  the compilation with the command

The compiled software is located under the build folder

curaengineCreate the /opt /octoprint/cura folder and copy the CuraEngine file to this folder

The executable is now in the /opt/octoprint/cura folder and will be used later by OctoPrint.

In the next article we’ll treat how to configure OctoPrint’s automatic startup

OctoPrint Autostart

LEDE on Linkit 7688 Duo – Firmata and Python

After the python test in the previous article

LEDE on Linkit 7688 Duo – MPU-MCU Uart communication

here we describe how to do the same operation using the Firmata  python library

Firmata Protocol

In this case, the programming model is the following

duo-firmata-archAs first step,  described in the Mediatek article

Using Firmata with Python

we install the Firmata python library; in a linux terminal on LEDE run

In the Arduino IDE choose File->Examples->Firmata->StandardFirmata

arduinofirmataMake the following change in sketch code:

Look for the code

  while (!Serial) {

and replace it with

  while (!Serial1) {

Save the file and perform the compilation and upload on the Linkit 7688 Duo.

In a linux terminal  in Lede create the blink_with_firmata.py file and copy the following code inside

Save and quit.

Always in a linux terminal run now

The LED on the card should turn on and off.

Below is the link to download the two files  ready for the Link 7688 Duo

 Lede Python Firmata files

In the next article we’ll enable the board to work like Arduino Yun

LEDE on Linkit 7688 Duo – Timecheck example

LEDE on Linkit 7688 Duo – MPU-MCU Uart communication

After the building and installion of the LEDE firmware on the Linkit 7688 Duo card

Installation and configuration of Lede image on Linkit 7688 Duo

let’s test the functionality of some features on the card.

You can find the Mediatek article with the  programming model

Programming model

As a first example we treat the one on the Mediatek site as described in the title of the article

Linkit 7688 DUo MPU-MCU Uart Connection

which corresponds to the following programming model


As first step, Arduino IDE is configured as described in the link

Arduino IDE for Linkit 7688 Duo

the following code is uploaded on the Linkit 7688 Duo

This code manages  the LED by the MCU according to the commands that the MCU receives at the Serial1  port.

Logic is handled instedad by python code that runs on Linux; create a file for this purpose, such as blink.py in a linux command shell on the board, with the following code

Running the code

the LED on the card should turn on and off continuously.

In the next example we’ll use the Firmata python library to perform the same operation

 LEDE on Linkit 7688 Duo – Firmata and Python

Temperature and humidity reading on Beaglebone in python

In the previous article we connected the DHT11 sensor to the Beaglebone

Sensors on Beaglebone

We install at this point the library in python and modules in c to read the sensor. The site with documentation about the library is

Adafruit Python DHT Sensor Library

Log in ssh on Beaglebone as root / no password and create the temperature folder from which we run

Install the prerequisites

Proceed to the installation of the library with the python command

Enter the examples directory and do the following for reading the sensor values (dht 11 and pin P8_11)

The result in this case is the following

temperature reading