{"id":37,"date":"2024-10-27T11:01:00","date_gmt":"2024-10-27T11:01:00","guid":{"rendered":"https:\/\/willwoodman.co.uk\/wordpress\/?p=37"},"modified":"2025-03-27T11:04:53","modified_gmt":"2025-03-27T11:04:53","slug":"meshtastic-infrastructure","status":"publish","type":"post","link":"https:\/\/willwoodman.co.uk\/wordpress\/2024\/10\/27\/meshtastic-infrastructure\/","title":{"rendered":"Meshtastic Infrastructure"},"content":{"rendered":"\n<p><em>It&#8217;s only temporary&#8230;. unless it works<\/em>!<\/p>\n\n\n\n<p>I&#8217;ve been interested in <a rel=\"noreferrer noopener\" href=\"https:\/\/meshtastic.org\/\" target=\"_blank\">Meshtastic<\/a> for a while now.  Meshtastic uses low power <a rel=\"noreferrer noopener\" href=\"https:\/\/en.wikipedia.org\/wiki\/LoRa\" target=\"_blank\">LoRa<\/a> devices which are license free to build a distributed RF mesh communications network.  I have several of these devices however the area where I live is not well served with meshtastic nodes.  So it&#8217;s time to fix that with some infrastructure.<\/p>\n\n\n\n<p>Here is the idea &#8211; I live between Southampton and Portsmouth.  Both of these areas have a good mesh network.  The initial aim is to link in with one or the other networks to provide a &#8216;route out&#8217; from my location into a wider mesh.  The longer term goal is to link the two in order to provide distributed communication along a larger area of the South Coast.<\/p>\n\n\n\n<p>Looking at the geography and available nodes a good strategy is to try to establish a link with high ground overlooking Portsmouth.  Above Portsmouth sits Portsdown Hill.  There are nodes installed on the hill that then provide service into Portsmouth and along the South Coast.  Previous experiments show that co-ax loss is a big issue with the low power mesh devices.  Therefore this is a key design consideration.  Another key consideration is that in order to reach Portsdown Hill the node (or at least the antenna) needs to be elevated to overcome buildings and terrain along the way.<\/p>\n\n\n\n<p>The solution:<\/p>\n\n\n\n<p>I decided to install two heltec radio modules in an enclosure on top of a radio mast.  By installing them at the top of the mast I reduce the coax required from around 10m to around 10cm!  The challenges are powering them, extracting the data and controlling the nodes.  To solve this I also installed a Raspberry Pi Zero with a <a rel=\"noreferrer noopener\" href=\"https:\/\/thepihut.com\/products\/poe-usb-hub-hat-for-raspberry-pi-zero?srsltid=AfmBOoqW1dTsxJZBpNqXovWKvdfXEhfNFICfwK7WJKYEPA_b2xbddLlJ\" data-type=\"URL\" data-id=\"https:\/\/thepihut.com\/products\/poe-usb-hub-hat-for-raspberry-pi-zero?srsltid=AfmBOoqW1dTsxJZBpNqXovWKvdfXEhfNFICfwK7WJKYEPA_b2xbddLlJ\" target=\"_blank\">POE\/USB hat<\/a> in the enclosure.  The USB powers the heltec radio and provides a control link for software upgrades\/configuration changes etc.  The whole setup is powered by an Ethernet link to a power over Ethernet switch in my garage.<br><br> <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"589\" height=\"643\" src=\"https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-6.png\" alt=\"\" class=\"wp-image-38\" srcset=\"https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-6.png 589w, https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-6-275x300.png 275w\" sizes=\"(max-width: 589px) 100vw, 589px\" \/><\/figure>\n\n\n\n<p>In order to use the mesh network the radios need to communicate with an application &#8211; this can be a PC application or a phone application (or both).  I mainly use the android app.  This is achieved using the Heltecs inbuilt WiFi module to connect the devices to the network.  Using VPN these can then be accessed worldwide.  Because my home WiFi doesn&#8217;t reliably cover a point 10 above my garage I created a WiFi hotspot in the Raspberry Pi.<\/p>\n\n\n\n<p>The biggest challenge was creating the WiFi access point in the Raspberry Pi and the associated routing for the network.  Here&#8217;s the code (yes I know there&#8217;s a password in there &#8211; it&#8217;s not the real password!):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted has-tertiary-background-color has-background has-small-font-size\">Create the access point:\nsudo nmcli con add con-name mesh-hotspot ifname wlan0 type wifi ssid lhrn mode ap wifi.band bg  ipv4.method shared\nsudo nmcli con modify mesh-hotspot wifi-sec.key-mgmt wpa-psk\nsudo nmcli con modify mesh-hotspot wifi-sec.psk \"raspberry\"\n\nHide the SSID - optional step I just did this for a little security\nsudo nmcli con modfiy mesh-hotspot wifi.hidden yes\n\nEnable WPA2 - I found without this the Heltecs would not connect.\nsudo nmcli con modify mesh-hotspot 802-11-wireless-security.proto rsn\n\nThen using VI I edited this file:\nsudo vi \/etc\/NetworkManager\/system-connections\/mesh-hotspot.nmconnection\nAdded this line under [ipv4] to set the subnet for the hotspot.\naddress1=192.168.125.1\/24,192.168.125.1\n\nThe using VI I uncomment ipv4.forwarding from \n\/etc\/sysctl.conf\n\nThat enables forwarding IP packets between the ethernet and wifi ports.\n\nI found the only way to reliably bring up the hospot was using crontab - so I added this line to my crontab using crontab -e\n@reboot nmcli con up mesh-hotspot\n\nThen install python and pip\nsudo apt-get install pip -y\nsudo rm \/usr\/lib\/python3.11\/EXTERNALLY-MANAGED\n\nInstall esptool for flashing the heltecs over serial\npip install --upgrade esptool --user\n\nEnable the serial drivers\nsudo modprobe cp210x\n\nAnd then install the Meshtastic CLI\npip install --upgrade pytap2\npip install meshtastic --user \n<\/pre>\n\n\n\n<p>The physical build is only intended to be temporary (unless it works).  I fitted everything into an old Tupperware container.  I one node is connected to a directional antenna which is aimed at Portsdown Hill to link into the wider mesh.  The other node is connected to an omnidirectional antenna to provide local coverage.<\/p>\n\n\n\n<div class=\"is-layout-flex wp-container-2 wp-block-columns\">\n<div class=\"is-layout-flow wp-block-column\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-image alignright size-full is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-1-1.png\" alt=\"\" class=\"wp-image-40\" width=\"267\" height=\"341\" srcset=\"https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-1-1.png 539w, https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-1-1-235x300.png 235w\" sizes=\"(max-width: 267px) 100vw, 267px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image alignleft size-large is-resized\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-7-1024x734.png\" alt=\"\" class=\"wp-image-39\" width=\"307\" height=\"219\" srcset=\"https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-7-1024x734.png 1024w, https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-7-300x215.png 300w, https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-7-768x551.png 768w, https:\/\/willwoodman.co.uk\/wordpress\/wp-content\/uploads\/2025\/03\/image-7.png 1088w\" sizes=\"(max-width: 307px) 100vw, 307px\" \/><\/figure>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s only temporary&#8230;. unless it works! I&#8217;ve been interested in Meshtastic for a while now. Meshtastic uses low power LoRa devices which are license free to build a distributed RF mesh communications network. I have several of these devices however the area where I live is not well served with meshtastic nodes. So it&#8217;s time [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":3,"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":44,"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/37\/revisions\/44"}],"wp:attachment":[{"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/willwoodman.co.uk\/wordpress\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}