Close
0%
0%

Mesh Gateway

A mesh-to-GSM gateway that allows mobile mesh radio users to exchange text messages with GSM phones.

Public Chat
Similar projects worth following

We describe how to create a mesh gateway device built with low-cost off-the-shelf parts that allows local off-grid mesh network users to exchange text messages with people on a traditional mobile phone network. This system can be used to extend global connectivity into off-grid locations or disaster areas.

In the article “How To Mesh The World” we describe how mesh networks can use gateways to traditional centralized networks to expand their usefulness. Data beamed from a satellite, for example, can be relayed through a gateway to off-grid users connected via a local mesh network, or connect users in different parts of the world via an Internet connected gateway.

Our mesh gateway project uses a small board computer with both GSM and mesh radios that runs a Python script to bridge these two networks. Users on the mesh network use a simple Android messaging app to exchange messages with other local mesh users or to exchange SMS messages with anyone on a GSM mobile network.

History

This project was first proposed in a post in early 2019 and the initial software was posted in early 2020 with the addition of a reference hardware implementation by Tourmaline Wireless. The python script that runs on the gateway is derived from the example script provided by goTenna with their public SDK. The Android messaging app used to communicate over the mesh network through the gateway is a fork of the Signal App that adds support for mesh communication using code from the sample Android app. Our fork of the Signal App allowed us to rapidly create an an open-source prototype messaging app. 

Mesh App

For simplicity we disable Signal's encrypted messaging functionality in our fork. This allowed us to rapidly prototype a messaging app with a familiar interface for our mesh gateway. We are currently working on our own open-source messaging app and would be happy to help integrate compatible mesh functionality into different open-source messaging apps.

Gateway Script

The Mesh Gateway script runs on a Raspberry Pi4 and forwards messages between the Mesh App via mesh radio and the GSM network.  Messages from the Mesh App include the mesh cender's device ID and the phone number of the GSM network recipient. When a GSM recipient responds, their reply is forwarded over the mesh network to the corresponding mesh sender's device ID.

The Mesh Gateway script also registers a user provided position and radio range for the gateway device on a web based map and posts periodic updates. The map will also indicate if a gateway has recently been updated or if it is offline.

Mesh Device

The Mesh Gateway script runs on a RaspberryPi 4B with a 3G/4G & LTE Base HAT from Sixfab to connect to the GSM network and a goTenna Mesh radio for mesh network communication connected via a USB cable.

Setup

  1. Install and run the GML Mesh App with a goTenna Mesh attached (instructions)
  2. Install a Mesh Gateway device with a GSM modem and goTenna Mesh attached (instructions)

SMS Gateway Messaging

  1. Select a phone contact using the GML Mesh App on your mobile device.
  2. Compose a message and select to send it using the goTenna Mesh radio to a Mesh Gateway device.
  3. The Mesh Gateway will receive the message and forward it to the SMS contact via the GSM network.
  4. The SMS recipient will receive the message as an SMS message from the Mesh Gateway.
  5. The SMS recipient can reply to the message using any SMS messaging app.
  6. When the Mesh Gateway receives an SMS message, it looks up the mesh ID of the device that last sent an SMS to the phone number of the incoming SMS.
  7. If a corresponding mesh sender is found, the gateway forwards the reply to the corresponding mesh device.
  8. If no corresponding mesh sender is found, the gateway broadcasts the message to mesh devices near the gateway.
  9. Mesh users receive SMS messages sent as direct replies and broadcasts via the GML Mesh App.

Operation Details

  • Messages are sent over the goTenna network to the nearest...
Read more »

