Skip to content

Quick Start Guide

Get your Multiflexmeter 3.7.0 device operational in just a few steps.

  • Multiflexmeter 3.7.0 board
  • AVRISP programmer (USBasp, Arduino as ISP, or similar)
  • 6-pin ISP cable
  • Power supply (3.3V - 5V)
  • Sensor module (with I²C/SMBus interface)
  • PlatformIO installed
  • VS Code with PlatformIO extension (recommended)
  • AVRDude (for programming)
  • The Things Network account (free tier)
  • LoRaWAN gateway within range
  • The Things Network (TTN) coverage in your area
  1. Go to the repository: GitHub - multiflexmeter
  2. Download 3.7.0: Navigate to the Releases section and download version 3.7.0 since the documentation matches this version.
  3. Extract the archive: Unzip the downloaded file to a working directory.

Step 2: Register Device on The Things Network

Section titled “Step 2: Register Device on The Things Network”
  1. Create an Application

  2. Register Device

    • Add a new device to your application
    • Select OTAA activation method
    • Generate or enter DevEUI, AppEUI, and AppKey
    • Note all three values (you’ll need them next)

Create an EEPROM configuration file with your credentials:

Create a file eeprom_config.bin with this structure:

Offset | Size | Description
-------|------|------------
0x00 | 4 | Magic: "MFM\0"
0x04 | 2 | Hardware Version (MSB, LSB)
0x06 | 8 | AppEUI (little-endian)
0x0E | 8 | DevEUI (little-endian)
0x16 | 16 | AppKey (big-endian)
0x26 | 2 | Measurement Interval (seconds, uint16)
0x28 | 1 | TTN Fair Use Policy (0=disabled, 1=enabled)
Terminal window
# For M1284P variant (default)
pio run -e mfm_v3_m1284p

Build artifacts will be in .pio/build/mfm_v3_m1284p/firmware.hex

Terminal window
# Build and upload automatically using configured programmer
pio run -e mfm_v3_m1284p -t upload

This uses the upload protocol configured in platformio.ini (default: atmelice_isp).

If using a different programmer or manual flashing:

Terminal window
# For USBasp programmer
avrdude -c usbasp -p m1284p -U flash:w:.pio/build/mfm_v3_m1284p/firmware.hex:i
# For Atmel-ICE programmer
avrdude -c atmelice_isp -p m1284p -U flash:w:.pio/build/mfm_v3_m1284p/firmware.hex:i
Terminal window
avrdude -c usbasp -p m1284p -U eeprom:w:eeprom_config.bin:r
Terminal window
# Low Fuse: 0xFF (External crystal, fast start-up)
# High Fuse: 0xD1 (SPI enabled, BOD 2.7V)
# Extended Fuse: 0xFF (BOD enabled)
avrdude -c usbasp -p m1284p -U lfuse:w:0xFF:m -U hfuse:w:0xD1:m -U efuse:w:0xFF:m

Connect your I²C/SMBus sensor to the MFM board:

MFM PinSensor Pin
SDASDA
SCLSCL
3.3V/5VVCC
GNDGND

Default sensor address: 0x36

Apply power (3.3V - 5V) to the MFM board.

If DEBUG mode is enabled during compilation:

Terminal window
# Connect FTDI adapter to UART header
# 115200 baud, 8N1
screen /dev/ttyUSB0 115200
# or
minicom -D /dev/ttyUSB0 -b 115200

You should see:

Build at: Jan 15 2024 10:30:45
Starting OTAA join...
  1. Go to your TTN application
  2. Open your device
  3. Check Live Data tab
  4. Within 1-2 minutes, you should see:
    • Join request
    • Join accept
    • First uplink message (firmware version on FPort 2)
    • Regular measurement data (FPort 1)
  • First Message: Firmware version on FPort 2 (within 1 minute of join)
  • Subsequent Messages: Sensor data on FPort 1 every 15 minutes (900 seconds default)

Add this decoder to your TTN application:

function Decoder(bytes, port) {
if (port === 1) {
// Measurement data format: <Module Address> <Module Type> <Module Data Blob>
var decoded = {
module_address: bytes[0],
module_type: bytes[1],
raw_data: []
};
// Remaining bytes are module-specific data
for (var i = 2; i < bytes.length; i++) {
decoded.raw_data.push(bytes[i]);
}
return decoded;
} else if (port === 2) {
// Version info: 0x10, FW_MSB, FW_LSB, HW_MSB, HW_LSB
if (bytes[0] === 0x10 && bytes.length === 5) {
var fw_version = (bytes[1] << 8) | bytes[2];
var hw_version = (bytes[3] << 8) | bytes[4];
return {
message_type: "version",
firmware: {
proto: (fw_version >> 15) & 0x01,
major: (fw_version >> 10) & 0x1F,
minor: (fw_version >> 5) & 0x1F,
patch: fw_version & 0x1F
},
hardware: {
proto: (hw_version >> 15) & 0x01,
major: (hw_version >> 10) & 0x1F,
minor: (hw_version >> 5) & 0x1F,
patch: hw_version & 0x1F
}
};
}
}
return { error: "Unknown format" };
}

Symptoms: No join accept in TTN console

Causes & Solutions:

  • No gateway coverage: Check TTN Mapper for coverage in your area
  • Invalid credentials: Verify DevEUI, AppEUI, AppKey match TTN exactly
  • Byte order: DevEUI and AppEUI must be little-endian in EEPROM
  • Antenna: Ensure antenna is properly connected to RFM95

Symptoms: Device joins but sends zero or invalid measurements

Causes & Solutions:

  • Sensor not connected: Check I²C wiring
  • Wrong address: Verify sensor address is 0x36 (default)
  • Sensor not responding: Test sensor separately
  • Sensor power: Verify sensor is powered (check PIN_PERIF_PWR)

Symptoms: Device appears to transmit but TTN shows no data

Causes & Solutions:

  • Duty cycle: Device respecting EU868 1% duty cycle limit
  • SF too high: Check spreading factor (SF7-SF12)
  • Gateway issues: Check gateway status in TTN
  • Link budget: Device may be out of range

Symptoms: Battery drains quickly

Causes & Solutions:

  • Too frequent measurements: Increase interval
  • Debug mode enabled: Disable DEBUG in code
  • Sensor always powered: Check sensor power control
  • No sleep: Verify watchdog and sleep modes work

Now that your device is running:

Terminal window
pio run -e mfm_v3_m1284p
Terminal window
avrdude -c usbasp -p m1284p -U flash:w:.pio/build/mfm_v3_m1284p/firmware.hex:i
Terminal window
avrdude -c usbasp -p m1284p -U eeprom:w:eeprom_config.bin:r
Terminal window
avrdude -c usbasp -p m1284p -U eeprom:r:eeprom_dump.bin:r
hexdump -C eeprom_dump.bin | head -n 5
Terminal window
screen /dev/ttyUSB0 115200

Need help? Check: