Qgelm

ttn-zh/ic880a-gateway

Originalartikel

Backup

<html> <p>So you want to extend the coverage of <a href=„http://thethingsnetwork.org“ rel=„nofollow“>The Things Network</a> in your neighborhood but missed the kickstarter to buy a gateway?</p><p><em>Worry not!</em> It's really easy to build one yourself that is on par with most other gateways when it comes to specs, but is significantly cheaper.</p> <h2>Ordering the parts</h2> <p>Our gateway will be based on the <a href=„http://www.wireless-solutions.de/products/radiomodules/ic880a“ rel=„nofollow“>IMST iC880a board</a>. This is the most important piece, the rest are components you might even have already lying around.</p> <p>Here's our shopping list:</p> <table><thead><tr><th>Part</th> <th>Price</th> <th>Order/link</th> </tr></thead><tbody><tr><td>iC880A-SPI concentrator board</td> <td>EUR 119.- (excl. tax)</td> <td><a href=„http://shop.imst.de/wireless-modules/lora-products/8/ic880a-spi-lorawan-concentrator-868-mhz“ rel=„nofollow“>IMST Webshop</a></td> </tr><tr><td>Pigtail for antenna 1</td> <td>EUR 6.5 (excl. tax)</td> <td><a href=„http://webshop.imst.de/pigtail-for-ic880a-spi-and-ic880a-usb.html“ rel=„nofollow“>IMST Webshop</a></td> </tr><tr><td>Raspberry Pi 2</td> <td>EUR 32.-</td> <td>RPi2: <a href=„http://de.farnell.com/raspberry-pi/rpi2-modb-v1-2/sbc-raspberry-pi-2-model-b-v1/dp/2612474“ rel=„nofollow“>Farnell</a> and RPi3: <a href=„http://de.farnell.com/raspberry-pi/raspberrypi-modb-1gb/raspberry-pi-3-model-b/dp/2525225“ rel=„nofollow“>Farnell</a></td> </tr><tr><td>Antenna 3</td> <td>EUR 3.50 - EUR 8</td> <td>3dBi: <a href=„http://de.farnell.com/rf-solutions/ant-8whip3h-sma/ant-868mhz-peitsche-gelenk-sma/dp/2305899“ rel=„nofollow“>Farnell</a>, 5dBi: <a href=„http://www.aliexpress.com/item/Free-shipping-customized-best-performance-High-Gain-5dBi-GSM-868mhz-900-1800mhz-magnetic-base-antenna/32592017287.html“ rel=„nofollow“>Aliexpress</a>, 7dBi: <a href=„http://www.aliexpress.com/store/product/868MHZ-915MHZ-GSM-3G-antenna-small-sucker-7dbi-aerial-3meters-SMA-male-2/1859567_32512220307.html“ rel=„nofollow“>Aliexpress</a>, 7.5dBi <a href=„http://www.aliexpress.com/item/868MHz-Antenna-7-5dBi-Gain/1870152812.html“ rel=„nofollow“>Aliexpress</a></td> </tr><tr><td>Power Supply 2A with micro USB</td> <td>EUR 7.84</td> <td><a href=„http://de.farnell.com/stontronics/t5454dv/netzteil-raspberry-pi-5v-2a-micro/dp/2427498“ rel=„nofollow“>Farnell</a></td> </tr><tr><td>MicroSD Card (4Gb or more)</td> <td>~ EUR 8</td> <td/> </tr><tr><td>RPi to iC880a interface</td> <td>~ EUR 5-40</td> <td>Four options: <ul><li>simple backplane: <a href=„https://www.tindie.com/products/gnz/imst-ic880a-lorawan-backplane/“ rel=„nofollow“>Tindie</a></li> <li>ch2i backplane: <a href=„https://pcbs.io/share/zvoQ4“ rel=„nofollow“>pcbs.io</a></li> <li>coredump.ch backplane: <a href=„https://shop.coredump.ch/product/ic880a-lorawan-gateway-backplane-prototype/“ rel=„nofollow“>coredump.ch</a></li> <li>7x Dual female jumper wires 4</li> </ul></td> </tr><tr><td>WiFi dongle 5</td> <td/> <td/> </tr></tbody></table><p>[1] Normally, the <a href=„http://webshop.imst.de/pigtail-for-ic880a-spi-and-ic880a-usb.html“ rel=„nofollow“>pigtail</a> is SMA, but on some orders IMST shipped one with a <a href=„https://en.wikipedia.org/wiki/SMA_connector#Reverse_polarity_SMA“ rel=„nofollow“>RP-SMA Female connector</a>. Since the linked antennas are SMA Male, you need an <a href=„http://www.aliexpress.com/item/Brass-Adapter-RP-SMA-Male-Jack-To-SMA-Female-Jack-Screw-Thread-Connector-90-Degrees-Right/32637688405.html“ rel=„nofollow“>RP-SMA Male to SMA Female adapter</a> in this case.</p> <p>[2] It works with RPI 3, RPi 2 B, RPi B+ and even RPi Zero; but avoid the original revisions because the polyfuse might cause problems.</p> <p>[3] The choice of antenna is huge, pick any of your liking, as long as it is 1/2 wavelength and has 3dBi or higher.</p> <p>[4] Using any of the backplane boards listed instead of jumper wires is <strong>strongly</strong> recommended. Jumper wires can cause interference, and even thou the software will handle it, the performance of your gateway will be sub-optimal.</p> <p>[5] e.g. Edimax EW-7811UN. Only required if you connect via WiFi instead of Ethernet and not using the Raspberry Pi 3, which already comes with built in WiFi. The alternative is to power the device via the Ethernet cable using a PoE splitter/injector.</p> <p>That will get you a functional gateway, but you most likely want to have it in a box. There are plenty of options, here's just one suggestion:</p> <ul><li>IP67 Enclosure (we got ours from <a href=„http://www.decentlab.com/“ rel=„nofollow“>decentlab.com</a>. you have to send an email to them to shop it. The Enclosure is not on the products page. Price is 85CHF + shipping 40CHF)</li> <li>Mounting plate, screws and spacers</li> </ul><p>Now sit and wait for the postman to make you happy.</p> <h2>Choosing the backhaul</h2> <p>What is a <strong>backhaul</strong>? Backhaul refers to how the Raspberry Pi will be connected to the Internet.</p> <p>This guide focuses on using Wifi as backhaul, but you could also use Ethernet or 3G/4G.</p> <p>If you do have Ethernet available near the gateway, then prefer it over WiFi or 3G/4G. This is because having an additional radio signal inside the enclosure will cause noise. The software can handle the noisy environment, so it's not a big issue, but the less noisy, the better. You can combine this choice with Power-over-Ethernet to minimize the cabling going all the way up to the gateway.</p> <p>On the other hand, if you choose WiFi instead of Ethernet, then try to use a dongle with external antenna and move the antenna outside the enclosure to have less noise inside the box.</p> <h2>Putting it all together</h2> <p>And now comes the fun part!</p> <p>First, let's prepare the SD card so that we can insert it on the RPi and be ready to boot:</p> <ul><li>Download <a href=„https://www.raspberrypi.org/downloads/“ rel=„nofollow“>Raspbian Stretch Lite</a></li> <li>Follow the <a href=„https://www.raspberrypi.org/documentation/installation/installing-images/README.md“ rel=„nofollow“>installation instructions</a> to create the SD card</li> <li>Create a new empty file named

