diff --git a/avr/devices/0BUILD b/avr/devices/0BUILD
index 23e950c..2b8a75b 100644
--- a/avr/devices/0BUILD
+++ b/avr/devices/0BUILD
@@ -23,6 +23,7 @@
n28
n29
n30
+ n31
r06
s03
t03
diff --git a/avr/devices/n31/.gitignore b/avr/devices/n31/.gitignore
new file mode 100644
index 0000000..25dc86f
--- /dev/null
+++ b/avr/devices/n31/.gitignore
@@ -0,0 +1,4 @@
+*.eep.hex
+*.obj
+n29-enclosure.stl
+n29-enclosure-2.stl
diff --git a/avr/devices/n31/0BUILD b/avr/devices/n31/0BUILD
new file mode 100644
index 0000000..3f7db52
--- /dev/null
+++ b/avr/devices/n31/0BUILD
@@ -0,0 +1,19 @@
+
+
+
+
+
+ boot
+ main
+
+
+
+ defs.asm
+ README
+ enclosure.scad
+
+
+
+
+
+
diff --git a/avr/devices/n31/README b/avr/devices/n31/README
new file mode 100644
index 0000000..0a08578
--- /dev/null
+++ b/avr/devices/n31/README
@@ -0,0 +1,17 @@
+
+N31
+===
+
+- Role: Air quality sensors
+- MCU: AtTiny84
+- Frequency: 1MHz
+- Connection: RJ45
+- Predecessor: N26
+- COM: COM2W
+- Periphery:
+ - TWI interface
+ - SGP-30/40 air quality sensor
+- Apps:
+ - NETWORK: Basic network functionality (address setup etc.)
+ - REPORTSENSORS: report sensor data from temperature sensor etc.
+ - STATS : periodically send stats data
diff --git a/avr/devices/n31/boot/0BUILD b/avr/devices/n31/boot/0BUILD
new file mode 100644
index 0000000..9651a6f
--- /dev/null
+++ b/avr/devices/n31/boot/0BUILD
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+ -I $(builddir)
+ -I $(srcdir)
+ -I $(topsrcdir)/avr
+ -I $(topbuilddir)/avr
+
+
+
+
+ boot.asm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/avr/devices/n31/boot/boot.asm b/avr/devices/n31/boot/boot.asm
new file mode 100644
index 0000000..7f35036
--- /dev/null
+++ b/avr/devices/n31/boot/boot.asm
@@ -0,0 +1,157 @@
+; ***************************************************************************
+; copyright : (C) 2026 by Martin Preuss
+; email : martin@libchipcard.de
+;
+; ***************************************************************************
+; * This file is part of the project "AqHome". *
+; * Please see toplevel file COPYING of that project for license details. *
+; ***************************************************************************
+
+
+; ***************************************************************************
+; Source file for base system node on AtTiny 84
+;
+; This is for the maintenance system (i.e. the flash loader).
+;
+; All definitions and changes should go into this file.
+; ***************************************************************************
+
+.equ clock=1000000 ; Define the clock frequency
+
+.nolist
+.include "include/tn84def.inc" ; Define device ATtiny84
+.list
+
+.include "version.asm"
+.include "../defs.asm"
+
+.include "common/calls.asm"
+.include "common/utils_io.asm"
+.include "devices/all/defs.asm"
+
+
+#define COM_ACCEPT_ALL_DEST
+
+
+
+; ***************************************************************************
+; defines
+
+; ---------------------------------------------------------------------------
+; generic
+
+.include "common/utils_wait.asm"
+.include "modules/com2/defs.asm"
+.include "modules/comproto/defs.asm"
+
+
+
+; ---------------------------------------------------------------------------
+; firmware settings
+
+
+
+; ---------------------------------------------------------------------------
+; LED
+
+.equ LED_DDR = DDRA
+.equ LED_PORT = PORTA
+.equ LED_PIN = PINA
+.equ LED_PINNUM = PORTA3
+
+
+; ***************************************************************************
+; code segment
+
+.cseg
+.org 0x0000
+
+
+
+; ---------------------------------------------------------------------------
+; Reset and interrupt vectors
+; rjmp start ; Reset vector
+ rjmp main ; Reset vector
+ reti ; EXT_INT0
+ reti ; PCI0
+ reti ; PCI1
+ reti ; WATCHDOG
+ reti ; ICP1
+ reti ; OC1A
+ reti ; OC1B
+ reti ; OVF1
+ reti ; OC0A
+ reti ; OC0B
+ reti ; OVF0
+ reti ; ACI
+ reti ; ADCC
+ reti ; ERDY
+ reti ; USI_STR
+ reti ; USI_OVF
+
+
+devInfoBlock: ; 12 bytes
+devInfoManufacturer: .db 'A', 'Q', 'U', 'A'
+devInfoId: .db DEVICEINFO_ID, 0
+devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision
+firmwareVersion: .db FIRMWARE_VARIANT_BOOT, FIRMWARE_VERSION_MAJOR
+ .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
+
+firmwareStart: rjmp main ; will be overwritten when flashing
+
+
+
+; ***************************************************************************
+; main code
+
+
+.org BOOTLOADER_ADDR
+
+
+main:
+ rjmp bootLoader ; this routine is in modules/bootloader/main.asm
+
+
+
+; ***************************************************************************
+; includes
+
+.include "common/utils_wait_fixed.asm"
+.include "common/utils_copy_from_flash.asm"
+.include "common/utils_copy_sdram.asm"
+
+.include "modules/flash/defs.asm"
+.include "modules/flash/eeprom.asm"
+.include "modules/flash/io.asm"
+.include "modules/flash/io_com2w.asm"
+.include "modules/flash/flash1p.asm"
+.include "modules/flash/flashxp.asm"
+.include "modules/flash/flashprocess.asm"
+.include "modules/flash/wait.asm"
+.include "modules/bootloader/main.asm"
+.include "modules/network/msg/defs.asm"
+.include "modules/network/msg/crc.asm"
+
+;.include "common/debug.asm"
+
+
+
+systemSetSpeed:
+.if clock == 8000000
+ ldi r16, (1<
+
+
+
+
+
+
+ -I $(builddir)
+ -I $(srcdir)
+ -I $(topsrcdir)/avr
+ -I $(topbuilddir)/avr
+
+
+
+
+ main.asm
+
+
+
+
+
+
+
+
+
+
+
+ data.asm
+
+
+
+
+
+
diff --git a/avr/devices/n31/main/data.asm b/avr/devices/n31/main/data.asm
new file mode 100644
index 0000000..31ccc2f
--- /dev/null
+++ b/avr/devices/n31/main/data.asm
@@ -0,0 +1,14 @@
+; ***************************************************************************
+; copyright : (C) 2025 by Martin Preuss
+; email : martin@libchipcard.de
+;
+; ***************************************************************************
+; * This file is part of the project "AqHome". *
+; * Please see toplevel file COPYING of that project for license details. *
+; ***************************************************************************
+
+
+
+.dseg
+
+
diff --git a/avr/devices/n31/main/main.asm b/avr/devices/n31/main/main.asm
new file mode 100644
index 0000000..1e39c94
--- /dev/null
+++ b/avr/devices/n31/main/main.asm
@@ -0,0 +1,215 @@
+; ***************************************************************************
+; copyright : (C) 2026 by Martin Preuss
+; email : martin@libchipcard.de
+;
+; ***************************************************************************
+; * This file is part of the project "AqHome". *
+; * Please see toplevel file COPYING of that project for license details. *
+; ***************************************************************************
+
+
+
+
+; ***************************************************************************
+; Source file for temperature sensor node on AtTiny 84
+;
+; This is for the full system (i.e. not the boot loader).
+;
+; All definitions and changes should go into this file.
+;
+;
+; ***************************************************************************
+
+
+.equ clock=1000000 ; Define the clock frequency
+;.equ clock=8000000 ; Define the clock frequency
+
+
+
+.nolist
+.include "include/tn84def.inc" ; Define device ATtiny84
+.list
+
+.include "../defs.asm"
+.include "./data.asm"
+
+.include "version.asm"
+.include "devices/all/defs.asm"
+.include "common/calls.asm"
+.include "common/utils_io.asm"
+.include "common/utils_wait.asm"
+
+
+
+; ***************************************************************************
+; defines
+
+; ---------------------------------------------------------------------------
+; generic
+
+.equ NET_BUFFERS_NUM = 6
+.equ NET_MSGNUMINBUF_SIZE = 8 ; max buffer nums in ringbuffer (global incoming)
+.equ NET_IFACE_OUTMSGBUF_SIZE = 8 ; max buffer nums in ringbuffer (per interface outbound)
+
+
+
+
+; ---------------------------------------------------------------------------
+; firmware settings including list of modules used
+
+; #define MODULES_TIMER
+#define MODULES_CLOCK
+#define MODULES_LED_SIMPLE
+;#define MODULES_LED_ACTIVITY
+#define MODULES_NETWORK
+;#define MODULES_UART_BITBANG
+#define MODULES_COM2W
+#define MODULES_TWI_MASTER
+;#define MODULES_LCD
+;#define LCD_MINIMAL_FONT
+;#define MODULES_SI7021
+#define MODULES_SGP30
+;#define MODULES_SGP40
+;#define MODULES_STATS
+;#define MODULES_OWI_MASTER
+;#define MODULES_DS18B20
+;#define MODULES_MOTION
+;#define MODULES_CCS811
+;#define MODULES_BRIGHTNESS
+
+#define APPS_NETWORK
+;#define APPS_MOTION
+#define APPS_REPORTSENSORS
+#define APPS_STATS
+
+
+
+; ---------------------------------------------------------------------------
+; defines for values
+
+;.equ VALUE_ID_SGP40_TVOC = 0x08
+
+.equ VALUE_ID_SGP30_TVOC = 0x09
+.equ VALUE_ID_SGP30_CO2 = 0x0a
+
+
+
+
+
+; ***************************************************************************
+; code segment
+
+.cseg
+.org 000000
+
+
+
+; ---------------------------------------------------------------------------
+; Reset and interrupt vectors
+
+ rjmp BOOTLOADER_ADDR ; Reset vector ; use this for flashed system
+ reti ; EXT_INT0
+ rjmp com2wPcintIsr ; PCI0
+ reti ; PCI1
+ reti ; WATCHDOG
+ reti ; ICP1
+ reti ; OC1A
+ reti ; OC1B
+ reti ; OVF1
+ rjmp baseTimerIrqOC0A ; OC0A
+ reti ; OC0B
+ reti ; OVF0
+ reti ; ACI
+ reti ; ADCC
+ reti ; ERDY
+ reti ; USI_STR
+ reti ; USI_OVF
+
+
+devInfoBlock: ; 12 bytes
+devInfoManufacturer: .db 'A', 'Q', 'U', 'A'
+devInfoId: .db DEVICEINFO_ID, 0
+devInfoVersion: .db DEVICEINFO_VERSION, DEVICEINFO_REVISION ; version, revision
+firmwareVersion: .db FIRMWARE_VARIANT_TEMP_WINDOW, FIRMWARE_VERSION_MAJOR
+ .db FIRMWARE_VERSION_MINOR, FIRMWARE_VERSION_PATCHLEVEL
+
+
+
+; ---------------------------------------------------------------------------
+; @routine firmwareStart @global
+
+firmwareStart:
+ rjmp main
+; @end
+
+
+
+; ---------------------------------------------------------------------------
+; @routine onSystemStart
+
+onSystemStart:
+ ret
+; @end
+
+
+
+; ---------------------------------------------------------------------------
+; @routine onMessageReceived
+;
+; Called on every message received
+
+onMessageReceived:
+ clc
+ ret
+; @end
+
+
+
+; ---------------------------------------------------------------------------
+; @routine onEvery100ms
+;
+; Called every 100ms. Add your routine calls here. No arguments, no results.
+
+onEvery100ms:
+onEverySecond:
+onEveryMinute:
+onEveryHour:
+onEveryDay:
+ ret
+; @end
+
+
+
+; ---------------------------------------------------------------------------
+; @routine onEveryLoop
+;
+; Called on every loop (i.e. after awakening from sleep).
+;
+onEveryLoop:
+ ret
+; @end
+
+
+
+
+
+; ***************************************************************************
+; includes
+
+.include "devices/all/hw_tn84.asm"
+.include "devices/all/includes.asm"
+
+
+
+; ---------------------------------------------------------------------------
+; defines for network interface
+
+.equ netInterfaceData = com2w_iface
+
+
+
+deviceCodeEnd:
+ .if deviceCodeEnd >= BOOTLOADER_ADDR
+ .warning "Code reaches into boot loader!"
+ .endif
+
diff --git a/avr/devices/n31/n31-enclosure.stl b/avr/devices/n31/n31-enclosure.stl
new file mode 100644
index 0000000..e9e0de6
Binary files /dev/null and b/avr/devices/n31/n31-enclosure.stl differ
diff --git a/devices/nodes/0BUILD b/devices/nodes/0BUILD
index ef59e2d..3f026b8 100644
--- a/devices/nodes/0BUILD
+++ b/devices/nodes/0BUILD
@@ -27,6 +27,7 @@
aqua_n28.xml
aqua_n29.xml
aqua_n30.xml
+ aqua_n31.xml
aqua_r05.xml
aqua_r06.xml
aqua_s03.xml
diff --git a/devices/nodes/aqua_n31.xml b/devices/nodes/aqua_n31.xml
new file mode 100644
index 0000000..6a1353d
--- /dev/null
+++ b/devices/nodes/aqua_n31.xml
@@ -0,0 +1,12 @@
+
+
+ AQUA
+ N
+ 31
+
+
+
+
+
+
+