Edge Detection using the 2-Wire Accessory

Tip: There is a small recess inside the Soracom LTE-M Button for storing the accessory port cover so that you don't lose it.

The Edge Detection external I/O mode allows you to connect your own circuit to the Soracom LTE-M Button using the 2-wire accessory in order to electronically trigger messages using external inputs.

In this mode, the button will detect the state of the connected circuit, opened (disconnected) or closed (connected), and send a message each time the state changes.

If you want your circuit to trigger on press-and-release clicks, use the Pulse Detection mode instead.

You can easily test this by connecting the included 2-wire accessory to the external I/O accessory port, then touching the two exposed wires together. You should see the LED start blinking green, indicating that the Soracom LTE-M Button has detected the change in the circuit and is now connecting to a cellular network. Releasing the two exposed wires will also trigger another event.

As an example, you can connect a magnetic reed switch sensor that detects the opened or closed state of a door. Opening the door will trigger the button to send an Event message or an Alert message, and closing the door will similarly trigger another message.

Example using Edge Detection

Important! The Soracom LTE-M Button provides its own voltage in order to detect whether the circuit is open or closed. The 2-wire accessory must not be connected directly to an external power source. Doing so may permanently damage the button.

There are many other types of sensors or circuits that can be used with Edge Detection, such as a pressure pad to detect when someone is standing on a particular area, or when a vehicle is driving over a specific location. You can also use a relay switch to connect other electronics, such as using an Arduino or Raspberry Pi with other sensors to trigger the relay.

Behavior

When configured for Edge Detection, the Soracom LTE-M Button will apply a small voltage to the external I/O. Each time the button detects a change in the voltage, it will send a message:

Edge Detection trigger behavior

When the operation mode is configured as Alert or Alert + Heartbeat, the button will send an Alert message.

Detect Types

The message sent by the button will indicate the type of change it detected:

These detect types correspond specifically to the state of the connected circuit and therefore depend on your circuit design. For example, relay switches are available in two basic types: NC (Normally Closed) and NO (Normally Open), representing the default state of the switch when not energized. Though they both provide the same function, the state of the circuit detected by the Soracom LTE-M Button will be reversed, resulting in reversed detect types.

Due to a bug in firmware version 2220, the Falling edge and Rising edge detect types were implemented in reverse. To avoid disrupting existing applications, this behavior has not been changed.

This bug was fixed in version 3134. As a result, if your application requires distinguishing between Falling edge and Rising edge detect types, you will need to adjust your application logic accordingly.

Debounce

Due to the physical limitations of mechanical switches and sensors, the change in voltage detected by the Soracom LTE-M Button will often bounce up and down before settling (also called "noise"), which may result in multiple messages being triggered. You can apply a debounce in order to allow the change in voltage to settle and avoid interpreting the noise as individual triggers.

Although enabling debounce will reduce unwanted triggers, incorrect detections may still occur due to inconsistent or noisy signals caused by loose wiring, faulty switches, or other circuit component issues.

In addition, the button may occasionally detect the Falling edge or Rising edge type in reverse due to uncontrollable inconsistencies in the measured voltage changes.

Timer message

When the operation mode is configured as Timer or Event + Timer, the button will count the number of edge detections. However, unlike the Event message where the Falling edge or Rising edge detect types are reported, the Timer message will only report the total number of edge detections without differentiating one type from another.

Configuration

Edge Detection can be enabled in any operation mode.

  1. Follow the Configuration instructions for configuring Soracom LTE-M Button settings.

  2. When prompted, select Edge Detection for the external I/O mode, and select whether or not to enable debounce:

    Select Edge Detection

After configuring Soracom LTE-M Button settings, follow the instructions to sync your button.

Pin Assignment

The 2-wire accessory can be used to connect an external switch or circuit to the button. You can also prepare your own connector using a standard 3.5mm TRRS plug with the following connections:

TRRS pin assignment

Pin Connection
Tip (T)
Ring 1 (R) Sensor interrupt
Ring 2 (R)
Sleeve (S) GND