NIS Generic Magnetic Switch Protocol

From nemeuswiki
Jump to: navigation, search

1 Generic Magnetic Switch Protocol description

Nemeus sensors embed a magnetic switch and a green LED to implement a simple man to machine interface.

The LED blinks every second while the magnet is present.

If the magnet is present during 20 seconds, it triggers an hardware reset.

The 20 seconds range has been cut in 10 timeslots of 2 seconds, the actions performed for each timeslot (TSX) are the following:

  • 0s <= TS1 < 2s: read current state, number of led blinks indicates the following states:
    • 1 blink: standby mode
    • 2 blinks: joint with LoRaWAN network only (Sigfox is disabled)
    • 3 blinks: Sigfox enabled only (no LoRaWAN)
    • 4 blinks: joint with LoRaWAN network and Sigfox is enabled
    • 6 blinks: joining LoRaWAN network (no Sigfox)
    • 8 blinks: joining LoRaWAN network and Sigfox is enabled
    • 9 blinks: measures are ongoing but transmission is forbidden
  • 2s <= TS2 < 4s: switch to normal mode (if not already in normal mode) or force one measure and one Tx (if already in normal mode)
  • 4s <= TS3 < 6s: switch to standby mode, it is the default mode when the device is stored and not yet activated
  • 6s <= TS4 < 8s: perform a warm reset, the device resets and goes back to its previous mode
  • 8s <= TS5 < 10s: forbid transmission, the device still performs measures but never transmit them
  • 10s <= TS6 < 12s: switch to test mode, the device suspends the measures and forbid transmission, then it switches to continuous Rx on a specific channel and wait for test mode commands, if nothing is received after 60 seconds then it goes back to its previous mode. During test mode the led blinks and the magnetic switch is disabled.
  • 12s <= TS7 < 14s: no action
  • 14s <= TS8 < 16s: no action
  • 16s <= TS9 < 18s: no action
  • 18s <= TS10 < 20s: no action
  • 20s <= TSHw: hardware reset

When the magnet is removed, the LED blinks fast X times, X identifies the timeslot (1 to 10).


1.1 Standby mode

It is the default mode set in factory, the device does nothing and consumes few µA (consumption depends on the sensor type).


1.2 Normal mode

The first time the device switches to normal mode, it performs the join procedure with the LoRaWAN network.

Then it performs a first measure and transmits it to the network whatever the number of measures required to trigger a transmission.

Finally it performs measures according to the configured period and transmits them according to configured number of measures required to trigger a transmission.


1.3 Forbid transmission mode

In this mode the device performs measures according to the configured period but never transmits them to the LoRaWAN network. This mode is mainly used in R&D phase to tune the measure algorithm, it shouldn’t be used when the device is deployed.


1.4 Test mode

This mode is used to modify the device configuration over the air using a Nemeus tool, this tool must be in the vicinity of the device. A security key is used to authenticate the Nemeus tool and the device.


1.5 Warm reset

The warm reset restarts the device and put it in its previous state. For example, if the device was joining the network, it restarts its join procedure. If it was already joint and performing periodic measures then it transmits the first measure and restarts the periodic measures.