Introduction: MuMo - LoRa Gateway

### UPDATE 10-03-2021 // the latest information / updates will be available on the github page:

https://github.com/MoMu-Antwerp/MuMo

What is MuMo?

MuMo is a collaboration between product development (a department of the University of Antwerp) under the name of Antwerp Design Factory and the Antwerp Fashion Museum.

The goal of the project is to build an open source IOT monitor system based on a LoRa network.

  • It should be easy to set up.
  • It should be easy to assemble.
  • It must be scalable in terms of application area.

What the project MuMo contains:

MuMo Node

The MuMo Node is a low power device on AA batteries that can measure and transmit environmental parameters over a LoRa network. The parameters are temperature, humidity, ambient pressure and brightness.

*** The MuMo node can be extended with other functionalities to be used in other applications.***

MuMo Gatway

The MuMo Gateway is an active LoRa gateway that can receive and forward LoRa signals from the Node device over the internet. In this project the gateway will also be equipped with the same sensors of the MuMo Node device, air dust sensor and an bug trap that can be remotely monitored with a camera.

*** The gateway does not need to be equipped with sensors or a camera. It can also only serve to provide a LoRa network (non measuring gateway).***

MuMo Dashboard

The MuMo Dashboard is provided to create an overview web application of the network that is being created. It is made user-friendly with different functionalities. The dashboard can be fully customized to the wishes and application of the user.

Github page:

https://github.com/MoMu-Antwerp/MuMo

Linked Instructable pages:

MuMo_Node: https://www.instructables.com/MuMo-Node/

MuMo_Gateway: https://www.instructables.com/MuMo-LoRa-Gateway/


Required Tools:

  • 3D printer with filament
  • Solder iron / solder
  • Small cutting plier
  • Hot glue gun (or other fixation tools)
  • Small screwdriver

Step 1: #Hardware - Ordering Parts

Parts to order:

See the github page for a recent overview:

https://github.com/MoMu-Antwerp/MuMo/blob/master/Shopping_list.md

Step 2: #Hardware - 3D Printed Parts

Parts to 3D print:

  1. Gateway
    • GATEWAY_Main_Housing
    • GATEWAY_Backcover
  2. Sensor_extension
    • Sensor_Housing
    • Sensor_Backcover
  3. Camera_extension
    • Camera_Housing
    • Camera_Backcover
  4. Trap_extension

the github page for the latest STL files:

https://github.com/jokohoko/Mumo/tree/main/STL_GATEWAY

Print filament:

PETG (preferred and more durable)

PLA

General print settings:

  • No support needed
  • Infill not necessary
  • 0.2 layer height
  • 3 outside perimeters (for strength and durability)

Step 3: #Software - Prepare SD Card Raspberry Pi

Parts:

  • Raspberry Pi
  • Micro SD card.

Instructions:

  1. Make sure the SD card is flashed and that the right raspberry operation system (Raspberry Pi OS(32-bit) with desktop) image is installed on to the micro SD card. Follow the link below to find the right instructions to flash and prepare your micro SD card.
  2. Insert your micro SD card into the Raspberry Pi.

Link:

https://www.raspberrypi.org/documentation/installation/installing-images/

Step 4: #Hardware - Prepare the Air Dust Sensor (optional)

Parts:

  • seeed air dust sensor
  • 2 x resistor (3.3 KΩ)
  • Grove hat board
  • 2 x shrink sleeves

Instructions:

  1. Cut the red wire up to the connector.
  2. Cut the yellow wire at a distance of 3 cm from the connector.
  3. Cut the black wire at a distance of 2 cm from the connector.
  4. Strip the end of each wire.
  5. Put a small shrink sleeve over the yellow cable.
  6. Put a large shrink sleeve over the yellow and black cable.
  7. Solder the two resistors in series with the yellow cable of the connector in between.
  8. Solder the other yellow cable on the side of the sensor to one of the resistors.
  9. Slide the small sleeve over the solder connection of the yellow wire with one resistor end still exposed and heat shrink the small sleeve.
  10. Solder the black wires back together with the still exposed resistance end in between.
  11. Slide the large sleeve over the solder connection and the small sleeve and heat shrink the large sleeve.
  12. Solder the red cable to the 5V pins (pin 2 and 4) on the Grove hat board (see the top view picture).

