XN02 - Digital Outputs

XN02 - Digital Outputs

X-NODE Digital Outputs is a module that allows you to generate up to 8 digital signals that can be used to control actuators, relay modules, parallel interfaces such as LCD screens, multiplexers, etc., through a configurable digital interface (UART/I2C) that allows you to connect multiple X-NODE Digital Outputs simultaneously, expanding the number of outputs a system can generate from 8 up to 1016.

TABLE OF CONTENTS

I. How does it work?

The X-NODE Digital Outputs module has an integrated hardware controller that allows you to generate logic signals (3.3VDC TTL) without advanced hardware knowledge, as you only need to send a series of commands in ASCII format via the UART serial communication protocol or using the I2C protocol, this makes the X-NODE able to communicate with any system based on a microcontroller, microprocessor, or industrial equipment. The module integrates 8 green LEDs as indicators and a connection port with 8 outputs and GND. The LEDs have a wide viewing angle, a dissipation of 40 mW, a current flow of 20 mA, and can operate in a temperature range from 0 °C to 80 °C. These can be used as general purpose indicators to visualize the status of different devices, alerts, or sequences. The 9 pin terminal block connector allows you to send signals to other components such as relay modules, parallel interfaces like LCD screens, multiplexers, etc.

X-NODE Digital Outputs is compatible with the mikroBUS™ standard from Mikroe® for easy use with a large ecosystem of hardware development kits. It also has JST connectors compatible with the Qwiic® standard from SparkFun® for quick and easy communication between various modules and development boards via the I2C protocol.

II. Hardware Description

  1. 9 pin terminal block connector for AWG wires from 26 to 18 gauge.

  2. LED indicators

  3. JST connectors compatible with Qwiic®

  4. Hardware controller

  5. UART <> I2C communication ports

  6. X-NODE model

  7. X-NODE type

  8. Standard mikroBUS™ connectors

  9. Hardware version: R2

  10. Main component in the X-NODE

III. Specifications

Applications

Integration with IoT projects where digital signals are required, such as actuators or indicators control. Also where a series of LED indicators is needed to visualize the status of different devices, alarms, or sequences.

Features

LED indicators with a wide viewing angle, 40 mW dissipation, continuous current flow of 20 mA with a peak of 40 mA, and operation in a temperature range from 0 °C to 80 °C. Terminal block connector for 8 external outputs and GND.

Interface

UART, I2C

Compatibility

mikroBUS™ standard and Qwiic® standard

Size

67.15 x 25.38 x 22 mm

Voltage

3.3 V

IV. Pinout

The following table shows the pinout of the X-NODE Digital Outputs according to the mikroBUS™ standard (shown in the two center columns).

V. Usage

For easy and quick use of the X-NODE, you can use the ASCII commands provided by the integrated hardware controller via UART serial communication or more advanced use via the I2C protocol.

UART Protocol

Configuration

UART communication uses the following configuration:

  • Baud rate: 115,200 bps

  • Parity: None

  • Data bits: 8

  • Stop bits: 1

Syntax

The UART protocol allows you to send instructions in plain ASCII text. Each instruction consists of the X-NODE identifier, a command, and a line ending.

Identifier

The ID identifier consists of the X-NODE model, which can be found in point 6 of the Hardware Description section, and is complemented by an index, which can be a letter from A to Z. By default, it is the letter A. To connect more than one module of the same model in a system, you must configure a unique identifier for each module, allowing up to 26 modules of the same model to be connected via the UART protocol.

Command List

XN02A?

Checks if communication was established successfully. Response: OK

XN02A+V

Gets the current firmware version integrated in the X-NODE. Response: XN02A=Version Example: XN02A=2.0.0

XN02A+ID=(A-Z)

Changes the ID index to a different uppercase letter from A to Z. Once changed, to change it again you must use the ID with the new index. Response: OK Example: XN02C+ID=H

XN02A+TW=(1-126)