ssh

(without extension) onto the

boot

partition of the SD card. This enables ssh on the RPi upon startup.</li> </ul><p>Some things won't be easily accessible once we mount the boards, so better connect them before hand:</p> <ul><li>Install the SD card in the RPi</li> <li>Connect the WiFi dongle to RPi</li> <li>Connect ethernet cable to RPi</li> <li>Connect the pigtail to iC880a</li> </ul><p>The stage is set! We can start mounting our gateway:</p> <ul><li>Drill the mount holes for both boards on the mounting plate</li> <li>Mount both boards on the mounting plate (add spacers between board and mounting plate for ventilation)</li> <li>Mount the mounting plate in the enclosure</li> <li>Install the antenna (<strong>WARNING</strong>: never power up without the antenna!)</li> <li>Connect the jumper wires between the two boards using the following table:</li> </ul><table><thead><tr><th>iC880a pin</th> <th>Description</th> <th>RPi physical pin</th> </tr></thead><tbody><tr><td>21</td> <td>Supply 5V</td> <td>2</td> </tr><tr><td>22</td> <td>GND</td> <td>6</td> </tr><tr><td>13</td> <td>Reset</td> <td>22</td> </tr><tr><td>14</td> <td>SPI CLK</td> <td>23</td> </tr><tr><td>15</td> <td>MISO</td> <td>21</td> </tr><tr><td>16</td> <td>MOSI</td> <td>19</td> </tr><tr><td>17</td> <td>NSS</td> <td>24</td> </tr></tbody></table><p><img src=„https://github.com/ttn-zh/ic880a-gateway/raw/spi/images/pinout.jpg“ alt=„Pinout“/><img src=„https://github.com/ttn-zh/ic880a-gateway/raw/spi/images/mounted-boards.jpg“ alt=„Mounted boards“/></p> <p>We're now ready to power up and start configuring our gateway!</p> <h2>Setting up the software</h2> <ul><li> <p>Plug the power supply of the RPi which will also power the concentrator board</p> </li> <li> <p>From a computer in the same LAN,

