Categories

Archives

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

LoRa WAN

LoRaWAN is a protocol designed for creating large-scale public networks; the technology allows for sensors to talk to the internet without 3G or WiFi. Community crowdsourced projects, such as The Things Network, aim to provide access to this technology by deploying gateways globally that others can freely connect to.

The purpose of this Instructable is to provide a guide for people to create their own outdoor LoRaWAN Gateway using off-the-shelf components, rather than purchasing a commercial offering. Many of the components used in this Instructable, such as the coax cables, can be substituted for cheaper alternatives (from sites like Ebay); however, for the purpose of this guide I tried to keep the number of suppliers to a minimum.Add TipAsk QuestionCommentDownload

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.Add Teacher Note

Step 1: Quick Overview of the Files:

Bom Part 1.csv – A list of parts sourced from Farnell.

Bom Part 2.csv – Other required parts sourced from places like Amazon.

Bracket.dxf – Template for the rear bracket. This is cut from a sheet of steel and will require a shear & bender.

Internal Plate.dxf – Internal plate for mounting the Raspberry Pi, this requires a lasercutter.

Hole Template.dxf – Template to help mark out the positioning of the bulkhead connectors.

Attachments

Add TipAsk QuestionCommentDownload

Step 2: Required Tools & Machines

  • Screwdriver (phillips)
  • Allen Keys
  • Drill
  • 12, 10, 8, 4mm drillbits
  • 22mm Hole Saw
  • M12 Tap & Holder
  • File / Deburring Tool
  • Fine Tooth Jigsaw / Rotary Multitool with small angle grinding attachment
  • RJ45 Crimping Tool, Connectors, Boots and Cable (a RJ45 cable tester is also handy!)
  • Sheet Metal Bender & Shear
  • Lasercutter (for producing the internal adapter plate)
  • A3 Printer (for printing templates 1:1)

Add TipAsk QuestionCommentDownload

Step 3: Bottom Holes in the Enclosure

Picture of Bottom Holes in the Enclosure
Picture of Bottom Holes in the Enclosure

Print or lasercut “hole template.dxf”. This template is used to help mark out the location of the bottom holes for the enclosure. Place the template against the top edge of one of the enclosure recesses, so that the holes are situated near the top of the enclosure. Now drill out these holes using the M12 (center hole) and M8 (side holes) drill bits. Use a file / deburring tool to clean up the holes.Add TipAsk QuestionCommentDownload

Step 4: Side Hole for Pressure Compensated Valve

Picture of Side Hole for Pressure Compensated Valve

Using the M10 drill bit, make a hole on one of the long-sides of the enclosure; this hole should be made near the top of the enclosure. Thread this hole using a M12 tap.Add TipAsk QuestionCommentDownload

Step 5: Install the First Set of Connectors

Picture of Install the First Set of Connectors

Install the nylon cable gland and the two SMA bulkhead connectors. The SMA bulkhead connectors should be installed, so that the small rubber o-ring’s are within the inside of the enclosure. If necessary, use a small file to enlarge the holes to size as ideally they should be a tight fit. Leave the pressure compensation valve uninstalled for now.Add TipAsk QuestionCommentDownload

Step 6: Install SMA Coax Cables

Picture of Install SMA Coax Cables

Install and tighten the two short SMA coax cables on the internal facing side of the SMA bulkhead connectors.Add TipAsk QuestionCommentDownload

Step 7: Lasercut the Acrylic and Install M2.5 Standoffs

Picture of Lasercut the Acrylic and Install M2.5 Standoffs

Using “Internal Plate .dxf”, lasercut the 6mm thick sheet of acrylic to create the internal adapter plate. Now install the M2.5 standoffs and lock them in place with the M2.5 nyloc nuts. If you are using standard nuts (rather than nyloc), a little bit of locktite is required. The rectangular cut-out should be on the left-hand side of the internal adapter piece.Add TipAsk QuestionCommentDownload

Step 8: Attach Raspberry PI 3 to the Internal Adapter Plate

Picture of Attach Raspberry PI 3 to the Internal Adapter Plate

It is easier to image and configure the Raspberry Pi now (step 21) prior to attaching it to the internal adapter plate. Once the Pi is set up, attach it to the standoffs and secure the Pi in place with the M2.5 screws. The Pi’s USB ports should face upwards and the HDMI port face away from the rectangular cut out, as shown in the picture. Once the Raspberry Pi is in place, connect the Linklabs shield to the Pi (its SMA connectors should face the HDMI side of the Raspberry Pi).Add TipAsk QuestionCommentDownload