Step 5: #Hardware - Mounting the Spacers (optional)

Parts:

  • Grove hat board
  • Seeed air dust sensor
  • 4 x female-male spacers
  • 4 x female-female spacers
  • 4 x nut

Instructions:

  1. Mount the female-male spacers through the mounting holes of the grove hat board
  2. Screw the nuts on the female-male spacers and tighten it. (to provide extra space for the cables to bend)
  3. Screw the female-female spacers on top of the nuts and tighten everything.
  4. Lay the red 5V cable of the airdust sensor along the inside of the spacer (see last picture).

Step 6: #Hardware - Connecting Camera Cable / Dust Sensor / I2C (optional)

Parts:

  • The assembly stack from step 6

  • Raspberry PiModel 3 B+
  • Camera cable
  • 2 x grove connection cables
  • 1 x Long M2.5 screw

Instructions:

Camera cable:

  1. Lift the latch of the cable connecter on the Raspberry Pi (see picture one - red rectangle). Be careful, fragile!
  2. Insert the camera cable in the connector of the Raspberry Pi with the blue side facing the usb plugs.
  3. When the cable is in the right place. Push the latch back into place so the cable connection is secured.
  4. Feed the camera cable trough the provided hole into the grove board. (see picture of the grove board top view - red rectangle)

  5. Align the board with the pin connections on the side.
  6. Push it al the way down to make a stack.
  7. To secure the stack, mount the screw in the hole next to the audio connection of the raspberry pi. (see picture top view)
  8. The first stack is complete!

Air dust sensor:

  1. Connect the connector of the air dust sensor to pin D16 of the Grove hat board. ( see picture of the grove board top view - purple rectangle )

I2C connectors:

  1. Connect the two grove connection cables to the I2C connectors of the the Grove hat board. Preferably use the connectors that are close to the camera cable. This makes it easier to use the HDMI port afterwards. ( see picture of the grove board top view - blue rectangle )

Step 7: #Hardware - Building the Stack Into the Housing

Parts:

  • The assembly stack from step 6
  • Gateway_body 3D print
  • 3 x Long M2.5
  • 1 x M3

Instructions:

  1. Check if the micro SD card is inserted into the Raspberry Pi.
  2. Insert the air dust sensor in the 3D print housing and secure it with the M3 screw.
  3. Before we insert the stack. Guide the camera cable and the two I2C grove connection cables through the bottom slot in the housing.

  4. Insert the Pi stack into the housing.

  5. Push the cables down on the side so they don't get in the way.

  6. Make sure that no wires are in front of the Micro USB and the HDMI connection.

  7. Secure the stack with three M2.5 screws through the big holes in the front.

Step 8: #Hardware - Dragino LoRa Shield

Parts:

  • The assembly from step 7
  • Dragino LoRa shield
  • 4 x Short M2.5 screws