ssh

into the RPi using the default hostname:</p> <pre> local $ ssh pi@raspberrypi.local

</pre></li> <li> <p>Default password of a plain-vanilla RASPBIAN install for user

pi

is

raspberry

.</p> </li> <li> <p>Use

raspi-config

utility to <strong>enable SPI</strong> (

[5] Interfacing options -&gt; P4 SPI

) and also expand the filesystem (

[7] Advanced options -&gt; A1 Expand filesystem

):</p> <pre> $ sudo raspi-config

</pre></li> <li> <p>Reboot (it will ask on exit, but you can do it manually with

sudo reboot

)</p> </li> <li> <p>Configure locales and time zone:</p> <pre> $ sudo dpkg-reconfigure locales

$ sudo dpkg-reconfigure tzdata

</pre></li> <li> <p>Make sure you have an updated installation and install

git

:</p> <pre> $ sudo apt-get update

$ sudo apt-get upgrade
$ sudo apt-get install git

</pre></li> <li> <p>Create new user for TTN and add it to sudoers</p> <pre> $ sudo adduser ttn

$ sudo adduser ttn sudo

</pre></li> <li> <p>To prevent the system asking root password regularly, add TTN user in sudoers file</p> <pre> $ sudo visudo

</pre></li> </ul><p>Add the line

ttn ALL=(ALL) NOPASSWD: ALL

</p> <p><img class=„emoji“ title=„:warning:“ alt=„:warning:“ src=„https://camo.githubusercontent.com/1473ed5a16261e9d28ea0f8cf6e81e506da8623e/68747470733a2f2f6173736574732d63646e2e6769746875622e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323661302e706e67“ height=„20“ width=„20“ align=„absmiddle“ data-canonical-src=„https://assets-cdn.github.com/images/icons/emoji/unicode/26a0.png“/> Beware this allows a connected console with the ttn user to issue any commands on your system, without any password control. This step is completely optional and remains your decision.</p> <ul><li> <p>Logout and login as

ttn

and remove the default

pi

user</p> <pre> $ sudo userdel -rf pi

