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

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

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

RaspberryPi Version 3 SOE

Since there is now a supported Raspbian version without GUI and other unneeded add-ons available as Raspbian Lite the need to use other installers (with sometimes some downsides) is now not a necessity anymore. Below is a list of steps I like to perform before using them for any purpose as my Standard Operating Environment. Download Raspbian Lite Download link: https://www.raspberrypi.org/downloads/raspbian/ Write to SD Card dd bs=4M if=2016-05-27-raspbian-jessie-lite.img of=/dev/sdb Boot RPi Default login details are UID: pi PWD: rasbperry Regional settings locale-gen en_AU.UTF-8 dpkg-reconfigure locales ln -sf /usr/share/zoneinfo/Australia/Adelaide /etc/localtime System update apt update && apt upgrade apt install vim Setup SSH keys As a security precausion it's a good idea to disable password authentications ssh-keygen -t rsa vim /root/.ssh/authorized_keys # --> add RSA public key Setup Wireless LAN iwlist wlan0 scan wpa_passphrase SSID WPA_KEY vim /etc/wpa_supplicant/wpa_supplicant.conf Copy the resulting hash from the previous command Example config country=AU ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="YOURSSID" psk=123456789012345678901234567890 } Rename default user account The default Raspbian images use the default user 'pi' - I prefer to change this user to another account for security purposes and to be in line with other Linux system I use. Reboot and log in to the RPi as root - you need to run the following commands as root. usermod -l NEW_USER_ID pi usermod -m -d /home/NEW_USER_ID NEW_USER_ID groupmod --new-name NEW_USER_ID pi mkdir /home/NEW_USER_ID/.ssh/ vim /home/NEW_USER_ID/.ssh/authorized_keys # --> add RSA public key # change owner and permissions on key files chown -R NEW_USER_ID:NEW_USER_ID /home/NEW_USER_ID/.ssh/ chmod 700 /home/NEW_USER_ID/.ssh/ chmod 600…

Continue Reading

RaspberryPi real-world control with REST API

Finally found some time playing with a RaspberryPi and an attached PiFace Interface board to control some garden pumps and potentially an Aquaponics setup in the near future. Requirements Raspberry Pi (Model B in my case, but any will do) PiFace Interface board (http://www.piface.org.uk) Base Raspian (Debian Wheezy) Install (I prefer the clean minimal install via https://githutb.com/hifi/raspbian-ua-netins). Configure the base system as per my previous base install. Install Apache & PHP sudo apt-get install apache2 php5 php5-dev php5-cli php5-mcrypt curl raspi-config Ensure mod-rewrite is enabled sudo a2enmod rewrite Install PHP SPI Extension More info: https://github.com/frak/php_spi git clone https://github.com/frak/php_spi.git cd php_spi ./phpize ./configure --enable--spi make make test make install Install PiFace REST API cd /var/www/ git clone https://github.com/natefanaro/piface-rest-api cd piface-rest-api curl -sS https://getcomposer.org/installer | php php composer.phar install Thanks to Nate Fanaro for the excellent work on the API. Make sure SPI is enabled on the RPi raspi-config Advanced Options --> A5 SPI --> yes Install PiFace Modules sudo apt-get install python3-pifacedigitalio python-pifacedigitalio sudo usermod -a -G gpio www-data sudo usermod -a -G spi www-data For more info visit http://www.piface.org.uk/guides. Apache2 API Configuration Enable SPI extension sudo vim /etc/php5/apache2/php.ini #add the following extension extension="spi.so" Apache VHost config sudo vim /etc/apache2/sites-available/piface Paste the following VHost config <Virtualhost *:80> ServerName HOSTNAME ServerAdmin webmaster@domain.com DocumentRoot /usr/share/piface-rest-api/public_html ErrorLog /var/log/apache2/piface_error.log CustomLog /var/log/apache2/piface_access.log combined <Directory /> AllowOverride All Order allow,deny Allow from all </Directory> </Virtualhost> Enable the newly created VHost a2ensite piface service apache2 restart Testing curl http://HOSTNAME/led/test/ Next up will be some modification for securing access to…

Continue Reading

Mobile sensors and the “Internet of Things” in learning

With the Internet of Things slowly becoming mainstream the potential uses of this technology can also be seen in the Education sector. This blogpost is the first installment of a series of posts that highlights practical examples that can be used in teaching and training. Part 1 - Environmental Noise Monitoring   by  leeander  Noise pollution has been a serious problem in many large cities all over the world and with the help of common mobile devices (smartphones) this can be easily measured, monitored and compared with a large quantity of samples from other cities/regions. Some of the skills taught in these projects are: Environmental science Citizen science (collaborative data gathering) Measurement / sensing Data visualisation Data comparison Here are two very useful pieces of software to undertake this type of project: WideNoise With WideNoise users can monitor the noise levels around them using an App downloadable from Android Market or Apple AppStore. It has geo-location capabilities allowing users to also check the online map to see the average sound level of the area around them. The project has made it's source code available via an Open Source license allowing further customisation. http://www.widetag.com/widenoise/ NoiseTube A project developed by Sony Computer Science Laboratory Paris & VUB BrusSense group allows a user to measure the level of noise in dB(A) (with a precision a bit lower than a sound level meter), and contribute to collective noise mapping effort by annotating it (tagging, e.g. subjective level of annoyance). This information can be automatically published on this website (3G/GPRS or manual upload on…

Continue Reading