Instructions:

  1. Pre install the antenna to the Dragino LoRa shield. (don't fully tighten yet!)
  2. Insert the Dragino LoRa shield on top of the grove hat board. Align the pins and push it all the way down.
  3. Secure the board with the four M2.5 screws.

Step 9: #Hardware - Backcover

Parts:

  • The assembly from step 8
  • Gateway_backcover
  • 2x M3 screws

Instructions:

  1. Slide the inserts of the backcover into the housing and push it down.
  2. Fixated the backcover with two M3 screws.

Step 10: #Hardware - Setup LoRa Gatway

Parts:

  • The assembly from step 9
  • Peripherals: screen (HDMI) / keyboard / mouse
  • Micro usb power supply

Instructions:

  1. Connect the Raspberry to a screen with a HDMI cable.
  2. Connect a mouse, keyboard to the USB connector.
  3. Plug in the power usb cable to the Raspberry Pi last. It should start booting up now.

Step 11: #Software - Setup LoRa Gatway - First Start Up Raspberry Pi

Instructions:

  1. You will see the setup screen. Follow the setup screen instructions.
  2. Choose your county / network / keyboard setting
  3. At the end it will search for updates and install them. Please be patient, this can take a few minutes.

Step 12: #Software - Setup LoRa Gatway - Get Ether Adress for TTN

Instructions:

  1. Open a terminal on the Raspberry Pi.
  2. Type in > ifconfig wlan0:
  3. You can see the ether address of the Pi. (ex: b5:23:eb:fc:55:d4)
  4. Write this down because you will need it when setting up the gateway in TTN.

***Side note***

For more detail setup information about the Dragino PG1301, check the user manual (page 7):

Git link naar de pdf

Step 13: #TTN - Sign Up / Log in

The things network provide a set of open tools and a global, open network to build your next IoT application at low cost, featuring maximum security and ready to scale.

* If you already have an account you can skip this step.

Instructions:

  1. Sign up at The Things Network and make an account
  2. Follow the instruction on the TTN website.
  3. After Sign up log in to your account
  4. Go to your console. You will find it in the dropdown menu of your profile (see picture)

Step 14: #TTN - Create a Gatway on the TTN

Instructions:

  1. In the console on TTN, click on Gateway.
  2. Click on register gateway in the upper right corner to at a new gateway device. (see picture - red square)
  3. Check the box of "I'm using the legacy packet forwarder". (see picture - green square)
  4. Fill in the gateway EUI by using the ether address from the Pi. Convert your address like this example b5:23:eb:fc:55:d4 => B523EBFC55D4FFFF (see picture - green rectangle) The "FFFF" gets added to make it a 8 byte unique EUI.
  5. Choose your Frequency plan ( ex: Europe - 868MHz for Europe)
  6. Choose your router ( ex: ttn-router-eu for Europe)
  7. Point your location on the map. (optional)
  8. Check the right box, indoor or outdoor.
  9. On the bottom of the page click on the button Register Gateway


Step 15: #Software - Setup LoRa Gatway - Interface Options

Instructions:

  1. In the terminal type in > sudo raspi-config
  2. Select Interface options
  3. Select and enable SPI
  4. Select and enable Camera

  5. Select and enable I2C

Step 16: #Software - Setup LoRa Gatway - Download and Install LoRaWAN Packet Forwarder Enable SPi

Instructions:

  1. In the terminal type in > wget http://www.dragino.com/downloads/downloads/LoRa_Gateway/PG1301/software/lorapktfwd.deb
  2. This will download the packet forwarder from Dragino Server to RPI.
  3. In the terminal type in > sudo dpkg -i lorapktfwd.deb

Step 17: #Software - Setup LoRa Gatway - Config Gateway ID, Frequency Band and Server Address

Instructions:

  1. After installation, go to etc/lora-gateway/ and open local_conf.json
  2. In between the curly brackets add this section below:

"gateway_ID": "B523EBFC55D4FFFF",

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

"serv_port_up": 1700,

"serv_port_down": 1700

3. Change the gateway_ID to the gateway_ID you used to setup the gateway in the TTN. (with the "FFFF")

4. Save the document.

Step 18: #Software - Setup LoRa Gatway - Start the LoRa Network

Instructions:

  1. In the terminal type >
  2. sudo systemctl stop lorapktfwd
  3. sudo systemctl start lorapktfwd
  4. sudo systemctl enable lorapktfwd
  5. This restarts the package forwarder and makes sure the forwarder starts with Raspberry Pi. Now your LoRa gateway is active.
  6. You should see the status update to "connected" within a few minutes on TTN.

Step 19: #Software - Setup Gateway - Sensor / Camera - Install (optional)

Instructions:

  1. Check if you have python 3 on your Raspberry Pi. In the terminal type => python3
  2. If you don't have python 3, follow this install instructions:
  3. type => sudo apt update
  4. type => sudo apt install python3 idle3
  5. Now you should have python 3. Please check again with the first step.

Activate camera / I2C / SPI: (you might have done this already in the LoRa setup)

  1. In the terminal type => sudo raspi-config
  2. Go to Interfacing Options.
  3. Enable camera
  4. Enable I2C
  5. Enable SPI

Install following libraries: (type this commands in the terminal)

  1. sudo apt-get update
  2. sudo apt-get install libatlas-base-dev

  3. pip3 install numpy
  4. pip3 install opencv-python
  5. pip3 install scikit-image
  6. pip3 install schedule

  7. pip3 install getmac
  8. pip3 install adafruit-circuitpython-bme680
  9. pip3 install adafruit-circuitpython-tsl2561
  10. pip3 install RPI.GPIO

Step 20: #Software - Setup Gateway - Sensor / Camera - Script Run (optional)

Instructions:

  1. Download the python script "mumo.py" from github: Github link
  2. Place the code on your desktop.
  3. Open a terminal and type > sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
  4. Copy this line on to the bottom off the file > @lxterminal -e python3 /home/pi/Desktop/mumo.py
  5. Save the file and close it.
  6. Now the script will automatically start at restart.
  7. Open the code.
  8. Change to your URL endpoint. (where to send the data on your backend server)


Step 21: #Hardware - Sensor Extension (optional)

Parts:

  • The assembly from step 9
  • Sensor_body
  • Sensor_cap
  • Digital light sensor (small sensor)
  • BME680 sensor (long sensor)
  • 4 x M2x5 screws
  • 4x M3 screws

Instructions:

  1. Insert the two I2C grove connection cables through the hole of the sensor_cap.
  2. Connect the BME680 sensor and the digital light sensor to the I2C grove connection cable.
  3. Insert the BME680 sensor and the digital light sensor into the sensor_body part and secure it with four M2x5 screws. You will have to bend the cable to fit the sensors into place, so be careful!
  4. Slide the sensor_cap on top of the sensor body to close it.
  5. Fixated the cap to the body with two M3 screws.
  6. Attach the sensor add-on assembly to the front of the gateway with two M3 screws. (see picture - Red circle)
  7. The grove cables are probably too long. Push them inside the sensor housing.

Step 22: #Hardware - Camera Extension (optional)

Parts:

  • The assembly from step 10
  • Camera module (with M2.5 screws)
  • Camera_body
  • Camera_cap
  • 4x M3 screws

Instructions:

  1. Place the camera and one light attachment into the camera_cap housing and secure it with the four M2.5 screws from the camera module.
  2. To insert the camera cable we must lift the black plastic holder from the connection.
  3. Insert the camera cable with the blue surface facing the camera. (see pictures)
  4. Slide the camera_body on top of the assembly
  5. Fixated the camera_cap with two M3 screws to the camera_body.
  6. Mount the camera add on assembly to the bottom off the gateway housing with two M3 screws (see picture - Red circle)
  7. Push the protruding cable into the housing.

Step 23: #Hardware - Bug Trap Extension (optional)

Parts:

  • The assembly from step 11
  • Trap_Frame
  • bug trap paper - sticky paper
  • 2x M3 screws

Instructions:

  1. Place the Trap_Frame part on top of the camera housing. The trap has some space for the power usb cable of the gateway, therefore check the pictures for the correct orientation.
  2. Fixate with two M3 screws on the left and right side of the camera housing.
  3. Insert your (60 x 75) mm bug paper into the slot of the trap. There are two slots, in the front and back direction. It depends how you will position the gateway.
  4. The power usb cable can be weaved between the open structure of the trap part.

Step 24: #Hardware - Mounting the Gateway

The gateway is provided with many options to mount the gateway.

We have two screw slots on which the gateway can be hung.

We also have cable ties groves, so you can easily attach the gateway to anything.

Step 25: #Hardware - Differed Orientations

The gateway is modular so that the sensors and camera can be mounted in different orientations. You can also create your own components and add them to the setup.