config.ini Scripts
The NanoVNA-H can execute shell commands from a config.ini file on the SD card at startup. This allows you to automate settings, create custom configurations, and set up the device for specific measurement tasks.
How It Works
Section titled “How It Works”When the NanoVNA-H boots with an SD card containing config.ini:
- The file is read line by line
- Each line is executed as a shell command
- Commands run in order, top to bottom
- The device continues to normal operation
Create config.ini
Section titled “Create config.ini”- Create a text file named
config.inion your computer - Add shell commands, one per line
- Copy the file to the root of the SD card
- Insert SD card and power on the NanoVNA-H
Example Configurations
Section titled “Example Configurations”Basic Setup
Section titled “Basic Setup”# Set frequency rangesweep 144000000 148000000
# Set 201 sweep pointssweep start 144000000sweep stop 148000000
# Enable marker 1marker 1 on
# Set trace 0 to SWRtrace 0 swrAntenna Analyzer Mode
Section titled “Antenna Analyzer Mode”# VHF antenna setupsweep 144000000 148000000 201trace 0 swrtrace 1 logmagtrace 2 smithtrace 3 off
# Enable marker searchmarker 1 on
# Set scaletrace 0 scale 1trace 0 refpos 0Filter Test Configuration
Section titled “Filter Test Configuration”# Bandpass filter measurementsweep 140000000 150000000 401
# S21 for insertion losstrace 0 logmag 1trace 0 scale 10trace 0 refpos 8
# S11 for return losstrace 1 logmag 0
# Enable filter analysismeasure filterComponent Measurement
Section titled “Component Measurement”# LC measurement setupsweep 1000000 100000000 201trace 0 logmag 1trace 1 phase 1measure lcseriesAvailable Commands
Section titled “Available Commands”Commands that work in config.ini (marked with CMD_RUN_IN_LOAD flag):
| Command | Description |
|---|---|
sweep | Set frequency range and points |
trace | Configure trace format, channel, scale |
marker | Enable/position markers |
recall | Load saved calibration slot |
save | Save current configuration |
edelay | Set electrical delay |
s21offset | Set S21 offset |
power | Set output power level |
bandwidth | Set IF bandwidth |
smooth | Set smoothing factor |
measure | Enable measurement mode |
config | Set configuration options |
tcxo | Set TCXO frequency |
transform | Configure time domain |
color | Set display colors |
pause | Pause sweep |
resume | Resume sweep |
vbat_offset | Adjust battery offset |
threshold | Set harmonic threshold |
Comments
Section titled “Comments”Lines starting with # are treated as comments:
# This is a commentsweep 144000000 148000000
# Another commenttrace 0 swrMessages
Section titled “Messages”Display a message during startup:
# Show startup message (if supported)msg 2000 "VHF Antenna Mode" "Loading..."Parameters:
- First number: Display time in milliseconds
- First string: Message text
- Second string: Header text (optional)
Error Handling
Section titled “Error Handling”- Invalid commands are silently ignored
- The file continues processing after errors
- Check command syntax if settings don’t apply
Practical Examples
Section titled “Practical Examples”Multi-Configuration Setup
Section titled “Multi-Configuration Setup”Create multiple config files for different uses:
config.ini (default, loads on startup)antenna.ini (antenna mode - rename to config.ini when needed)filter.ini (filter test mode)crystal.ini (crystal measurement)Quick Recall Configuration
Section titled “Quick Recall Configuration”# Recall calibration slot 2recall 2
# Set 2m bandsweep 144000000 148000000 201Development/Debug Setup
Section titled “Development/Debug Setup”# High resolution modesweep 1000000 900000000 401bandwidth 100
# All tracestrace 0 logmag 0trace 1 logmag 1trace 2 smith 0trace 3 phase 1
# Enable smoothingsmooth 2Debugging
Section titled “Debugging”If config.ini doesn’t work as expected:
- Verify file is named exactly
config.ini(case may matter) - Check file is in root directory of SD card
- Ensure file uses Unix or Windows line endings
- Test each command individually via serial console
- Check for typos in command names or parameters