Set up Meshtastic on the Nugget via Python & Bash

Set up Meshtastic on the Nugget via Python & Bash

First, flash Meshtastic to the v3 Nugget, which can be done with the files here: https://github.com/RetiaLLC/DefconMeshtastic

You will need Python and esptool installed to do this. Follow the instructions in the .txt file included in the .ZIP on github to flash a fresh version.

Install Meshtastic on your computer with pip3 install meshtastic.

After flashing Meshtastic, you'll need to locate the serial port your Meshtastic nugget is connected to. On MacOS, this is "ls /dev/cu*"

Next, you'll use the following commands to flip the screen to the correct orientation and set the region to the United States.

Replace "SerialPort" with the port your device is connected to below:

# Set the region to US

meshtastic --port SerialPort --set lora.region US


Wait for 10 seconds to allow the device to reboot

Set the screen flip option

meshtastic --port SerialPort --set display.flip_screen true

This should set up your Meshtastic device!

You can automate it with the following bash script:

#!/bin/bash

# Check if a serial port argument is provided
if [ -z "$1" ]; then
  echo "Usage: $0 <serial_port>"
  exit 1
fi

# Assign the first argument to a variable
SERIAL_PORT=$1

# Set the region to US
meshtastic --port "$SERIAL_PORT" --set lora.region US

# Wait for 8 seconds to allow the device to reboot
sleep 8

# Set the screen flip option
meshtastic --port "$SERIAL_PORT" --set display.flip_screen true

Save this as setup.sh and run it like so:

bash setup.sh SerialPort

Remember to replace SerialPort with the actual serial port your Meshtastic device is connected to.

Adding a supported I2c sensor

If you add an i2c temperature sensor, you can run the following bash script to set it up and display telemetry on the screen:

#!/bin/bash

# Check if a serial port argument is provided
if [ -z "$1" ]; then
  echo "Usage: $0 <serial_port>"
  exit 1
fi

# Assign the first argument to a variable
SERIAL_PORT=$1

# Run the Meshtastic setup commands
meshtastic --port "$SERIAL_PORT" --set telemetry.environment_update_interval 10 \
           --set telemetry.environment_measurement_enabled true \
           --set telemetry.environment_screen_enabled true \
           --set telemetry.environment_display_fahrenheit true

Save this as SensorSetup.sh and run it like so:

bash SensorSetup.sh SerialPort

Now, your Meshtastic device should be set up!