Changes the factory I2C address to a different one. The new address is written in decimal, selecting a value from 1 to 126. Response: OK Example: XN02A+TW=28

XN02A+SO=(Out1)(Out2)(Out3)(Out4)(Out5)(Out6)(Out7)(Out8)

Changes the state of each of the 8 digital outputs, either on the LED indicators or the port, with two options: 1 (High) and 0 (Low). Output 1 is the first value on the left, interpreted from left to right. Response: OK Example: XN02A+SO=11001100

Advanced Commands

XN02A+ETW=(0-1)

Enables (1) or disables (0) the device's I2C interface. Note: This configuration is volatile, disconnecting the device from power or sending the reset command will restore the I2C interface. Response: OK Example: XN02A+ETW=0

XN02A+SLP

Enables deep sleep mode to reduce power consumption. During deep sleep, the device will not respond to UART commands. To wake the device, send a logic low (0) to the WAKEUP/UPDI pin. Response: OK Example: XN02A+SLP

XN02A+RST

Resets the device, non-volatile values (e.g., ID, I2C address) will be retained, and volatile values will return to their default configuration. Response: OK

Line Ending

The X-NODE will only respond to a command when a set of end-of-line characters are sent, each command must end with these characters: <CR+LF>

  • CR means carriage return.

  • LF means line feed.

The combination of both characters is a common way computers represent a new line, for example, in a word processor to separate paragraphs.

For the X-NODE, the <CR+LF> characters are used to identify when a command has finished being sent. If the identifier matches the node, if the command exists, and if it is immediately followed by the <CR+LF> characters, then the node will send a response.

Depending on your system, you must configure the sending of these characters in different ways.

UART Arduino Framework Example

Example code for the XC01 - R5. Check the manual to use our XC01 - R5 in Arduino IDE/PlatformIO

// This example shows how to control the outputs
// of the X-NODE by implementing a binary counter.

#include "Arduino.h"

// Sends a fixed-length binary sequence
// (most significant bit first) of 8 bits
void printBinary(uint8_t num) {
  for (int i = 0; i < 8; i++) {
    Serial2.print((num >> i) & 0x01);
  }
  // The println function sends the <CR+LF> characters
  Serial2.println();
}

void setup() {
  // Initialize the serial monitor
  Serial.begin(115200);

  // Initialize UART communication on the MikroBUS port
  Serial2.begin(115200, SERIAL_8N1, 9, 10);
}

void loop() {
  // Generate a binary counter with the XN02 LEDs
  for (uint16_t binary_counter = 0; binary_counter < 256; binary_counter++) {

    // Clear the buffer
    if (Serial2.available()) {
      Serial2.read();
    }
    
    // Send the command
    Serial2.print("XN02A+S=");
    printBinary(binary_counter);

    String success = Serial2.readStringUntil('\n');

    // Check if the operation was successful
    if ( !success.startsWith("OK") ) {
      Serial.println( "Error" );
      delay( 1000 );
      return;
    }

    delay(100);
  }

  delay(1000);
}

I2C Protocol

To establish communication, you must know the I2C address of the X-NODE. The factory value consists of the last two digits of the model after "XN". I2C addresses are usually represented in hexadecimal, while the X-NODE model is in decimal, make sure to use the correct number system.

Configuration

  • Communication speed: 100 kHz

  • Address: 7 bits

Note: Make sure you do not have another device with the same address on the I2C BUS. If so, remember that the X-NODE can change its I2C address with the command XN02A+TW=(1-126).

Writing

To write to a register of the X-NODE Digital Inputs, the I2C controller must perform the following operations:

  1. Send a start condition: The controller generates a logic low (0) on the SDA pin while SCL remains high (1).

  2. Send the X-NODE address: The controller sends the 7-bit address.

  3. Send the operation type: The controller indicates whether the operation is read (0) or write (1).

  4. Wait for an acknowledgment (ACK) signal: The controller waits to receive a logic low (0) as confirmation (Acknowledgment) that a target with the previously sent address exists on the I2C BUS. If no response (1) is received, it means there was a communication error or the address is incorrect.

  5. Write n bytes of data: The controller will write in sequences of 8 bits (1 byte) and in order from the most significant bit first (MSB) as many bytes as it wants to write to the register. The target will send an acknowledgment (ACK) signal for each byte correctly written.

  6. Send a stop condition: The controller must release the I2C BUS by generating a logic high (1) on the SDA pin while SCL is high (1).

Reading

To read from a register of the X-NODE Digital Inputs, the I2C controller must perform the following operations:

  1. Send a start condition: The controller generates a logic low (0) on the SDA pin while SCL remains high (1).

  2. Send the X-NODE address: The controller sends the 7-bit address.

  3. Send the operation type: The controller indicates whether the operation is read (0) or write (1).

  4. Wait for an acknowledgment (ACK) signal: The controller waits to receive a logic low (0) as confirmation (Acknowledgment) that a target with the previously sent address exists on the I2C BUS. If no response (1) is received, it means there was a communication error or the address is incorrect.

  5. Read n bytes of data: The target will send sequences of 8 bits (1 byte) and in order from the most significant bit first (MSB) as many bytes as needed. Upon receiving a byte, the controller must generate an acknowledgment (ACK) signal to request 1 more byte, or a not acknowledged (NACK) signal to indicate that the transmission has ended and request the target to release the BUS.

  6. Send a stop condition: The controller must release the I2C BUS by generating a logic high (1) on the SDA pin while SCL is high (1).

Register List

Register
Address (hexadecimal)
Type
No. Bytes
Description

OUTPUT

0x01

R/W

1

Each bit represents a logic state of an output, where the most significant bit (the one received first) corresponds to the state of output O8, following an order from highest to lowest.

STAT

0x37

R

1

XNODE status, 0x00 if there are no errors, any other value means communication error.

FW

0x38

R

3

Firmware version, in major, minor, and patch: 0x02.0x00.0x00

UART_ID

0x39

R/W - NV

1

Allows reading and writing the ID index to a different letter from A (0x41) to Z (0x5A)

TW_ADD

0x3A

R/W - NV

1

Allows reading and writing the device's I2C address to a different one from 1 (0x01) to 126 (0x7D). A reset or power-on sequence must happen for this changes to be applied

UART_EN

0x3B

W

1

Enables (0x01) or disables (0x00) the device's UART interface.

SLEEP

0x3C

W

1

Enables (0x01) or disables (0x00) the device's deep sleep, the device will wake up if the controller writes the device's I2C address on the BUS.

RESET

0x3D

W

1

Writing 0x01 resets the device.

WHO_AM_I

0x3E

R

2

The first byte is the XNODE model, the second byte is the hardware revision.

Non-volatile Registers (NV)

Non-volatile registers are stored in the device's EEPROM memory, meaning they will retain the values written to them even if the device is powered off.

OUTPUT Register Structure:

I2C Arduino Framework Example

Example code for the XC01 - R5. Check the manual to use our XC01 - R5 in Arduino IDE/PlatformIO

// This example shows how to control the outputs
// of the X-NODE by implementing a binary counter.

#include <Arduino.h>
#include <Wire.h>

void setup() {
  // Initialize the serial monitor
  Serial.begin(115200);

  // Configure the I2C communication pins
  Wire.setPins(12, 13);
  // Initialize I2C communication
  Wire.begin();
}

void loop() {
  // Generate a binary counter with the XN02 LEDs
  for (uint16_t binary_counter = 0; binary_counter < 256; binary_counter++) {

    // Write to the register
    Wire.beginTransmission(0x02);
    // Select the register
    Wire.write(0x01);
    // Write the state of each output
    Wire.write(binary_counter);

    // Check if the operation was successful
    if (Wire.endTransmission() != 0) {
      Serial.println("Error");
      delay(1000);
      return;
    }

    delay(100);
  }

  delay(1000);
}

VI. Downloads

Last updated