To set the frequency or region on a Meshtastic device using the Meshtastic CLI, you need to understand that Meshtastic primarily configures frequency settings through the "region" parameter. This is because different regions (e.g., US, EU) have predefined frequency bands, bandwidths, and other LoRa radio settings to comply with local regulations. Setting a custom frequency directly is possible but not recommended, as it could lead to interference or legal issues. Instead, use the region setting for safe and automatic configuration.
Here's a step-by-step guide to do this using the Meshtastic CLI. I'll assume you have the Meshtastic CLI installed (if not, install it via pip install meshtastic on a system with Python).
Prerequisites:
- Connect your device: Ensure your Meshtastic device (e.g., a Heltec or T-Beam board) is connected to your computer via USB. The CLI will detect it automatically in most cases.
- Permissions: On Linux/macOS, you might need to run the CLI with elevated permissions (e.g., using
sudo) if you're accessing a serial port.
- CLI Version: Make sure you're using a recent version of the Meshtastic CLI for compatibility.
Step 1: Verify Connection and Device Status
Before making changes, check if your device is connected and view its current settings. Run the following command:
meshtastic --info
This will display information about connected devices, including the current region and LoRa settings. Look for the "lora" section to see the current region (e.g., "region: US").
If the device isn't detected, you might need to specify the serial port explicitly, like:
meshtastic --host /dev/ttyUSB0 --info # On Linux; use /dev/cu.usbserial-* on macOS
Step 2: Set the Region (and Frequency)
To set the region, use the --set command followed by the key-value pair for the LoRa region. The available regions include options like US, EU_433, EU_868, CN, etc. This will automatically configure the frequency, channel, bandwidth, and spreading factor based on the selected region.
Run the following command, replacing US with your desired region:
meshtastic --set lora.region US
After running this, the CLI should confirm the change, and the device will update its settings. The frequency is derived from the region, so you don't need to set it separately. For reference:
- US region typically uses frequencies around 902-928 MHz.
- EU_868 uses 863-870 MHz.
- You can check the exact frequencies in the Meshtastic documentation or by running
--info after setting.
If you absolutely need to set a custom frequency (not recommended), you can use additional LoRa parameters like frequency, bandwidth, and spread_factor. For example:
meshtastic --set lora.frequency 903000000 # Sets frequency to 903 MHz (in Hz)
meshtastic --set lora.bandwidth 125000 # Sets bandwidth to 125 kHz
meshtastic --set lora.spread_factor 7 # Sets spreading factor
However, this overrides the region settings and could cause issues. Always verify against your local regulations.
Step 3: Apply and Verify Changes
After setting the region or frequency, you may need to reboot the device to apply the changes:
meshtastic --reboot
Once rebooted, verify the new settings:
meshtastic --info
This should show the updated region and frequency in the output.
Additional Tips:
- Save Configuration: Changes made via CLI are typically saved to the device's persistent storage, but it's a good idea to double-check with
--info.
- Multiple Devices: If you have more than one Meshtastic device connected, you might need to specify the device using
--host or --port.
- Undo Changes: If you want to revert, you can set the region back to its default or use the Meshtastic app to reset.
- Safety First: Always ensure your settings comply with your country's radio regulations. Meshtastic's predefined regions are designed to be legal and optimal.
- Troubleshooting: If you encounter errors (e.g., "Device not found"), ensure the device is properly connected and the CLI has the necessary permissions. You can also check the Meshtastic logs with
--debug for more details.
- Documentation: For more advanced options, refer to the official Meshtastic documentation: Meshtastic CLI Docs.
If you run into any issues or need help with a specific error, feel free to provide more details about your setup!