Step 9: Install the Internal Adapter Plate

Picture of Install the Internal Adapter Plate

The internal adapter plate can now be installed into the enclosure. Secure it in place with the four M3 screws. If you wish you may tap the standoffs first, but I found the plastic soft enough to self-tap.Add TipAsk QuestionCommentDownload

Step 10: Install the Pressure Compensation Valve

Picture of Install the Pressure Compensation Valve

The pressure compensation valve can now be installed in the remaining hole that we made earlier.Add TipAsk QuestionCommentDownload

Step 11: Connect the Internal Coax Cables

Picture of Connect the Internal Coax Cables

The coax cables can now be connected to the Linklabs board. The GPS SMA connector should use the coax that runs to the left hand side bulkhead connector and the 868MHz SMA connector should run to the one on the right.Add TipAsk QuestionCommentDownload

Step 12: Prepare the Wall Bracket

Picture of Prepare the Wall Bracket

Print off “Bracket.dxf” onto a sheet of A3 paper at 1:1 scale. Cut out this template and glue it (with prit stick) to the sheet of stainless steel. Use this as a guide to cut out all of the required holes:

  • Use the 22mm hole drill for the largest hole
  • Use a M4 drill bit for the four smaller holes and the top (optional) wall bracket holes
  • Use a M8 drill for the remaining holes
  • Cut out the remaining bit of metal to make the wall connector holes (use a rotary multi-tool / fine tooth jigsaw) — this is optional based on your own needs
  • De-burr all of the holes

Use a shear to cut the sheet of steel to size and break the edge with a file (you should probably round off the corners too). Finally (once all the holes have been made!) use a former to make a 90degree bend in the metal. This bend should be placed between the top two holes (for the antennas) and the ‘wall holes’ – you can use the enclosure to help work out where to place this bend, keep in mind you need clearance for the antenna connectors!

Useful Note: We adapt the back of the “wall bracket” depending on what we wish to mount it too. For example we use metal pole clips to allow us to secure them to a pole mounted on a tripod for portable testing.Add TipAsk QuestionCommentDownload

Step 13: Secure the Wall Bracket to the Enclosure

Picture of Secure the Wall Bracket to the Enclosure

Secure the wall bracket to the back of the enclosure. You will need M4 bolts for this; again secure them in place with nyloc nuts / loctite.Add TipAsk QuestionCommentDownload

Step 14: Install the GPS Antenna

Picture of Install the GPS Antenna
Picture of Install the GPS Antenna
Picture of Install the GPS Antenna

Install the GPS antenna into the largest top hole and tighten the two nuts. Now install the 90′ TNC connector and finally the TNC to SMA connector. The SMA connector should face towards the direction of the second antenna hole.Add TipAsk QuestionCommentDownload

Step 15: Install the Bulkhead Jack SMA Cable

Picture of Install the Bulkhead Jack SMA Cable

Install the bulkhead jack SMA cable into the remaining antenna hole. You will need two M6 washers on either side of the metal bracket to help secure the connector; tighten the brass nut to lock everything in place.Add TipAsk QuestionCommentDownload

Step 16: Route the Coax Cables

Picture of Route the Coax Cables

Route both SMA coax cables and attach them to the bottom SMA bulkhead connectors; the coax for the GPS should run to the bulkhead on the left hand side of the enclosure and the coax for the 868MHz antenna should run to the bulkhead on the right hand side.Add TipAsk QuestionCommentDownload

Step 17: Install the Rubber Duck Antenna

Picture of Install the Rubber Duck Antenna

Install the 868MHz rubber duck antenna; this antenna should get you started and it is discrete.

You can replace it with a larger antenna, for example a Procom CXL900-3/L NType 824-894MHz collinear antenna; however antenna location (is it worth installing more shorter range gateway units vs a few larger ones?), suitable mounting brackets and local regulations should be considered before doing so.Add TipAsk QuestionCommentDownload

Step 18: Install the Enclosure Clips and Lid

Picture of Install the Enclosure Clips and Lid
Picture of Install the Enclosure Clips and Lid

