====== Getting Started with Meshtastic in Singapore ====== ([[#python_cli_quickstart|Quickstart for existing Meshtastic users with Python CLI]]) ===== Reasons to Use Meshtastic =====
Meshtastic® is a project that enables you to use inexpensive LoRa radios as a long range off-grid communication platform in areas without existing or reliable communications infrastructure. This project is 100% community driven and open source! https://meshtastic.org/docs/introduction/==== For Laypersons ==== Meshtastic provides a phone app that looks and feels similar to other messaging apps, except that it does not require any cellular data or Wi-Fi. Instead, communications take place over a network of devices (nodes) that are owned and operated by the users, with nodes relaying messages to other nodes in range (typically several kilometers). ==== For Persons with An Interest in Electronics or Radio Communications ==== Meshtastic is a great platform with opportunities to observe and experiment with radio communications in the real world, urban and outdoors. The software, firmware and protocol are open source and extensible; the protocol can send GPS coordinates, telemetry such as weather data, GPIO sensors and more. Various integrations for other software to send data over Meshtastic have also been written e.g. ATAK. For more information about the LoRa modulation/encoding Meshtastic uses, have a read of [[https://www.semtech.com/lora/what-is-lora|what is LoRa]]. ==== Use Cases ==== * Off-grid communications * Backcountry hiking, cycling etc. * Unreliable/outside of cell coverage * Decentralized, off-cloud communications * Disaster Response/Search And Rescue * Tactical situational awareness (e.g.: ATAK) * Sensor networks (environment sensors, GPIO sensors) * **And more!** ===== Buy Hardware to Use Meshtastic ===== :!: Do not power up LoRa boards without an antenna attached, the transmitter may get damaged by the reflected signal :!: Minimum hardware needed to get connected: - **[[https://meshtastic.org/docs/hardware/devices/|Meshtastic Device]]** - **[[https://meshtastic.org/docs/software/|Meshtastic Software]]** i.e. a **client device** - **[[https://meshtastic.org/docs/hardware/antennas/|Antenna]]** ==== Meshtastic Devices ==== :!: When ordering, select the 923 MHz option if available, otherwise, 915 MHz, or 868 MHz if no other 900 MHz band is available :?: The device hardware for 868/915/923 MHz selection is the same, just with different antennae in the box; 433 MHz has hardware differences and can't be used for 900 MHz band * Portable All-In-One Devices (screen, battery, GPS, antenna, sensor(s), enclosure, low power consumption) * [[https://www.lilygo.cc/products/t-echo|LILYGO T-Echo]] - US$ $54.41 (US$ 62.46 with Bosch BME280 sensor) * Portable All-In-One Kits (screen, battery, GPS, antenna, sensor(s)) * [[https://www.lilygo.cc/products/t-beamsupreme-m|LILYGO T-Beam Supreme]] - US$ 44.17 with Quectel L76K GPS, US$ 70.17 with u-blox MAX-M10S (BYO 18650 battery) * [[https://www.lilygo.cc/products/t-beam-v1-1-esp32-lora-module|LILYGO T-Beam]] - US$ 32.80 (BYO 18650 battery) * [[https://www.lilygo.cc/products/t-deck|LILYGO T-Deck]] - US$ 52.66 (standalone device with keyboard) * DIY Kits (screen, antenna, optional battery; suitable for home/office use or powering with USB power bank) * [[https://www.lilygo.cc/products/t3s3-v1-0|LILYGO T3-S3]] - US$ 17.58 * [[https://heltec.org/project/wifi-lora-32-v3/|Heltec WiFi LoRa 32(V3)]] - US$ 17.90 * [[https://heltec.org/project/wireless-stick-lite-v2/|Heltec Wireless Stick Lite v3]] - US$ 14.90 (**no screen**) :!: Heltec devices are missing USB-C Configuration Channel resistors, so USB-C PD compliant supplies will likely not supply power. Using a USB-A to USB-C cable solves this issue. LILYGO boards have the correct CC resistors (i.e. 5.1 kΩ from pins CC1 and CC2 to ground) and do not have this issue. ==== Meshtastic Software ==== :?: Connects to the Meshtastic node over Bluetooth LE, USB serial or Wi-Fi. Optional if you have a standalone node with keyboard. * Android device + [[https://play.google.com/store/apps/details?id=com.geeksville.mesh|Meshtastic Android app]] * iOS device + [[https://apps.apple.com/app/meshtastic/id1586432531|Meshtastic iOS App]] * Desktop device + [[https://meshtastic.org/docs/software/python/cli|Python CLI]] or [[https://meshtastic.org/docs/software/web-client/|Web Client]] (I don't recommend it for first time users) ==== Antennae ==== * With appropriate frequency for configured region * 915 MHz are usually fine for SG_923 (LongFast default frequency is 917.125 MHz) * Some devices bundle an antenna, they may not have best resonance at 923 MHz but are good enough to start with === Antenna Suggestions (TODO: NanoVNA test reports) === * **Taoglas TI.92.2113** - SMA 2 dBi hinged dipole; [[https://www.taoglas.com/datasheets/TI.92.2113.pdf|datasheet]]; purchase link: [[https://sg.element14.com/3678729|element14]] * **Ziisor TX915-JKD-20** - SMA 3.5 dBi hinged dipole; [[http://image.ziisor.com/ZIISOR_TX915-JKD-20_EN_v2.0.pdf|datasheet]]; purchase link: [[https://item.taobao.com/item.htm?id=597796890564&skuId=4288769213090|Taobao]] * **Ziisor TX915-JZLW-15** - U.FL 3 dBi fixed dipole; [[https://www.ebyte.com/en/pdf-down.aspx?id=2288|datasheet]]; purchase link: [[https://item.taobao.com/item.htm?id=597796890564&skuId=4656759778237|Taobao]] * **BETAFPV Moxon V2**- SMA 5.9 dBi directional 2-element yagi?; [[https://betafpv.com/products/betafpv-moxon-antenna|specifications]]; purchase link: [[https://item.taobao.com/item.htm?id=682709485161&skuId=5060376491785|Taobao]] ==== Nice to Haves ==== * **Battery** * For mobile nodes that have battery connectors and onboard lithium-ion chargers * For battery backup of stationary nodes * [[projects:amateur_radio:buyers_guide#batteries|Buyer's Guide: Batteries]] * **Solar power** for hard-to-access nodes * Bypass the DC-DC buck-boost connector on the USB-A end of the cable if using a LoRa board with built-in battery/solar charging IC to avoid the extra conversion loss * [[projects:amateur_radio:buyers_guide#solar_power|Buyer's Guide: Solar Power]] * **IP-rated enclosure** for outdoor nodes ===== Installing Meshtastic Firmware ===== Flash the latest firmware with the [[https://flasher.meshtastic.org/|Meshtastic web flasher]]. - Appropriate USB COM port drivers must be installed (Windows/MacOS), e.g. [[https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers|Silicon Labs CP210x VCP drivers]] - Put the device into programming mode * Battery powered devices: Connect USB cable, hold the boot button, tap the reset button, release the boot button * USB powered devices: Hold the boot button, connect USB cable, release the boot button - Select your board and the latest firmware at [[https://flasher.meshtastic.org/|Meshtastic web flasher]] - Click //Flash//, //Continue// - Select //Full Erase and Install// if this is the first time installing Meshtastic, this will wipe any leftover data from factory programming For more experienced ESP32 users, standard tools and methods to flash ESP32 can be used as well, with files from the [[https://github.com/meshtastic/firmware/releases|Meshtastic firmware releases]]. ===== First Use Configuration ===== ==== Region Configuration ==== A freshly installed Meshtastic device must have its region configured before the LoRa radio is enabled, this sets limits on the Meshtastic device and LoRa radio to operate within local regulation restrictions. The exact firmware limits for each region can be found in the [[https://github.com/meshtastic/firmware/blob/master/src/mesh/RadioInterface.cpp|firmware definitions]]. Devices are only visible to, and can only communicate with, devices configured with the same region. * **Android/iOS Client**: When you first connect, you will be prompted to configure the region; select //SG_923// * **Python CLI**: ''meshtastic --set lora.region 18'' **Usable regions in Singapore**: * **EU_433** * Frequency band: 433 - 434 MHz * ERP: 10 mW (10 dBm) * Duty cycle: 10% * IMDA TS SRD band: 26a * **SG_923** <- use this, it has higher output power, no duty cycle restriction and is also allocated to LPWAN * Frequency band: 917 - 923 MHz * ERP: 100 mW (20 dBm) * IMDA TS SRD band: 30d (not 30b/30c as [[https://meshtastic.org/docs/faq/#mesh|Meshtastic is not LPWAN]]) * **Do not use regions not listed above** as they have other allocations here ==== Meshtastic Channel Configuration ==== * Meshtastic channels are logical channels (like Telegram channels, WhatsApp groups) * Primary - Telemetry and position data * Secondary - Free to use, up to 7 channels * Channel named “admin” is a special channel used to configure nodes over the mesh * Name and encryption configured per-channel * Shareable as QR code or a deeplink URL **Creating a Private 9V1 Primary Channel with Default Secondary Channel** Motivations: * Encrypt the primary channel with a private name * Don't send plaintext GPS position messages over MQTT forwarding * Don't send plaintext telemetry over MQTT forwarding * Connectivity with SG_923 Meshtastic users on the default SG_923 LongFast channel * Rebroadcast public SG_923 Meshtastic traffic Steps (the easy way): - [[user:andrew|Contact me]] for the channel URL - Install the channel and LoRa settings with the URL * **Android/iOS Client**: Open the link on the same device as the Meshtastic app and accept the settings * **Python CLI**: ''%%meshtastic --seturl '[channel url]'%%'' Steps (the hard way, adapted from [[https://meshtastic.org/docs/configuration/tips/#creating-a-private-primary-with-default-secondary|Creating a Private Primary with Default Secondary]]): - Ensure you have not changed the LoRa [[https://meshtastic.org/docs/configuration/radio/lora/#modem-preset|Modem Preset]] from the default ''unset''/''LONG_FAST'' - On your PRIMARY channel, set channel name to ''9V1'' and set encryption key ([[user:andrew|contact me]] for it) - Configure and enable a SECONDARY channel named ''LongFast'' with PSK ''AQ=='' - If your LoRa channel is at the default (''0''), the radio's frequency will be automatically changed based on your PRIMARY channel's name. In this case, you will have to manually set it back to your region's default (in LoRa settings) in order to interface with users on the default channel: * ''4'' for SG_923(([[https://meshtastic.org/docs/configuration/tips/#default-primary-channels-by-region|Default Primary Channels by Region]])) ==== Enable MQTT Forwarding ==== Because we don't currently have enough nodes in Singapore to form a full mesh, we need to enable MQTT forwarding to use the Internet as a backhaul to forward messages between isolated nodes and meshes. The node must either be connected to Wi-Fi directly (mesh router-client to MQTT bridge), or be paired with an Android or iOS device with "MQTT Client Proxy" enabled (mobile node). In future, when a full mesh is formed, MQTT can be disabled for a truly decentralized and private mesh, or left enabled as a backup in case of dead zones in the mesh. * **Android/iOS Client**: - In //Modules// -> //MQTT// - //Enabled//: on - Portable nodes with BLE to phone only: //MQTT Client Proxy//: on - Leave the other settings at defaults to use the Meshtastic public MQTT server - In //Channels// - ''9V1'' and ''LongFast'': //MQTT Uplink//: on; //MQTT Downlink//: on * **Python CLI**: - ''meshtastic --set mqtt.enabled true'' - Portable nodes with BLE to phone only: ''meshtastic --set mqtt.proxy_to_client_enabled true'' - ''meshtastic --ch-set downlink_enabled true --ch-index 0 --ch-set uplink_enabled true --ch-index 0 --ch-set downlink_enabled true --ch-index 1 meshtastic --ch-set uplink_enabled true --ch-index 1'' ==== Configuration for Wi-Fi MQTT Routers ==== :!: Turning Wi-Fi on turns BLE off, so further configuration will have to be done over the Web Client, Android client or Python CLI. * **Android/iOS Client**: - In //Device Configuration// - //Device Role//: Router & Client - //Network//: Configure Wi-Fi accordingly (you will lose connectivity at this point on the iOS app) - //Position//: - //Device GPS//: Off - //Fixed Position//: On * **Python CLI**: - ''%%meshtastic --set device.role ROUTER_CLIENT --set network.wifi_enabled true --set network.wifi_ssid "your network" --set network.wifi_psk yourpassword%%'' - ''%%meshtastic --set position.fixed_position true --setlat x.x --setlon y.y --setalt z.z%%'' === Enable Store & Forward === [[https://meshtastic.org/docs/configuration/module/store-and-forward-module/#requirements|Requirements]]: * Must be installed on a ROUTER or ROUTER_CLIENT node. * This is an artificial limitation, but is in place to enforce best practices. * Router nodes are intended to be always online. If this module misses any messages, the reliability of the stored messages will be reduced. * ESP32 Processor based device with onboard PSRAM (T-Beam > v1.0, T3S3, and maybe others). * **Android/iOS Client**: - In //Settings// -> //Module Configuration// -> //Store & Forward//: On * **Python CLI**: - ''%%meshtastic --set store_forward.enabled true%%'' :?: To find GPS coordinates for your address, you can use the [[https://developers.google.com/maps/documentation/geocoding/overview|Google Maps geocoding demo]] :!: Please write to [[me@ndoo.sg]] if you have a site to offer for a Wi-Fi to MQTT router; we will sponsor the hardware. ===== Build, Buy or 3D Print Enclosure for your Meshtastic Device ===== Meshtastic devices are primarily development boards, thus being bare PCBs; many also use U.FL/IPEX connections for their LoRa antenna, which are extremely fragile. For your Meshtastic device to leave your desk, you are likely to want an enclosure. Have a look at [[.device_enclosures:start]] for some ideas and recommendations. ===== Python CLI Quickstart ===== If you have used Meshtastic before and just want to switch over to SG_923, here are all the commands you need to get configured.
# Licensed hams
meshtastic --set-ham [YOUR_CALLSIGN] --set-owner-short [4_CHARACTER_SHORT_NAME]
# Other users
meshtastic --set-owner [LONG_NAME] --set-owner-short [4_CHARACTER_SHORT_NAME]
# Set region
meshtastic --set lora.region 18 && sleep 15
# Set channel and tx power (don't configure it at the same time as changing regions)
meshtastic --set lora.channel_num 4 --set lora.tx_power 0 && sleep 15
# IF Portable device
meshtastic --set mqtt.enabled true --set mqtt.proxy_to_client_enabled true
# ELSEIF Stationary MQTT router
meshtastic --set mqtt.enabled true --set mqtt.proxy_to_client_enabled true --set device.role ROUTER_CLIENT --set network.wifi_enabled true --set network.wifi_ssid "your network" --set network.wifi_psk yourpassword
# ENDIF
# IF configuring channels via channel URL
meshtastic --seturl [CONTACT ME FOR URL]
# ELSEIF configuring channels manually
meshtastic --ch-longfast
meshtastic --ch-set name 9V1 --ch-index 0
meshtastic --ch-set psk [CONTACT ME FOR PSK] --ch-index 0
meshtastic --ch-set downlink_enabled true --ch-index 0 --ch-set uplink_enabled true --ch-index 0
meshtastic --ch-set name LongFast --ch-index 1
meshtastic --ch-set psk 0x01 --ch-index 1
meshtastic --ch-set downlink_enabled true --ch-index 1 --ch-set uplink_enabled true --ch-index 1
meshtastic --ch-enable --ch-index 1
# ENDIF
Android/iOS app: Skip ahead to [[#first_use_configuration|First Use Configuration]]
===== Other Meshtastic Notes =====
==== Data Rates ====
^ Channel setting ^ Alt Channel Name ^ Data-Rate ^ SF / Symbols ^ Coding Rate ^ Bandwidth ^ Link Budget ^
| Short Range / Fast | Short Fast | **10.94 kbps** | 7 / 128 | 4/5 | 250 | 143dB |
| Short Range / Slow | Short Slow | **6.25 kbps** | 8 / 256 | 4/5 | 250 | 145.5dB |
| Medium Range / Fast | Medium Fast | **3.52 kbps** | 9 / 512 | 4/5 | 250 | 148dB |
| Medium Range / Slow | Medium Slow | **1.95 kbps** | 10 / 1024 | 4/5 | 250 | 150.5dB |
| Long Range / Fast | Long Fast | **1.07 kbps** | 11 / 2048 | 4/5 | 250 | 153dB |
| Long Range / Moderate | Long Moderate | **0.34 kbps** | 11 / 2048 | 4/8 | 125 | 156dB |
| Long Range / Slow | Long Slow | **0.18 kbps** | 12 / 4096 | 4/8 | 125 | 158.5dB |
| Very Long Range / Slow | Very Long Slow | **0.09 kbps** | 12 / 4096 | 4/8 | 62.5 | 161.5dB |
- [[https://meshtastic.org/docs/overview/radio-settings/#data-rates|Data Rates]]
==== Windows Python Incompatibility ====
* Windows 11's built in Python binaries did not work out of the box with Meshtastic, I had to install Python's official release for Windows to successfully install Meshtastic; steps:
- Install latest Python from [[https://www.python.org/downloads/windows/|Python Releases for Windows]] (don't forget to add this Python to PATH during install)
- pip install --upgrade pip
- pip install meshtastic
==== Entering ESP32 Download Mode ====
* Entering download mode on ESP32-C3 (and most other ESP32 based boards):
* Warm reset (useful if disconnecting power is inconvenient, e.g. battery is encased)
- Hold BOOT
- Tap RST
- Release BOOT after 2 seconds
* Cold reset
- Remove all power sources (USB, battery, solar, etc.)
- Hold BOOT
- Insert power supply
- Release BOOT after 2 seconds