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 Reading

Extracting your Windows Licence Key from Ubuntu

Turns out that working with PLC equipment you are still fully stuck to Windows. Which means I have to bite the bullet and get an up to date version of a Windows VM running on my machine. Since I have already paid for my Windows license with my laptop (even though I have never used it) this came in really handy. sudo apt install acpica-tools sudo acpidump -n MSDM This command should dump the Windows key in the bottom right of the output. You can download a recent Windows10 ISO image from Microsoft here: https://www.microsoft.com/en-us/software-download/windows10ISO/ and then install via you favourite virtualisation environment.

Continue Reading

Goodbye Twitter – you were useful for (quite) a while.

After getting rid of my Facebook account a long time ago, finally, I have decided to pull the plug on Twitter as well. I have become increasingly wary of the changes of the platform as it seeks for a way to monetise it's user-base. The timeline has increasingly become infested with annoying ads and no way of getting rid of them. Since Twitter effectively killed the whole app ecosystem with their changes to API rules and banning anything that became useful to a substantial number of people. Another major annoyance has been Twitter's insistence in seeing itself as a 'media platform'. The last thing I need is another media consumption time-sink. The changes I.M.O. is completely misunderstanding their initial user base. While most 'media' people always complained about 140 characters, it served a purpose. Since Twitter started messing with the timeline (letting some algorithm decide what I might find useful) I have been toying with the idea of letting go of my Twitter account. The last straw was the last Australian federal election which really hit home what a toxic echo chamber this platform has become. Even though I have never followed any serving politician it was hard not to get drawn into some of the 'discussions' being a person interested in Agriculture, Environment & Energy policies and following a few accounts in those interest areas. I have better (more productive) things to do than being sucked into hyper-polarised #auspol threads (and frankly - when reading some of the replies…

Continue Reading

Setting up MultiTech LoRaWAN gateway on Ubuntu

As the convener for the Adelaide community of The Things Network, I am frequently setting up Multitech Conduit Gateways. Depending on your PC or notebook hardware you might have some problems with the Exar USB-UART driver on Linux. Here are the steps to getting this unit setup from an Ubuntu (should work for any other Linux distro) machine. lsusb Should show something like this: Bus 002 Device 006: ID 04e2:1410 Exar Corp. XR21V1410 USB-UART IC Download the driver for the Exar site: https://www.exar.com/design-tools/software-drivers unzip xr_usb_serial_common_lnx-3.6-and-newer-pak.zip cd xr_usb_serial_common_lnx-3.6-and-newer-pak make sudo insmod ./xr_usb_serial_common.ko Ensure driver is loaded at startup sudo vim /etc/modules #Add the following xr_usb_serial_common ls /dev/tty* should now show another USB port ttyXRUSB0 For the rest you just need to follow the excellent instructions by Jac Kersing who maintains the Multitech TTN installer and documentation here: https://www.thethingsnetwork.org/docs/gateways/multitech/mlinux.html Get EUI of your gateway mts-io-sysfs show lora/eui 2> /dev/null | sed 's/://g'

Continue Reading

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 Reading

Microchip LoRaWAN Development Utility on Ubuntu

Having just wasted a few hours on getting this Java software running on Linux I am documenting this for future reference and hopefully saving other LoRa / TTN folks some time. Prerequisites Install a Java JDK + JavaFX. This should work with the default OpenJDK 8 or 9 which comes as part of the Ubuntu repositories. I ended up installing Oracle JDK 8 as well as I thought the error might be related to OpenJDK. sudo apt install openjdk-8-jre-headless openjfx Download & install utility Download location: LoRa® Technology Evaluation Kit cd ~/Downloads/ chmod +x LoRaSuite-linux-1.0.run ./LoRaSuite-linux-1.0.run Fix User Preferences This step is required for the Utility to run. Unfortunately, this is documented NOWHERE... Change the following files to include the FilePath entry. The map is empty by default. /home/USERID/.java/.userPrefs/dfu/prefs.xml /home/USERID/.java/.userPrefs/fed/prefs.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd"> <map MAP_XML_VERSION="1.0"> <entry key="FilePath" value="/home/USERID/"/> </map> If you chose the default install location you can now start the utility java -jar ~/Microchip/LoRaSuite/Applications/LoRaDevUtility/LoRaDevUtility.jar A big thank you goes to The Things Network user JBI - who provided this answer in a TTN forum post. No thanks to Microchip as their forum and firmware release policy is a bit of a shocker. There are several reports of such problems in the forum with no answers. Unfortunately, this seems to be no exception with electronics manufacturers (Hello Kerlink!).

Continue Reading

Display your Flickr Favourites as Screensaver Slideshow

Install XScreenSaver and remove Gnome default sudo apt remove gnome-screensaver sudo apt install xscreensaver xscreensaver-gl xscreensaver-gl-extra Run the Screensaver UI and configure In the "Advanced" section enter your Flickr RSS URL in "Choose Random Image" https://api.flickr.com/services/feeds/photos_faves.gne?id=YOURFLICKRUSERID #replace with your Flickr User ID Create a systemd user service to autostart mkdir -p ~/.config/systemd/user/ vim ~/.config/systemd/user/xscreensaver.service Past the following [Unit] Description=XScreenSaver [Service] ExecStart=/usr/bin/xscreensaver -nosplash [Install] WantedBy=default.target Start and enable systemd user service systemctl --user enable xscreensaver systemctl --user start xscreensaver To copy the settings (including RSS URL) onto other PC's or re-install it might be a good idea to backup or copy the contents of ~/.xscreensaver

Continue Reading

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 Reading

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 Reading

Connecting your LoPy to The Things Network in Australia

EDIT [2018-06-05]: I have updated the code with the Firmware 1.18.+ releases. The code is available at our Growing Data Foundation Github. These notes are to assist Australian IoT enthusiasts to get started in connecting a LoPy to The Things Network as it is unfortunately (not yet) straight forward to make them work with the current AU-915 TTN Channel plans. As the initiator of the local Adelaide Community of The Things Network I have been experimenting with a number of devices to connect sensors to #TTNADL. One of my personal favourites is the Pycom LoPy as a nice middle-ground between capabilities and technical complexity. However I ran into a problem where the LoPy would not get a signal back from the TTN network when joining over OTAA even though the TTN Console (http://console.thethingsnetwork.org/) the device showed as connected. With some friendly help from Jose Marcelino at the Pycom Forum this turned out to be an issue with the 915MHz frequency regions. Since there is no actual a standard governing which of the channels are used by TTN gateways, what is outlined here is what is implemented by most TTN communities down under (I know that at least ADL, BNE, SYD and WOL adhere to those). This is the typical Sub-band 2 (Channel 8-15) implementation of AU ISM 915 with TTN Gateways. This channel plan is also implemented by the install script for the MultiTech Conduit Gateways which are currently the most common gateways installed across Australia (see https://github.com/TheThingsNetwork/gateway-conf/blob/master/AU-global_conf.json) Channel#DirectionFrequency MHzBandwidth…

Continue Reading