Working with Siemens IoT2000 series from Linux

The Siemens IoT2000 series has been a very interesting development from Siemens and it's really encouraging to see the use of Open Source in the Automation sector definitely on the increase. And that can only be a good thing for developer productivity. Seeing a different IDE for each manufacturer of a PLC invokes some nasty memories of last century web-application development... Siemens Simatic IoT2000 Unfortunately, all the documentation for these units still assumes a Windows PC. And since I have not really been using a physical Windows machine for 10+ years now, that is really slowing things down. For the last few I didn't really have to fall back to a VM, largely due to the fact that in web-development nobody cares about OS any longer. But I have a feeling that shifting my focus to the IIoT space this VM will get a bit more useful as some of these manufacturers don't even bother with anything but Windows and are challenged enough to keep up with Windows upgrades. Download existing image The image can be downloaded from the Siemens support site (if you don't have an account with Siemens you might have to sign up for a login first. https://support.industry.siemens.com/cs/document/109741799/simatic-iot2000-sd-card-example-image Create image from sources If you want to create your own image from source you can find the instructions here: https://github.com/siemensHowever for getting around the system the example image has some additional software making it easier to find your way around the system. Create SD card image sudo dd…

Continue ReadingWorking with Siemens IoT2000 series from Linux

Moving to KVM virtual machines