Clip in place the two enclosure clips and attach the lid to one of them (We prefer the bottom one nearest the enclosure bulkhead connectors).Add TipAsk QuestionCommentDownload

Step 19: Crimp RJ45 Cable and Install POE Splitter

Picture of Crimp RJ45 Cable and Install POE Splitter

Run a suitable length of RJ45 cable through the cable gland and crimp the cable internally. Install the POE splitter (a bit of double-sided foam tape and help secure it) and connect the RJ45 cable to it. The splitter’s power and network connectors should run to the respective receptacles on the Raspberry Pi – be warned the power cable is a very tight fit!

Note: We have run these gateways with an Anker Astro E1 5200mAh battery placed where the POE splitter fits and have had the Raspberry Pi 3’s wireless connecting to a 3G/LTE hotspot (or old Android phone); this is useful if you wish to try out different places for siting the gateway before going to the hassle of installing it.Add TipAsk QuestionCommentDownload

Step 20: Hardware Complete

Picture of Hardware Complete

Finally your hardware is ready!Add TipAsk QuestionCommentDownload

Step 21: Software

Picture of Software

We recommended using Raspbian Jessie Lite as the operating system for the Raspberry Pi. The packages linked to here will set up an installation meant for The Things Network backend (protocol version 2). If you require protocol version three (which currently isn’t compatible with the Things Network), you will need to build the latest Gateway and Packet Forwarder binaries (https://github.com/Lora-net/).

  1. Download Raspbian Jessie Lite and flash the image to a SD card.
  2. Edit “config.txt” located in the boot partition and append the following:
# Enable SPI interface
dtparam=spi=on

# Enable GPS PPS

dtoverlay=pps-gpio,gpiopin=4

#Disable Bluetooth on pi 3

dtoverlay=pi3-miniuart-bt

3. Edit “cmdline.txt”; the contents of the file should currently look something like this:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait 

Remove all references to ttyAMA0. The file will now look something like this:

 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

4. Start / Reboot the Raspberry Pi. On first boot Raspbian will expand the root filesystem to the size of your SD card.

5. If you wish to use the .deb package that we have created to install the required binaries & services for the gateway then follow the next set of steps; otherwise now is the time to go and build from source. It can be useful to temporarily use a “root” privileged shell for the next set of steps:

sudo -s

6. Now create a file “/etc/apt/sources.list.d/lorawan.list” and append the following:

deb http://shed.kent.ac.uk/repos/apt/debian jessie main

7. You also need to get the repo keys:

 wget -O - https://shed.kent.ac.uk/repos/apt/conf/shed.gpg.key | apt-key add -

8. Now run this command:

apt-get install apt-transport-https ; apt-get update

9. Once the repositories have finished updating (hopefully without error), install the following packages:

apt-get install linklabslorawangateway pps-tools

10. If everything went without a hitch you will now have a gateway setup. The installation of the package “linklabslorawangateway” should set up files in “/opt/linklabs” and “/lib/systemd/system”. As part of the installation it will use your Pi’s mac address for the gateway’s ID; this can be overridden in the file “/opt/linklabs/config/local_conf.json”. Whilst not configured in this guide, pps-tools allows you (with an update to NTP) to use the GPS second pulse to keep a more accurate record of time on your gateway.

11. To connect to the Things Network you will want to modify “/opt/linklabs/config/global_conf.json”. Scroll down to the line:

"server_address": "shed.kent.ac.uk"

And for Europe change it too:

"server_address": "router.eu.thethings.network"

12. Reboot the Raspberry Pi and you should be good to go.

Useful Notes:

  1. The systemd linklabs.service calls the scripts “start.sh” and “stop.sh” located in the “/opt/linklabs/bin/” directory. It can be useful to modify these scripts for your specific needs.
  2. The Things Network guide recommends modifying “local_conf.json” for gateway specific settings; in our case we keep server settings in “global_conf.json” and only use “local_conf.json” for the Gateway ID – this is because we remotely manage our gateways from a configuration management tool called Salt Stack; you may wish to adjust these files to match the Things Network’s recommendations.
  3. Because the GPS unit is utilised by the packet_fowarder program, it will be unavailable for use by other services; such as NTP (however the time pulse is accessible) – you will still need to set coarse time from a network NTP server.

ที่มา: https://www.instructables.com/id/LoRaWAN-Gateway/

Comments are closed.