Skip to content

Commit

Permalink
Upload files
Browse files Browse the repository at this point in the history
  • Loading branch information
uwedaeu committed May 4, 2022
0 parents commit a6a97b2
Show file tree
Hide file tree
Showing 18 changed files with 190 additions and 0 deletions.
26 changes: 26 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# **Legal information**

## **Use of application examples**

Application examples illustrate the solution of automation tasks through an interaction of several components in the form of text, graphics and/or software modules. The application examples are a free service by Siemens AG and/or a subsidiary of Siemens AG (“Siemens”). They are non-binding and make no claim to completeness or functionality regarding configuration and equipment. The application examples merely offer help with typical tasks; they do not constitute customer-specific solutions. You yourself are responsible for the proper and safe operation of the products in accordance with applicable regulations and must also check the function of the respective application example and customize it for your system.

Any change to the application examples is your responsibility. The application examples are not required to undergo the customary tests and quality inspections of a chargeable product; they may have functional and performance defects as well as errors. It is your responsibility to use them in such a manner that any malfunctions that may occur do not result in property damage or injury to persons. Siemens reserves the right to make changes to the application examples at any time without notice. The application examples of this repository are licensed under the MIT License (see below).

## MIT License

Copyright 2021 Siemens AG

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## **Security information**

Siemens provides products and solutions with industrial security functions that support the secure operation of plants, systems, machines and networks. In order to protect plants, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art industrial security concept. Siemens’ products and solutions constitute one element of such a concept. Customers are responsible for preventing unauthorized access to their plants, systems, machines and networks. Such systems, machines and components should only be connected to an enterprise network or the Internet if and to the extent such a connection is necessary and only when appropriate security measures (e.g. firewalls and/or network segmentation) are in place.
For additional information on industrial security measures that may be implemented, please visit [https://www.siemens.com/industrialsecurity](https://www.siemens.com/industrialsecurity).

Siemens’ products and solutions undergo continuous development to make them more secure. Siemens strongly recommends that product updates are applied as soon as they are available and that the latest product versions are used. Use of product versions that are no longer supported, and failure to apply the latest updates may increase customer’s exposure to cyber threats.

To stay informed about product updates, subscribe to the Siemens Industrial Security RSS Feed at: [https://www.siemens.com/industrialsecurity](https://www.siemens.com/industrialsecurity).
148 changes: 148 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# **LoRa Gateway**

- [**LoRa Gateway**](#lora-gateway)
- [**Overview**](#overview)
- [**Software**](#software)
- [**Hardware**](#hardware)
- [**Installation and commissioning of the IOT2050 LoRaWAN Gateway**](#installation-and-commissioning-of-the-iot2050-lorawan-gateway)
- [**Hardware installation**](#hardware-installation)
- [**Prepare the IOT2050**](#prepare-the-iot2050)
- [**Software installation and commissioning**](#software-installation-and-commissioning)
- [**Setup the The Things Network Account as LoRa server**](#setup-the-the-things-network-account-as-lora-server)
- [**Create gateway application**](#create-gateway-application)
- [**Start the Application after Reboot**](#start-the-application-after-reboot)
- [**Autostart of the LoRa-Gateway**](#autostart-of-the-lora-gateway)
- [**Contribution and Contribution License Agreement**](#contribution-and-contribution-license-agreement)
- [**Licence and Legal Information**](#licence-and-legal-information)

## **Overview**

The application shows how a gateway can be built using the LPWAN technology Long Range (LoRa) and the IOT2050. The global, free LoRaWAN (Long Range Wide Area Network) from The Things Network or The Things Stack Community Edition is used as the network server. This manual describes the software and hardware structure of the gateway.

![overview LoRa application](docs/graphics/1-1-overview.png)

This application describes the setup with the WM1302 LoRaWAN Gateway Module (USB) - EU868.

## **Software**

The following software is used for the application:

- PuTTY V0.75 to access the IOT2050
- optional: WINSCP V5.19.3 to copy prepared files to the IOT2050 (for autostart-function)

## **Hardware**

The following hardware components are required for the application:

- **SIMATIC IOT2050** as the LoRaWAN-Gateway
- **WM1302 LoRaWAN Gateway Module (USB) - EU868**
- **2 dBi Dipole Antenna 863-870MHz with RP SMA** (the selected antenna is based on the frequency range used in Europe from 863 to 870 MHz)
- **U.FL to reverse SMA adapter** as antenna cable

## **Installation and commissioning of the IOT2050 LoRaWAN Gateway**

The IOT2050 will be used as LoRaWAN gateway. As the IOT2050 does not include a LoRaWAN concentrator chip an additional LoRaWAN concentrator board is required. The seeed WM1302 mPCIe LoRaWAN concentrator board turned out to be perfectly suited for IOT2050. The installation and commissioning is very easy and straight forward.

### **Hardware installation**

To access the mPCIe connector, the housing of the IOT2050 must be opened: Open the two screws on the X30-COM connector. Then the housing can be opened via the two indentations.

![Hardware installation](docs/graphics/2-3-hardware-installation.png)

In the next step the WM1302 board needs to be attached on the mPCIe slot of the IOT2050:

![Hardware Installation](docs/graphics/2-1-hardware-installation.png)

Afterwards the bulkhead cable and the antenna can be attached.

![Hardware Installation](docs/graphics/2-2-hardware-installation.png)

### **Prepare the IOT2050**

Follow [SIMATIC_IOT2050_Setting_up.md](https://github.com/SIMATICmeetsLinux/IOT2050-SmartFarming-Application/blob/main/docs/SIMATIC_IOT2050_setting_up.md) for the following steps:

- Installing the SD-Card Example Image (in this example the image V1.2.1 was used)
- First commissioning of the SIMATIC IOT2050: Remote access with Putty SSH Connection
- Working internet connection on the IOT2050

### **Software installation and commissioning**

#### **Setup the The Things Network Account as LoRa server**

After these steps the IOT2050 is ready for first boot. A The Things Network (TTN) account is required for the next steps. Simply go to [https://www.thethingsnetwork.org/](https://www.thethingsnetwork.org/) and create a free (community) account:

|Nr.|Action|
|-|-|
|1.|Press "Sign Up" in the upper right corner.|
||![Registration TTN](docs/graphics/3-1-registration-TTN.png)|
|2.|Press "Get Started" under Community -> Individual.|
||![Registration TTN](docs/graphics/3-2-registration-TTN.png)|
|3.|Select the "Europe 1"-Cluster.|
||![Registration TTN](docs/graphics/3-3-registration-TTN.png)|
|4.|Press "Register".|
||![Registration TTN](docs/graphics/3-4-registration-TTN.png)|
|5.|Fill in username, email address and password and click "Create Account".|
||![Registration TTN](docs/graphics/3-5-registration-TTN.png)|
|6.|Go to your email inbox and activate the account via the email you received..|
||![Registration TTN](docs/graphics/3-6-registration-TTN.png)|
|7.|The registration is now complete.|

#### **Create gateway application**

After the initial setup has been finished and a TTN account has been created the WM1302 board can be set up. Make sure that the IOT2050 has an internet connection to allow installing required software packages and to be able to establish a connection to the TTN server. Open a ssh connection using putty and simply follow the getting started documentation from seeed starting at [step 3 (get and compile sx1302 code)](https://wiki.seeedstudio.com/WM1302_module/#step3-get-and-compile-sx1302-source-code).

NOTE: Make sure to use the global_conf.json.sx1250.EU868.USB file.

Gateway EUI: The Gateway EUI is a 64 bit extended unique identifier for your end device. You can put together the 16-digit combination of the numbers 0-9 and the letters A-F by yourself.

After following the instructions in step 3 and step 4 the gateway should appear in your TTN account:

![Overview Gateway](docs/graphics/4-1-overview-gateway.png)

### **Start the Application after Reboot**

The application has no autostart function by default and must therefore be restarted manually after rebooting the IOT2050:

cd ~
cd sx1302_hal/
cd packet_forwarder/
./lora_pkt_fwd -c global_conf.json.sx1250.EU868.USB

### **Autostart of the LoRa-Gateway**

The autostart of the gateway can be set up as follows: Use WINSCP to connect to the IOT2050. Go to the directory */root/sx1302_hal/packet_forwarder/*. Copy the ready-made shell script [start.sh](src/start.sh) into the directory:

![Autostart - Copy start.sh](docs/graphics/5-1-autostart-copy-startsh.png)

The script must then be provided with executable rights:

cd sx1302_hal/
cd packet_forwarder/
chmod 755 start.sh

Go to the directory */etc/systemd/system/*. Copy the ready-made shell script [iot2050-lora-gateway.service](src/iot2050-lora-gateway.service) into the directory:

![Autostart - Copy Service-File](docs/graphics/5-2-autostart-service-file.png)

The service file can now be started manually and tested with the following command:

cd /etc/systemd/system/
sudo systemctl start iot2050-lora-gateway.service

After successful start of the gateway (you can see if it's connected in The Things Network), it can be terminated with the following command:

sudo systemctl stop iot2050-lora-gateway.service

To enable the autostart of the service use the command:

sudo systemctl enable iot2050-lora-gateway.service

After the next reboot, the gateway will be started with every boot.

## **Contribution and Contribution License Agreement**

Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests. For more information please check the [Contribution License Agreement](docs/Siemens_CLA.pdf).

## **Licence and Legal Information**

Please read the [Legal information](LICENSE.md).
Binary file added docs/Siemens_CLA.pdf
Binary file not shown.
Binary file added docs/graphics/1-1-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/2-1-hardware-installation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/2-2-hardware-installation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/2-3-hardware-installation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/3-1-registration-TTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/3-2-registration-TTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/3-3-registration-TTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/3-4-registration-TTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/3-5-registration-TTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/3-6-registration-TTN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/4-1-overview-gateway.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/5-1-autostart-copy-startsh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/graphics/5-2-autostart-service-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/iot2050-lora-gateway.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=LoRa Gateway using WM1302 LoRaWAN Gateway Module (USB) - EU868
Wants=network-online.target
After=network-online.target

[Service]
WorkingDirectory=/root/sx1302_hal/packet_forwarder/
ExecStart=/root/sx1302_hal/packet_forwarder/start.sh
SyslogIdentifier=iot2050-gateway
Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions src/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
./lora_pkt_fwd -c global_conf.json.sx1250.EU868.USB

0 comments on commit a6a97b2

Please sign in to comment.