View all 8 components

  • 1
    Getting Started
    1. Download Raspberry Pi OS: https://www.raspberrypi.org/downloads/raspberry-pi-os/
    2. Select: Raspberry Pi OS (32-bit) Lite, Download ZIP file
      (Current version as of this writing is August 2020, Release date: 2020-08-20)
    3. Download Balena Etcher: https://www.balena.io/etcher/
    4. Install and open Balena Etcher program
    5. Insert SanDisk Ultra 32 GB microSD card into card slot on your PC
    6. Select image: 2020-08-20-raspios-buster-armhf-lite.img
    7. Select target: microSD card location
    8. Click Flash! Button
    9. After flashing is complete, remove card (eject if needed) and re-insert card into card slot on your PC
    10. Add a blank text file with .ssh file extension anywhere in the boot directory
    11. Eject card and insert into the microSD card slot on Raspberry Pi
    12. Connect power and Ethernet cords to your Raspberry Pi and plug Ethernet cable into an open port on your router (or modem)
    13. Find the IP address assigned to your Raspberry Pi 
    14. Login to the Raspberry Pi:  
    ssh pi@xxx.xxx.xxx.xxx

    User password: raspberry

  • 2
    Configure Raspberry Pi

    sudo raspi-config 
    1. Select Option 8, Update (Update this tool to the latest version)
    2. Select Option1, Change User Password (Change password for the ‘pi’ user)
    3. Update with your own secure password
    4. Select Option 2, Network Settings (Configure network settings)
    5. Select N1 Hostname (Set the visible name for this Pi on a network)
    6. -> Provide a meaningful name for your gateway
    7. Select Option 2, Network Settings (Configure network settings) again
    8. Select N2 Wireless LAN (Enter SSID and passphrase)
    9. -> Specify WiFi credentials here if you would like to administer your gateway via WiFi
    10. Select Option 4, Localization Options (Set up language and regional settings to match your location)
    11. Select I2 Change Time Zone (Set up time zone to match your location)
    12. Select Option 5, Interfacing Options (Configure connections to peripherals)
    13. Select P4 SPI (Enable/Disable automatic loading of SPI kernel module)
    14. -> Enable SPI 

    Arrow down to Finish to exit & reboot

    If you will be using WiFi, remove the Ethernet connection, identify the new IP address assigned by your router 

    ssh pi@xxx.xxx.xxx.xxx

    Use your new password to login

  • 3
    Adding the Sixfab 3G/4G Base Hat and Quectel Module

    Read the getting started guide: https://docs.sixfab.com/docs/raspberry-pi-3g-4g-lte-base-hat-getting-started

    Use the QMI interface with Base Hat guide: https://docs.sixfab.com/docs/qmi-interface-with-base-hat

    Below are the commands you will need to run, which are also detailed in the guide above. Only run these set of commands once:

    sudo apt update && sudo apt upgrade -y
    
    sudo apt-get install raspberrypi-kernel-headers
    
    wget https://raw.githubusercontent.com/sixfab/Sixfab_RPi_3G-4G-LTE_Base_Shield/master/tutorials/QMI_tutorial/qmi_install.sh
    
    sudo chmod +x qmi_install.sh
    cd files/quectel-CM

    STOP!!

    Make sure the short USB plug on the Sixfab Base Hat is left unplugged before running the installer.

    sudo ./qmi_install.sh
    

     Press Enter key to reboot

    ** Before proceeding to the next step, make sure you have a Twilio SIM card that has been preconfigured on www.twilio.com See steps at the end of this guide.

    Now insert configured SIM card into the Sixfab Hat and plug in the USB cable into the Raspberry PI on the following slot: (photo)

    cd files/quectel-CM
    
    sudo ./quectel-CM -s wireless.twilio.com

    If you see the following line:  udhcpc: "no lease, failing"

    • Type Ctrl C
    • Then you need to add the following line:  denyinterfaces wwan0 to /etc/dhcpcd.conf 
    • The easiest way to do this is use the nano file editor:   nano /etc/dhcpcd.conf  
    • Add this line at the bottom of the file: denyinterfaces wwan0 then hit Ctrl X, Y (to save), Enter 
    • Now reboot the Raspberry Pi using: sudo reboot 
    • Re-run the two lines above after logging in

    Once the cellular modem is working properly, you should see the following line:

    udhcpc: lease of 30.60.240.152 obtained, lease time 7200

    You can open a new terminal tab, login, and try to run this command:

    ping -I wwan0 -c 5 8.8.8.8 

    If successful, you will see a similar output:

    $ ping -I wwan0 -c 5 8.8.8.8

    PING 8.8.8.8 (8.8.8.8) from 30.58.10.0 wwan0: 56(84) bytes of data.
    64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=71.4 ms
    64 bytes from 8.8.8.8: icmp_seq=2 ttl=117 time=39.6 ms
    64 bytes from 8.8.8.8: icmp_seq=3 ttl=117 time=40.8 ms
    64 bytes from 8.8.8.8: icmp_seq=4 ttl=117 time=47.3 ms
    64 bytes from 8.8.8.8: icmp_seq=5 ttl=117 time=45.3 ms

    --- 8.8.8.8 ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 11ms
    rtt min/avg/max/mdev = 39.638/48.902/71.382/11.589 ms

View all 7 instructions

Enjoy this project?

Share

Discussions

zyndram wrote 07/22/2023 at 09:39 point

meybe add https://reticulum.network/index_pl.html nodes to network?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates