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:
- Gateway
- GATEWAY_Main_Housing
- GATEWAY_Backcover
- Sensor_extension
- Sensor_Housing
- Sensor_Backcover
- Camera_extension
- Camera_Housing
- Camera_Backcover
- 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:
- 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.
- 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:
- Cut the red wire up to the connector.
- Cut the yellow wire at a distance of 3 cm from the connector.
- Cut the black wire at a distance of 2 cm from the connector.
- Strip the end of each wire.
- Put a small shrink sleeve over the yellow cable.
- Put a large shrink sleeve over the yellow and black cable.
- Solder the two resistors in series with the yellow cable of the connector in between.
- Solder the other yellow cable on the side of the sensor to one of the resistors.
- Slide the small sleeve over the solder connection of the yellow wire with one resistor end still exposed and heat shrink the small sleeve.
- Solder the black wires back together with the still exposed resistance end in between.
- Slide the large sleeve over the solder connection and the small sleeve and heat shrink the large sleeve.
- 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:
- Mount the female-male spacers through the mounting holes of the grove hat board
- Screw the nuts on the female-male spacers and tighten it. (to provide extra space for the cables to bend)
- Screw the female-female spacers on top of the nuts and tighten everything.
- 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:
- Lift the latch of the cable connecter on the Raspberry Pi (see picture one - red rectangle). Be careful, fragile!
- Insert the camera cable in the connector of the Raspberry Pi with the blue side facing the usb plugs.
- When the cable is in the right place. Push the latch back into place so the cable connection is secured.
Feed the camera cable trough the provided hole into the grove board. (see picture of the grove board top view - red rectangle)
- Align the board with the pin connections on the side.
- Push it al the way down to make a stack.
- To secure the stack, mount the screw in the hole next to the audio connection of the raspberry pi. (see picture top view)
- The first stack is complete!
Air dust sensor:
- 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:
- 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:
- Check if the micro SD card is inserted into the Raspberry Pi.
- Insert the air dust sensor in the 3D print housing and secure it with the M3 screw.
Before we insert the stack. Guide the camera cable and the two I2C grove connection cables through the bottom slot in the housing.
Insert the Pi stack into the housing.
Push the cables down on the side so they don't get in the way.
Make sure that no wires are in front of the Micro USB and the HDMI connection.
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:
- Pre install the antenna to the Dragino LoRa shield. (don't fully tighten yet!)
- Insert the Dragino LoRa shield on top of the grove hat board. Align the pins and push it all the way down.
- 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:
- Slide the inserts of the backcover into the housing and push it down.
- 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:
- Connect the Raspberry to a screen with a HDMI cable.
- Connect a mouse, keyboard to the USB connector.
- 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:
- You will see the setup screen. Follow the setup screen instructions.
- Choose your county / network / keyboard setting
- 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:
- Open a terminal on the Raspberry Pi.
- Type in > ifconfig wlan0:
- You can see the ether address of the Pi. (ex: b5:23:eb:fc:55:d4)
- 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:
- Sign up at The Things Network and make an account
- Follow the instruction on the TTN website.
- After Sign up log in to your account
- 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:
- In the console on TTN, click on Gateway.
- Click on register gateway in the upper right corner to at a new gateway device. (see picture - red square)
- Check the box of "I'm using the legacy packet forwarder". (see picture - green square)
- 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.
- Choose your Frequency plan ( ex: Europe - 868MHz for Europe)
- Choose your router ( ex: ttn-router-eu for Europe)
- Point your location on the map. (optional)
- Check the right box, indoor or outdoor.
- On the bottom of the page click on the button Register Gateway
Step 15: #Software - Setup LoRa Gatway - Interface Options
Instructions:
- In the terminal type in > sudo raspi-config
- Select Interface options
- Select and enable SPI
Select and enable Camera
Select and enable I2C
Step 16: #Software - Setup LoRa Gatway - Download and Install LoRaWAN Packet Forwarder Enable SPi
Instructions:
- In the terminal type in > wget http://www.dragino.com/downloads/downloads/LoRa_Gateway/PG1301/software/lorapktfwd.deb
- This will download the packet forwarder from Dragino Server to RPI.
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:
- After installation, go to etc/lora-gateway/ and open local_conf.json
- 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:
- In the terminal type >
- sudo systemctl stop lorapktfwd
- sudo systemctl start lorapktfwd
- sudo systemctl enable lorapktfwd
- This restarts the package forwarder and makes sure the forwarder starts with Raspberry Pi. Now your LoRa gateway is active.
- You should see the status update to "connected" within a few minutes on TTN.
Step 19: #Software - Setup Gateway - Sensor / Camera - Install (optional)
Instructions:
- Check if you have python 3 on your Raspberry Pi. In the terminal type => python3
- If you don't have python 3, follow this install instructions:
- type => sudo apt update
- type => sudo apt install python3 idle3
- 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)
- In the terminal type => sudo raspi-config
- Go to Interfacing Options.
- Enable camera
- Enable I2C
- Enable SPI
Install following libraries: (type this commands in the terminal)
- sudo apt-get update
sudo apt-get install libatlas-base-dev
- pip3 install numpy
- pip3 install opencv-python
- pip3 install scikit-image
pip3 install schedule
- pip3 install getmac
- pip3 install adafruit-circuitpython-bme680
- pip3 install adafruit-circuitpython-tsl2561
- pip3 install RPI.GPIO
Step 20: #Software - Setup Gateway - Sensor / Camera - Script Run (optional)
Instructions:
- Download the python script "mumo.py" from github: Github link
- Place the code on your desktop.
- Open a terminal and type > sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
- Copy this line on to the bottom off the file > @lxterminal -e python3 /home/pi/Desktop/mumo.py
- Save the file and close it.
- Now the script will automatically start at restart.
- Open the code.
- 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:
- Insert the two I2C grove connection cables through the hole of the sensor_cap.
- Connect the BME680 sensor and the digital light sensor to the I2C grove connection cable.
- 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!
- Slide the sensor_cap on top of the sensor body to close it.
- Fixated the cap to the body with two M3 screws.
- Attach the sensor add-on assembly to the front of the gateway with two M3 screws. (see picture - Red circle)
- 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:
- 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.
- To insert the camera cable we must lift the black plastic holder from the connection.
- Insert the camera cable with the blue surface facing the camera. (see pictures)
- Slide the camera_body on top of the assembly
- Fixated the camera_cap with two M3 screws to the camera_body.
- Mount the camera add on assembly to the bottom off the gateway housing with two M3 screws (see picture - Red circle)
- 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:
- 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.
- Fixate with two M3 screws on the left and right side of the camera housing.
- 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.
- 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.