-
Notifications
You must be signed in to change notification settings - Fork 210
Home
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.
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 concentrator board | EUR 189.- (excl. tax) | IMST Webshop |
Pigtail for antenna | EUR 6.5 (excl. tax) | IMST Webshop |
Raspberry Pi 1 | EUR 32.- | RPi2: Farnell and RPi3: Farnell |
Antenna 2 | 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 | |
Dual female Jumper Wires 3 | ||
WiFi dongle 4 |
[1] It should work with RPI 3, RPi 2 B, RPi B+ and even RPi Zero; but avoid the original revisions because the polyfuse might cause problems. Right now, the RPi 3 is selling on Farnell for the same price as the 2, so just get a RPi 3 and you don't need a separate WiFi dongle.
[2] The choice of antenna is huge, pick any of your liking, as long as it is 1/2 wavelength and has 3dBi or higher.
[3] 2x short ones (10cm) for power/ground; 5x long ones (20cm) for SPI
[4] 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:
- IP67 Enclosure (we got ours from decentlab.com)
- Mounting plate, screws and spacers
Now sit and wait for the postman to make you happy.
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:
- Download Raspbian Jessie Lite
- Follow the installation instructions to create the SD card
Some things won't be easily accessible once we mount the boards, so better connect them before hand:
- Install the SD card in the RPi
- Connect the WiFi dongle to RPi
- Connect ethernet cable to RPi
- Connect the pigtail to iC880a
The stage is set! We can start mounting our gateway:
- Drill the mount holes for both boards on the mounting plate
- Mount both boards on the mounting plate (add spacers between board and mounting plate for ventilation)
- Mount the mounting plate in the enclosure
- Install the antenna (WARNING: never power up without the antenna!)
- Connect the jumper wires between the two boards using the following table:
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 |
We're now ready to power up and start configuring our gateway!
-
Plug the power supply of the RPi which will also power the concentrator board
-
From a computer in the same LAN,
ssh
into the RPi using the default hostname:local $ ssh [email protected]
-
Use
raspi-config
utility to enable SPI (9 Advanced options -> A6 SPI
) and also expand the filesystem (1 Expand filesystem
):$ sudo raspi-config
-
Reboot
-
Configure locales and time zone:
$ sudo dpkg-reconfigure locales $ sudo dpkg-reconfigure tzdata
-
Make sure you have an updated installation and install
git
:$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install git
-
Create new user for TTN and add it to sudoers
$ sudo adduser ttn $ sudo adduser ttn sudo
-
To prevent the system asking root password regularly, add TTN user in sudoers file
$ sudo visudo
Add the line ttn ALL=(ALL) NOPASSWD: ALL
-
Logout and login as
ttn
and remove the defaultpi
user$ sudo userdel -rf pi
-
Configure the wifi credentials (check here for additional details)
$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
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"
}
-
Clone the installer and start the installation
$ git clone https://github.com/ttn-zh/ic880a-gateway.git ~/ic880a-gateway $ cd ~/ic880a-gateway $ sudo ./install.sh spi
-
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 Gateway Remote Config repository. -
Unplug the Ethernet cable and close the enclosure
-
Big Success! You should now have a running gateway in front of you!
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.
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!