Installing VirtualBox is getting increasingly painful on Ubuntu due to the problems with UEFI Secure Boot and the VirtualBox kernel modules. Another reason for an alternative is that running VirtualBox VM's completely in the background is not as straightforward as it could be. From the available alternatives I looked into (VMWare, Xen & KVM) it was KVM that fitted my needs (casual VM usage with mostly headless VM's for testing purposes). Main reasons: Well supported by Ubuntu Easy, straightforward install Background VM's are simple as Moving VM's from one host to another is a breeze Checking system To check if the CPU can actually support egrep -c '(svm|vmx)' /proc/cpuinfo If the number returned is > 0 your systems should be capable to run. You will also enable your BIOS for virtualisation (in Security settings of most BIOS's) if that has not already be done. You will get an error if not enabled if you are trying to run an install. The Install of KVM will work fine. Installation sudo apt-get install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager sudo addgroup libvirtd sudo adduser libvirtd sudo service libvirtd start sudo service libvirtd status sudo virt-manager Moving VM's to another host Source Host virsh shutdown VMNAME virsh dumpxml VMNAME > /tmp/VMNAME.xml scp /tmp/VMNAME.xml TARGETHOST:/tmp/VMNAME.xml scp /var/lib/libvirt/images/VMNAME.qcow2 TARGETHOST:/var/lib/libvirt/images/VMNAME.qcow2 Target Host virsh define /tmp/vm.xml virsh start vm Once you have confirmed operation you probably want to remove the source VM from the Source Host. virsh undefine VMNAME rm /var/lib/libvirt/images/VMNAME.qcow2

Continue ReadingMoving to KVM virtual machines

GrovePi Zero – connecting your IoT sensors

I recently purchased a GrovePi Zero and expected this to be a reasonable straight forward way to connect Grove sensors to your Raspberry Pi, read sensor values via Python and pushing them upstream via MQTT. However the software side of things turns out anything but straight forward. Most of the suggestions on the Dexter Industries forum suggest to download some custom OS image - WTF? Hopefully this will save some people time to chase down the same rabbit holes..... The problem starts with the install scripts which (a pet hate of mine) assume the /home/pi account to be present. There is a variable in at least the 2 of the install scripts (another Github repository - one calls another from a Github URL - like that will ever work ???) which allows you to change the user account but there is also hard-coded references all over the place that still point to that user account. Trying to step manually through the dependency hell in these install scripts that call other scripts ended to be a complete nightmare. It seems to download specific (old !?!) versions of libraries all of which have perfectly fine binaries in the Raspbian repos. Most of the troubleshooting tips use the UI which is not much good on a headless system. Since all I wanted was to read the sensors from Python I found that there was a library on PyPi (https://pypi.python.org/pypi/grovepi) which should actually do this without installing all this redundant dependencies on what is…

Continue ReadingGrovePi Zero – connecting your IoT sensors

Set up a Raspberry Pi Zero headless

If you are using the GUI (Raspian full download) and want to connect your RPi Zero to a keyboard and monitor there are probably easier ways to do this. These notes are for people that want to use a headless (no monitor and GUI) setup ready to connect to your RPi after first boot via SSH from another terminal. "Raspberry Pi Zero W" (CC BY-SA 2.0) by lespounder Download Raspbian Lite wget -O raspbian-lite-latest.zip https://downloads.raspberrypi.org/raspbian_lite_latest Download link: https://www.raspberrypi.org/downloads/raspbian/ Write Image to SD Card dd bs=4M if=2017-08-16-raspbian-stretch-lite.img of=/dev/sdb After this step there should be 2 additional mounts (if not mount the 2 SD card partitions manually). Set up network interfaces Create a new config file for the wireless interface. cd etc/network/interfaces.d/ vim wlan0.conf Add the following to the new file (if you want to use DHCP - change to static if you want to fix the IP): auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf Set up connection details for local wireless network vim etc/wpa_supplicant/wpa_supplicant.conf Check the file and ensure the network settings are as per the Wireless Network you are connecting to. country=AU ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="SSID" psk=HASHED_PSK_VALUE } You could use the clear-text PSK passphrase but I prefer not to do that in configuration files. Create a PSK hash using 'wpa_passphrase' this older article There could be other config values you might need depending on the network you are connecting to. More info: https://linux.die.net/man/5/wpa_supplicant.conf. Ensure there are DNS Servers configured sudo vim etc/resolv.conf Add the following to the new…

Continue ReadingSet up a Raspberry Pi Zero headless

Using DNSMadeEasy as Dynamic DNS provider on Synology Diskstations

Since Synology (despite requests) still has not added DNS Made Easy as a listed provider (despite listing some really obscure services - go figure!) here is the steps to add a custom provider. DNS Made Easy Setup Create a new A-Record Set the name Set the IP (initial - any valid IP) Tick the "Dynamic DNS" tickbox Enter your chosen Dynamic DNS Password Save the new record When saving the record you will see a "Dynamic DNS ID" - note down this number. This will become the hostname on the Synology setup. Synology Setup Click "Customize" to add a new DDNS provider Name: DNSMADEEASY Query URL http://cp.dnsmadeeasy.com/servlet/updateip?username=__USERNAME__&password=__PASSWORD__&id=__HOSTNAME__&ip=__MYIP__ Click "Add" to add a new DDNS service Service Provider: *DNSMADEEASY Hostname: Dynamic DNS ID from DNS Made Easy Username/Email: your DNS Made Easy email Password/Key: your chosen DNSMadeEasy DDNS password Once you save the new DDNS provider you should see the status to go "Normal" in a green color. This means the update was successful. You should now be able to PING the DNS record or if you log in to DNS Made Easy the IP address should have changed to the external IP of your DiskStation.

Continue ReadingUsing DNSMadeEasy as Dynamic DNS provider on Synology Diskstations

Getting Fujitsu ScanSnap S1300i to work on Ubuntu 16.04LTS

Upgrade or install SANE backends Since the version of SANE in the Ubuntu 16.04LTS repos is not working for this scanner you either need to install from sources (see this blog) or from this PPA. sudo add-apt-repository ppa:rolfbensch/sane-git sudo apt update sudo apt install sane-backends tesseract-ocr gscan2pdf Security Add yourself to the 'scanner' group to be able to use the scanner. sudo usermod -a -G scanner USERNAME Checking SANE Check for the libsane version (needs to be at least libsane.so.1.0.26 not libsane.so.1.0.25 which is in the Ubuntu repos) sudo ldconfig -v | grep libsane This should show something like: libsane.so.1 -> libsane.so.1.0.26 Add udev rules for the scanner sudo vim /etc/udev/rules.d/79-scanner.rules #add the following Fujitsu ScanSnap S1300i ATTRS{idVendor}=="04c5", ATTRS{idProduct}=="128d", MODE="0664", GROUP="scanner", ENV{libsane_matched}="yes" Get the firmware for the FUJITSU ScanSnap S1300i sudo mkdir /usr/share/sane/epjitsu cd /usr/share/sane/epjitsu sudo wget https://github.com/ckunte/scansnap-firmware/raw/master/1300i_0D12.nal Testing scanimage -L >> device `epjitsu:libusb:002:027' is a FUJITSU ScanSnap S1300i scanner You can now use gscan2pdf to scan, clean and OCR from the ScanSnap S1300i.

Continue ReadingGetting Fujitsu ScanSnap S1300i to work on Ubuntu 16.04LTS

Finding Notebook Hardware for Ubuntu – 2015 Edition

Unfortunately it is still much harder than necessary to find notebook hardware to use with Ubuntu (or other Linux variants). This blog is full of past experiences (some of them quite time-consuming) on finding notebook hardware that will work without too much fiddling. This short note is to document my recent research on that front to help others who want to do the same (as there doesn't seem to be a lot of good current info around).    by  TAKA@P.P.R.S  There are some vendors that do ship with Ubuntu, however they are generally all based in the US and their pre-sales communications are pretty horrible (I am talking to you ZaReason - still waiting for reply email as well as tweet). Then there is Purism Librem, but unfortunately they have still not shipped their 15" version and I need a tool now. The jury on this is still out and I don't really have the time to be a guinea-pig. Maybe next time (as I like what they are doing) ... There was one option from one of the top-tier manufacturers (Dell XPS 13 - Developer Edition) which ships with Ubuntu. But as - per usual - NOT in Australia. However there was a lot of conflicting evidence I found that the Windows Version had some issues with current Ubuntu versions (Dell ship 14.04 LTS - which makes sense from their point). I ended up buying the Lenovo X1 (3rd Generation) and after the install of Ubuntu I have to say…

Continue ReadingFinding Notebook Hardware for Ubuntu – 2015 Edition

Installing Ubuntu Phone (Touch) on Nexus 7 LTE

Add SDK repository sudo add-apt-repository ppa:ubuntu-sdk-team/ppa sudo apt-get update sudo apt-get install ubuntu-device-flash Enable USB Debugging on the device Make sure you have developer mode enabled (see http://developer.android.com/tools/device.html if you are unsure). Navigate to Settings > Developer options Enable USB Debugging. When a device is connected, you will be prompted in Android to authorize it. Unlock Bootloader adb reboot bootloader fastboot oem unlock fastboot reboot Check that you have the right device adb shell grep ro.product.name /system/build.prop > mydevicedata \ && adb shell grep ro.product.device /system/build.prop >> mydevicedata \ && adb shell grep build.id /system/build.prop >> mydevicedata ro.product.name=razorg ro.product.device=deb ro.build.id=KTU84P Check which channels are available ubuntu-device-flash --server="http://system-image.tasemnice.eu" query --list-channels --device=deb ubuntu-device-flash --server="http://system-image.tasemnice.eu" query --list-channels --device=deb ubuntu-touch/ubuntu-rtm/14.09 ubuntu-touch/ubuntu-rtm/14.09-proposed ubuntu-touch/utopic ubuntu-touch/utopic-proposed ubuntu-touch/vivid ubuntu-touch/vivid-proposed ubuntu-touch/devel (alias to ubuntu-touch/vivid) ubuntu-touch/devel-proposed (alias to ubuntu-touch/vivid-proposed) ubuntu-touch/ubuntu-rtm/devel (alias to ubuntu-touch/ubuntu-rtm/14.09) ubuntu-touch/ubuntu-rtm/devel-proposed (alias to ubuntu-touch/ubuntu-rtm/14.09-proposed) In my case I am going for the currently stable 'ubuntu-touch/vivid' channel. Install Ubuntu Touch ubuntu-device-flash --server="http://system-image.tasemnice.eu" touch --channel="ubuntu-touch/vivid" --bootstrap References Ubuntu Devices: https://wiki.ubuntu.com/Touch/Devices

Continue ReadingInstalling Ubuntu Phone (Touch) on Nexus 7 LTE

Paperless Office using the Raspberry Pi

This is a follow-up on an older blog using Ubuntu.    by  rosmary  For this purpose I used a Fujitsu ScanSnap S1300i scanner as I really like the features of this series (full duplex scan as well auto document feeder as well for around $250). It's document feeder is not a good as the S1500 we have in the office, but very compact and can be powered from USB hub. Raspberry Pi Prerequisites Since this will be a purely headless install designed to sit in a corner behind the scanner I am using a Base Raspian (Debian Wheezy) install (I personally like the clean minimal install via https://github.com/debian-pi/raspbian-ua-netinst the best). apt-get install sudo vim wget wput libusb-dev build-essential git-core Add non-privileged user account(s) adduser USERNAME adduser USERNAME sudo groupadd scanner usermod -a -G scanner USERNAME Install Sane The version of sane from the Raspbian repos is not working with the Fujitsu ScanJet range and needs to be built from source. git clone git://git.debian.org/sane/sane-backends.git cd sane-backends BACKENDS=epjitsu ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var make make install Install S1300i Driver You need to get the driver file ('1300i_0D12.nal') from the CD that came with the scanner. If you still have access to a CDROM drive that is. :( mkdir -p /usr/share/sane/epjitsu/ cp 1300i_0D12.nal /usr/share/sane/epjitsu/ Check /etc/sane.d/epjitsu.conf and see if the following line is there (in my case it was already created by sane build). # Fujitsu S1300i firmware /usr/share/sane/epjitsu/1300i_0D12.nal usb 0x04c5 0x128d sane-find-scanner -q found USB scanner (vendor=0x04c5 [FUJITSU], product=0x128d [ScanSnap S1300i]) at libusb:001:004 found…

Continue ReadingPaperless Office using the Raspberry Pi

Barebone Ubuntu 14.04 Cloud Desktop

Since I have found some issues with my previous LXQT setup in real-life work I decided to fall back to standard Lubuntu for my cloud desktop. As part of this I also switched to TightVNC which seems a lot easier to configure. Add local user account adduser USERNAME adduser USERNAME sudo Install Lubuntu Desktop sudo apt-get install --no-install-recommends lubuntu-desktop tightvncserver TightVNC Configuration sudo vim /etc/lightdm/lightdm.conf # # VNC Server configuration # # enabled = True if VNC connections should be allowed # port = TCP/IP port to listen for connections on # [VNCServer] enabled=true port=5900 width=1366 height=768 depth=24 sudo /etc/init.d/lightdm restart Connect to the remote system ssh -L 5900:localhost:5900 -i /path/to/your/aws/keyfile.pem YOUR.EC2.IP.ADDRESS   If you are using a Chromebook then this article might help.

Continue ReadingBarebone Ubuntu 14.04 Cloud Desktop