Category Archives: Configuration

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

HAproxy

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

http://ORANGEPIPC_IP

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 127.0.0.1.

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

to

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

Enigma 2 – How to read the contents of an image

In the previous article

OpenaATV Enigma2 image compilation

we built an Enigma2 image.

This shows how to view the content  of an Enigma2 image.

As an example we will always use the image for Zgemma H2H.

In a Linux environment, Debian 8 in our case, download the image to a folder, for example enigma2

enigma2 imageIn a terminal unzip it with the command

In the unpacked folder we have several files

rootfsWhat we are interested in is rootfs.bin.

The command

provides informations about the file type. In the case of rootfs.bin

ubithe command indicates that this is an image with ubi filesystem.

Now install the memory technology device utilities as the first step. In a terminal run

To view the contents run

The file  content is now visible under /mnt/ ubifs

ubimountTo unmount the filesystem run

Finally to  detach the UBI from the mtd device use the command

Below the links to find more informations about mtd and ubi filesystem

UBIFS

Linux MTD UBIFS

LEDE on Linkit 7688 Duo – Timecheck example

After the Python ad Firmata example

Firmata and Python

in this example we use the following programming model

duo-yun-bridge

We enable the board to work like Arduino Yun

Linkit 7688 Duo Arduino Yun

As specified in the Mediatek link, you must enable the bridge on the board; from a terminal in Lede run

At the reboot go to the Arduino Ide and choose File->Examples->Bridge->TimeCheck

timecheck_arduino-1-6-5We used the 1.6.5 Arduino Ide; we had issues whith the 1.8 version to build the sketch.

From the Arduino Ide, after the code upload, go to Tool->Serial Monitor to open the serial monitor

timecheckThe serial monitor window shows the current time.

After that, to run the other examples , disable the bridge setting with the commands

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

