Pages

Saturday, March 26, 2016

OpenELEC maintenance

Introduction

last year I built a PC especially for OpenELEC. For those of you who don't know, OpenELEC is a Linux based system with the sole purpose to run Kodi, the all-in-one solution to play all media you throw at it. Because of this sole purpose OpenELEC is very fast, especially on the Intel based system that I built, and very reliable. Over time however some maintenance of the system is necessary to keep the system up-to-date and fully functional.

Kodi running on OpenELEC 6.0.3

Creating a backup

I've added a lot of plugins and changed the settings of OpenELEC, therefore it is a good idea to make a backup. The easy way to do it is to add the Kodi Backup add-on. This plugin stores my userdata on an external drive (even automatically if I wish) as a zip-file. The add-on can be installed from within Kodi (Programs/Add-ons).

The settings of the Backup add-on need to be selected before a backup can be made.

Updating OpenELEC

Last year I installed OpenELEC 5.0 but recently OpenELEC 6.0.3 has been released so it was time to install the new version. I don't like to lose my current settings so instead of installing OpenELEC 6.0.3 fresh I choose to update the system with this latest install. Updating proved to be easy. I downloaded the OpenELEC 6.0.3 update file and placed the file in the /storage/.update folder. With Linux or OSX this can be done in the Terminal

scp OpenELEC-Generic.x86_64-6.0.3.tar root@192.168.xxx.xx:.update

The system will prompt for the password which is openelec. Make sure to use the ip of your OpenELEC system. The system will be updated if it is rebooted.

Updating the YouTube plugin

A month ago my YouTube plugin suddenly stopped working. The author of the plugin (Bromix) stopped the development and this quickly led to problems (as is usually the case with abandoned software). I too couldn't get the YouTube plugin to work anymore. Luckily Kodi being an open source program with a very active users group it didn't take long for others to take over the task of Bromix. I downloaded the YouTube plugin from Raspberryrabbit and copied it to a USB-drive. Before installing his plugin I manually deleted the old YouTube plugin folder. To do this I had to make a ssh connection with the OpenELEC system and delete plugin.video.youtube folder in the .kodi/addons folder.

ssh root@192.168.xxx.xx
password: openelec
cd .kodi/addons
rm -r plugin.video.youtube

Then I inserted the USB-drive with the new YouTube plugin in my OpenELEC system. Next I installed the plugin with the Video-Addon option of Kodi. After a reboot YouTube worked as before.

Luckily it didn't take long long before the YouTube plugin was working again.

Take a screenshot

Kodi has a huge number of built-in functions that can be used if you're a developer of e.g. plugins. These function can also be used remotely with an ssh connection and the kodi-send command. A function that I use is TakeScreenShot. It produces a screenshot and saves it as a png file in the screenshots folder of OpenELEC. With the following commands a screenshot is taken and copied to the current computer.

ssh root@192.168.xxx.xx
kodi-send --host=192.168.xxx.xx --action="TakeScreenShot"

After the screenshot is taken it can be copied remotely with the following command

scp root@192.168.xxx.xx:screenshots/screenshot000.png To/target/folder

E.g. if you want the screenshot copied to your desktop type the following command

scp root@192.168.xxx.xx:screenshots/screenshot000.png Desktop

Wednesday, March 16, 2016

More designing and 3D printing

Introduction

The last couple of weeks I've been busy mastering 3D modeling programs and bringing my creations to life with my Hephestos 3D printer. In this entry I'll share some of my creations and how they were made. For 3D modeling I started with OpenSCAD in the beginning of this year and later started using FreeCAD. The reason for using FreeCAD is that with more complex design in OpenSCAD it is easy for me to get lost in a large script. Yes, the learning curve of FreeCAD is steep but eventually it's easier for me to create more complex models in this program than in OpenSCAD. For simpler models I still like OpenSCAD better.

MineCraft Creeper keychain made with OpenSCAD.

My youngest son is a fan of Minecraft and I suggested to him to make a creeper keychain. With OpenSCAD I could use simple primitives for head, body and legs. By parameterization of the script I can easily change the dimensions of the creeper.

body_height = 40;
body_width1 = 20;
body_width2 = body_width1;

feet_height = 20;
feet_width1 = 20;
feet_width2 = 10;

head_height = 20;
head_width1 = 20;
head_width2 = 26;

module body(){
    cube([body_width1,body_width2,body_height], center = true);
}


module feet(){
    cube([feet_width1,feet_width2,feet_height], center = true);
}

module head(){
    cube([head_width1,head_width2,head_height], center = true);
}

Click here if you want the whole OpenSCAD source file.

Minecraft creeper on the print bed of the Hephestos 2.

Foot for stepladder created with FreeCAD.

My father's stepladder had a broken foot and he asked me if I could made a new one for him. I used FreeCAD to design it using the part design workbench. The part design workbench is probably the main tool in FreeCAD while creating 3D models. Here is the FreeCAD file.

3D-model of the foot made with FreeCAD.

Dice made with FreeCAD and OpenSCAD.

A FreeCAD tutorial series on YouTube, which I highly recommend, contains the modeling of a dice. I did this tutorial and then created the same dice in OpenSCAD just to get some idea of the difference between the two programs. The shape of the dice is easily made by the intersection of a cube and a sphere.

 difference(){
    intersection(){
        cube([dice_size,dice_size,dice_size], center = true);
        sphere(r=dice_sphere);
    }

Next every face of the dice is covered with the dots. Click here if you want the OpenSCAD source file of the dice.

Large dice on the print bed of the Hephestos 2.

Surface generator with OpenSCAD.

While making the creeper I had the idea to add a 'blocky' Minecraft style surface instead of a smooth surface. This idea resulted in some preliminary script that added a 'blocky' surface to a simple cube. The core of the script is this:

cube([1.001,1.001,rands(rands_min,rands_max,1)[0]]);

A cube is drawn where the height (z-axis) is determined by a random number between rands_min and rands_max. This is an example where OpenSCAD shines. With a couple of lines a seemingly complex model can be created (especially when the user is familiar with mathematics and programming). Here is the OpenSCAD source file of the 'blocky' cube.

3D model made in OpenSCAD of a cube with a 'blocky' surface.