===== ttn-zh/ic880a-gateway ===== [[https://github.com/ttn-zh/ic880a-gateway/wiki|Originalartikel]] [[https://www.qgelm.de/wb2html/wb368.html|Backup]]

So you want to extend the coverage of The Things Network in your neighborhood but missed the kickstarter to buy a gateway?

Worry not! 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.

Ordering the parts

Our gateway will be based on the IMST iC880a board. This is the most important piece, the rest are components you might even have already lying around.

Here's our shopping list:

Part Price Order/link
iC880A-SPI concentrator board EUR 119.- (excl. tax) IMST Webshop
Pigtail for antenna 1 EUR 6.5 (excl. tax) IMST Webshop
Raspberry Pi 2 EUR 32.- RPi2: Farnell and RPi3: Farnell
Antenna 3 EUR 3.50 - EUR 8 3dBi: Farnell, 5dBi: Aliexpress, 7dBi: Aliexpress, 7.5dBi Aliexpress
Power Supply 2A with micro USB EUR 7.84 Farnell
MicroSD Card (4Gb or more) ~ EUR 8
RPi to iC880a interface ~ EUR 5-40 Four options:
WiFi dongle 5

[1] Normally, the pigtail is SMA, but on some orders IMST shipped one with a RP-SMA Female connector. Since the linked antennas are SMA Male, you need an RP-SMA Male to SMA Female adapter in this case.

[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.

[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.

[4] Using any of the backplane boards listed instead of jumper wires is strongly recommended. Jumper wires can cause interference, and even thou the software will handle it, the performance of your gateway will be sub-optimal.

[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.

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:

Now sit and wait for the postman to make you happy.

Choosing the backhaul

What is a backhaul? Backhaul refers to how the Raspberry Pi will be connected to the Internet.

This guide focuses on using Wifi as backhaul, but you could also use Ethernet or 3G/4G.

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.

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.

Putting it all together

And now comes the fun part!

First, let's prepare the SD card so that we can insert it on the RPi and be ready to boot:

Some things won't be easily accessible once we mount the boards, so better connect them before hand:

The stage is set! We can start mounting our gateway:

iC880a pin Description RPi physical pin
21 Supply 5V 2
22 GND 6
13 Reset 22
14 SPI CLK 23
15 MISO 21
16 MOSI 19
17 NSS 24

PinoutMounted boards

We're now ready to power up and start configuring our gateway!

Setting up the software

Add the line ttn ALL=(ALL) NOPASSWD: ALL

:warning: 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.

And add the following block at the end of the file, replacing SSID and password to match your network:

     network={
            ssid="The_SSID_of_your_wifi"
            psk="Your_wifi_password"
        }

Gateway ready

Checking connection to TTN

The best way to check if the gateway is working is registering it on the TTN Console.

Now you can see the status (which at this point should be connected if we did everything right) and traffic of your gateway!

Wrapping up

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.

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:

Micro USB RPi physical pin
Supply 5V 4
GND 9

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.

Gateway powered via RPi GPIOs

And now we're really done!

Here's our final product!

Now go install the gateway in a nice location to give your neighborhood the joy of IoT!