Firmata.begin(57600);
  while (!Serial) {

and replace it with

  Serial1.begin(57600);
  Firmata.begin(Serial1);
 
  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

Mqtt with Beaglebone and ESP8266 – Articles List

Below is a list of the  articles to follow  to build your IOT environment consisting of sensors and relays with Beaglebone, ESP8266 and MQTT Mosquitto server.

  1. Architecture and Mqtt protocol
  2. Mosquitto Mqtt installation on Beaglebone
  3. Mqtt on ESP8266
  4. Temperature sensor on ESP8266 with Mqtt protocol
  5. Relay on ESP8266 with Mqtt protocol
  6. Configuration of Http server, Mqtt websocket protocol on Beaglebone
  7. Freeboard dashboard installation and configuration on Beaglebone
  8. Android client to manage sensors with Mqtt protocol

Mqtt with Beaglebone and ESP8266 – Android Client

After Mosquitto server, ESP8266 nodes and Freeboard configuration

Mqtt with Beaglebone and ESP8266-Mosquitto installation on Beaglebone

MQTT with BeagleBone and ESP8266-MQTT ESP8266

MQTT with BeagleBone and ESP8266 – MQTT on ESP8266 with temperature sensor

MQTT with BeagleBone and ESP8266 – MQTT on ESP8266 with Relay

Mqtt with Beaglebone and ESP8266 – Freeboard

now we can proceed to use a Mqtt Client on an Android device.

In the Playstore various Mqtt applications are available

android mqttAfter the publishing and subscriber topics configuration in the Android client , analogous to what has been done for Freeboard widgets

Mqtt with Beaglebone and ESP8266 – Freeboard

it is possible to monitor the sensor temperature and humidity, the devices status and send commands to the relay (Turn On, Turn Off, Status, Restart, Sleep) and to the sensor (Restart, Sleep, Status).

Here is a screenshot with some subcriber topic and publisher topics of our installation using MQTT Dashboard

android mqtt relayoffWith the relay on

android mqtt relayon

Mqtt with Beaglebone and ESP8266 – Freeboard

After the Mqtt web client installation

MQTT with Beaglebone and ESP8266 – WebServer and MQTT WebSocket

let’s install now the dashboard freeboard

Freeboard

In a ssh commad shell go into the /var/www/html  folder on Beaglebone as root and clone the freeboard github respository; change the owner of the freeboard folder in www-data:www-data

With a web browser go to the freeboard  folder on Beaglebone webserver to access the dashboard

freeboard

We have to add now Freeboard additional plugins. We add the following

  •  freeboard-mqtt

Clone the https://github.com/alsm/freeboard-mqtt github

Download the mqtt paho javascript library

Paho mqtt javascript library

Here is the direct link to the library

Last Version mqttws31.js

Create the mqtt folder under the Freeboard plugins folder and copy the mqttws31.js and paho.mqtt.plugin.js files

Edit the paho.mqtt.plugin.js file and insert the reference to the mqttws31.js library in the external_scripts section; in this case too we have to change the folder and contents owner

Change the owner

Edit the /var/www/html/freeboard/index.html file and insert the reference to the paho.mqtt.plugin.js plugin in the heads.js section

  • Add the dynamic-highcharts plugin

Clone in a folder the github

Copy the plugin_highcharts.js to the folder /var/www/html/plugins/thirdparty and change the owner

Edit again the file /var/www/html/freeboard/index.html and add the plugin as done above

Access now the Freeboard dashboard and add the links to the temperature and humidity topics, the gauges and timeseries mesauring the values in real time and in a specific range of time . Here are some settings:

  • Datasource

freeboard datasource

  • Gauge

freeboard gauge

  • Timeseries

freeboard timeseriesChrome/Chromium browser allows to save the settings in a json file. This settings can be loaded locally or loaded from the web server, saving for example the dashboard.json file in /var/www/html/freeboard,  with the url

The image shows the Freeboad interface with various widgets showing the status and timeseries of the ESP8266 relay and sensors

freeboard dashboard

In these series of articles we configured the envinronment to access the Beaglebone using the beaglebone.local/beaglebone alias

Debian sd card setup for Beaglebone Black

but you can use anyway the Beaglebone IP tho access the services provided by the board.

In the next article we’ll treat the Mqtt Android client

Mqtt with Beaglebone and ESP8266 – Android Client

 

 

 

MQTT with BeagleBone and ESP8266 – WebServer and MQTT WebSocket

After the MQTT server and  ESP8266 nodes configurations

MQTT with BeagleBone and ESP8266 – Mosquitto installation on Beaglebone

MQTT with BeagleBone and ESP8266-MQTT ESP8266

MQTT with BeagleBone and ESP8266 – MQTT on ESP8266 with temperature sensor

MQTT with BeagleBone and ESP8266 – MQTT on ESP8266 with Relay

we analize now the webserver configuration on BeagleBone and  the Websocket configuration for the broker MQTT mosquitto always on Beaglebone.

First step is to access on the Beaglebone in ssh and disable the following services

Go into the folder /etc/apache2/sites-enabled and modfy 000-default.conf  changing the webserver port from 8080 to 80

In /etc/apache2/port.conf modify the listening port from  8080  to 80

Restart the Http server

Go into folder  /etc/mosquitto/conf.d and create a new file websockets.conf with the following contents inside

Save the file and restart Mosquitto

Disable the IPV6 protocol on  Beaglebone as described at the following link

Disable IPV6 in Debian

In the file /etc/sysctl.conf add

Restart the Beaglebone.

We proceed at this point to install on the http server a MQTT Websocket client and the Freeboard dashboard.

As for the MQTT Websocket client hive-MQTT we download the code from github

Hive mqtt

Log in as root in ssh on Beaglebone and go into /var/www/html folder;  clone the Mqtt client into mqtt-web folder and change the owner of this folder

With a web browser navigate on our Http server to the mqtt-web link obtaining the Mqtt Web client; we can now set the parameters for the connection to the Mosquitto Mqtt Broker

mqtt web client connectionPopulating the values for the subscription and publishing topics we can access to the messages of the topics and the ability to perform a command to the publishing topic

mqtt web clientIn the next article we’ll install the Freeboad dashboard on the Beaglebone

Mqtt with Beaglebone and ESP8266 – Freeboard

Mqtt with Beaglebone and ESP8266-MQTT ESP8266

After installing the MQTT server on BeagleBone

Mqtt with Beaglebone and ESP8266-Mosquitto installation on Beaglebone

let us set the MQTT nodes on ESP8266.

As first operation we must generate the nodemcu firmware, as described in the previous article

Nodemcu compilation on Linux

with at least the following parameters activated in user_module.h file

  • DHT
  • file
  • GPIO
  • MQTT
  • net
  • node
  • timer
  • UART
  • WiFi

These settings are the default in the user_module.h file.

At present the latest version 2.0 of nomemcu firmware was released. Here are the compiled files for this version of the firmware

Nodemcu2.0.0 firmware

As already described in previous articles and from the nodecmu link on flashing

Flashing the firmware

 we have to set the correct parameters for  the  esp8266 model.

In our case, with 4MB flash, we used the parameters shown in the image to load the firmware on the device with nodemcu-flasher tool. You can also use other tools for loading the firmware. In our case, the settings used are as follows

nodemcu flasherIn the next article we’ll treat the ESP8266 node that detects temperature and humidity

MQTT with BeagleBone and ESP8266 – MQTT on ESP8266 with temperature sensor