</pre></li> <li> <p>Configure the wifi credentials (check <a href=„https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md“ rel=„nofollow“>here for additional details</a>)</p> <pre> $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

</pre></li> </ul><p>And add the following block at the end of the file, replacing SSID and password to match your network:</p> <pre> network={

          ssid="The_SSID_of_your_wifi"
          psk="Your_wifi_password"
      }

</pre> <ul><li> <p>Clone <a href=„https://github.com/ttn-zh/ic880a-gateway/tree/spi“>the installer</a> and start the installation</p> <pre> $ git clone -b spi https://github.com/ttn-zh/ic880a-gateway.git ~/ic880a-gateway

$ cd ~/ic880a-gateway
$ sudo ./install.sh spi

</pre></li> <li> <p>If you want to use the remote configuration option, please make sure you have created a JSON file named as your gateway EUI (e.g.

B827EBFFFE7B80CD.json

) in the <a href=„https://github.com/ttn-zh/gateway-remote-config“>Gateway Remote Config repository</a>.</p> </li> <li> <p>By default, the installer changes the hostname of your Raspeberry Pi to

ttn-gateway

(to prevent collisions with other Raspberry Pis in your network). You can override this in non-remote configuration mode.</p> </li> <li> <p>Unplug the Ethernet cable and close the enclosure</p> </li> <li> <p><strong>Big Success!</strong> You should now have a running gateway in front of you!</p> </li> </ul><p><img src=„https://github.com/ttn-zh/ic880a-gateway/raw/spi/images/gateway.jpg“ alt=„Gateway ready“/></p> <h2>Checking connection to TTN</h2> <p>The best way to check if the gateway is working is registering it on the TTN Console.</p> <ul><li>Login to thethingsnetwork.org

Console

</li> <li>Click on

Gateways -&gt; register gateway

</li> <li>Enable checkbox

I'm using the legacy packet forwarder

</li> <li>Enter your Gateway EUI (if is printed on start and end of the installer)</li> <li>Enter any description</li> <li>Select

Europe 868Mhz

as frequency plan</li> <li>Select the correct antenna placement according to your plans</li> <li>Confirm clicking

Register gateway

</li> </ul><p>Now you can see the status (which at this point should be

connected

if we did everything right) and traffic of your gateway!</p> <h2>Wrapping up</h2> <p>Depending on the kind of enclosure you selected, you might still need to do one more thing: put the power cable through the weather-proof cable holes.</p> <p>For this purpose, we will cut the micro USB end of the power supply, pass it through the hole, solder the wires to jumper wires, and finally connect 5v and GND to the Raspberry Pi:</p> <table><thead><tr><th>Micro USB</th> <th>RPi physical pin</th> </tr></thead><tbody><tr><td>Supply 5V</td> <td>4</td> </tr><tr><td>GND</td> <td>9</td> </tr></tbody></table><p>In the following image, I used a tiny, generic breakout board with pin header to connect the wires. That is not really required, it's only to keep the cabling neatly arranged inside the box.</p> <p><img src=„https://github.com/ttn-zh/ic880a-gateway/raw/spi/images/power-via-gpio.jpg“ alt=„Gateway powered via RPi GPIOs“/></p> <p>And now we're really done!</p> <p><strong>Here's our final product!</strong> <img src=„https://github.com/ttn-zh/ic880a-gateway/raw/spi/images/closed-gateway.jpg“/></p> <p>Now go install the gateway in a nice location to give your neighborhood the joy of IoT!</p> </html>

Cookies helfen bei der Bereitstellung von Inhalten. Diese Website verwendet Cookies. Mit der Nutzung der Website erklären Sie sich damit einverstanden, dass Cookies auf Ihrem Computer gespeichert werden. Außerdem bestätigen Sie, dass Sie unsere Datenschutzerklärung gelesen und verstanden haben. Wenn Sie nicht einverstanden sind, verlassen Sie die Website.Weitere Information