Numato IO™

Quick Start Guide: USB Numato IO™

46 views November 20, 2024 aryakrishna 0

Introduction

Numato Lab offers a range of GPIO modules designed to provide versatile, high-performance solutions for controlling and monitoring digital I/O. Available in various configurations, including different numbers of GPIOs and interface types like USB and Ethernet, these modules are ideal for applications in automation, testing, and device control. Each module is built to be easy to integrate, offering seamless communication and robust performance, ensuring reliability across a wide array of projects and industries. This documentation provides a comprehensive guide to getting started with the following modules:

Prerequisites

To follow this article, you would need the following:

  • Hardware:
    1. Numato Lab USB Pluggable GPIO (Numato IO™)
    2. USB B cable or USB Mini B cable according to the module (Refer user manual)
  • Software:
    1. Numato Lab USB CDC Driver
    2. Tera Term
      or
    3. Any serial terminal emulator like PuTTY

Let’s get started

The following steps guide you through connecting the module to your PC and establishing communication with it.

Step 1:

Download and install Numato Lab USB CDC Driver from here. Follow the instructions in the provided documentation to complete the installation.

Step 2:

Connect the module to your PC using the USB cable. Open the Device Manager and note the assigned COM Port number.
COM Port Number

Step 3:

Launch Tera Term or any serial terminal emulator (such as PuTTY), and connect to the module using the noted COM Port.
TeraTerm Connection

Step 4:

Once connected, you will be prompted with a screen to send commands and view the outputs.
TeraTerm screen

Numato IO™ Generic Command Set

One of the key strengths of this module is its user-friendly command set, which streamlines interaction by abstracting the complexities of the USB protocol. This intuitive interface enables straightforward access to the module’s features. The following sections provide a detailed overview of the command set which is common for the Numato IO™ modules and guidance on its effective usage.

No.CommandParametersUsageDescription
1gpioset xxxgpio set 000Control the GPIOs
clear xxxgpio clear 000Control the GPIOs
read xxxgpio read 000Read GPIO Input status
status xxxgpio status 000Read GPIO status
readallgpio readallRead all GPIO status at a time
writeall xxxxxxxxgpio writeall ffffffffControl all GPIOs at a time
iomask xxxxxxxxgpio iomask ffffffffControl GPIOs mask status
iodir xxxxxxxxgpio iodir 00000000Control GPIOs direction
notify on
notify off
gpio notify on
gpio notify off
Control Notify feature
notify getgpio notify getRead Notify Status
poweron xxxxxxxx xxxxxxxxgpio poweron 00000000 ffffffffControl GPIO Power-On IO direction & status respectively
2adcread xxxadc read 000Read Analog to Digital Converter input value
3relayon xxxrelay on 000Control the relays
off xxxrelay off 000Control the relays
read xxxrelay read 000Read relay status
readallrelay readallRead all relays status at a time
writeall xxxxxxxxrelay writeall ffffffffControl all relays at a time
poweron xxxxxxxxrelay poweron ffffffffControl relay poweron status at a time
The number of characters represented by x in commands such as gpio writeall, gpio iomask, gpio iodir, and gpio poweron depends on the number of GPIO channels available on the module.

Example:

  • For an 8-channel module: gpio writeall xx
  • For a 16-channel module: gpio writeall xxxx
  • For a 32-channel module: gpio writeall xxxxxxxx
  • For a 64-channel module: gpio writeall xxxxxxxxxxxxxxxx

 

The xxx in commands such as gpio set, gpio clear, gpio read, gpio status, adc read, relay on, relay off, and relay read represents the channel number. The range of these numbers depends on the number of GPIO or relay channels available on the module.

For instance:

  • On an 8-channel GPIO module, the range is 000 - 007.
  • On a 16-channel GPIO module, the range is 000 - 015.
  • On a 32-channel GPIO module, the range is 000 - 031.

relay commands are applicable only for the following modules :

The table below provides a detailed overview of the command patterns and their descriptions.

No.CommandUsageDescription
1gpiogpio set xxxSets GPIO ‘xxx’ output status to high.

gpio set 000 – Sets IO0 to high state
xxx can be 000 – 031 (according to the module)
gpio clear xxxSets GPIO ‘xxx’ output status to low.

gpio clear 000 – Sets IO0 to low state
xxx can be 000 – 031 (according to the module)
gpio read xxxRead the input status present at ‘xxx’.

gpio read 007 – Read input status of IO7 and print either ‘1’ or ‘0’ depending on the status
xxx can be 000 – 031 (according to the module)
gpio status xxxRead the GPIO status present at ‘xxx’ without changing the GPIO to inputs.

gpio status 007 – Read status of IO7 and print either ‘1’ or ‘0’ depending on the status
xxx = 000 to 031 (according to the module)
gpio iomask xxxxxxxxMasks/Unmasks all GPIOs in a single operation.
gpio iomask ffff0000 – Masks and/or unmasks GPIO at each bit position according to the bits of the specified hexadecimal value.
0 – To mask the GPIO & 1 – To unmask the GPIO.
‘ffff0000’ – 1111 1111 1111 1111 0000 0000 0000 0000: Masks GPIOs 0 – 15 & unmasks GPIOs 16 - 31.
gpio iodir xxxxxxxxSets direction of all GPIOs as Input/output mode in a single operation.
gpio iodir 0000540f – Sets GPIOs as input/output at each bit position according to the bits of the specified hexadecimal value.
0 – To set the GPIO as output mode & 1 – To set the GPIO as input mode.
‘0000540f’ – 0000 0000 0000 0000 0101 0100 0000 1111:
Sets GPIO 0,1,2,3,10,12 & 13 as input mode
Sets GPIO 4,5,6,7,8,9,11,13,15,16-30 & 31 as output mode.
gpio readallRead status of all GPIOs in single operation.
gpio readall – Read all GPIO status and print xxxxxxxx.
xxxxxxxx is a hexadecimal value, with binary 1 at positions for GPIOs in HIGH and 0 for GPIOs in LOW state.
gpio writeall xxxxxxxxControl all GPIOs in single operation.
Gpio writeall ffff67a4 – Sets and clears GPIO at each bit position according to the bits of the specified hexadecimal value.
0 – To clear the GPIO & 1 – To set the GPIO
‘ffff67a4’ – 1111 1111 1111 1111 0110 0111 1010 0100:
Sets GPIO 2,5,7,8,9,10,13-14,16-30 & 31
Clears GPIO 0,1,4,6,11,12 & 15.
Refer Understanding readall/writeall commands for GPIO Modules to know more.
gpio notify onThis command enables the gpio input change notification. When the gpio notify feature is enabled, changes to the input pins will be detected and a notification is sent to the host.
To use notify feature on a GPIO, the GPIO must be set to input mode by using “gpio iodir” command.
The GPIO change notification is sent to the host is in the below format.

If GPIO change notification is “FFFFFFFE FFFFFFFF FFFFFFFF”, then
1. Current IODIR value is FFFFFFFF which means all GPIOs are set to input mode.
2. Previous GPIO values are FFFFFFFF.
3. Current GPIO values are FFFFFFFE.
The GPIO 0 value is changed from logic 1 to 0. This change triggered the device to send this notification.
gpio notify offThis command disables the gpio input change notification feature.
gpio notify getReturns whether Notify feature is enabled or disabled.
gpio poweron xxxxxxxx xxxxxxxxThis command is to control Power-On GPIO Direction and status in a single operation.
gpio poweron ffff0000 000011c5 – Sets GPIOs IO direction and status respectively at each bit position according to the bits of the specified hexadecimal value.
IO direction: 0 – To set the GPIO as output mode & 1 – To set the GPIO as input mode.
IO status: 0 - To clear the GPIO & 1 - To set the GPIO.
‘ffff0000 000011c5’- (1111 1111 1111 1111 0000 0000 0000 0000) (0000 0000 0000 0000 0001 0001 1100 0101):
GPIOs 0-15 are set to output mode & GPIOs 16-31 are set as input mode.
GPIO 0,2,6,7,8 & 12 are set to High
GPIO 1,3,4,5,9-11,13-14 & 15 are set to Low.
2adcadc read xxxReads the analog voltage present at the ADC input mentioned. “xxx” stands for the number of ADC input. The response will be a number that ranges from 0 – 1023. Please see examples below.
adc read 000 – Reads analog input 0
adc read 004 – Reads analog input 4
xxx can be 000 to 006 (according to the module)
3relayrelay on xxxTurns a particular relay on. The parameter “x“ stands for the relay number. The relay number starts from zero. See some examples below.
relay on 000 – Turns on relay 0
relay on 001 – Turns on relay 1
relay on 031 - Turns on relay 31
relay off xxxTurns a particular relay off. The parameter “x“ stands for the relay number. The relay number starts from zero. See some examples below.
relay off 000 – Turns off relay 0
relay off 001 – Turns off relay 1
relay off 031 - Turns off relay 31
relay read xxxReturns the status of a particular relay. The parameter “x“ stands for the relay number. The relay number starts from zero. See some examples below.
relay read 000 – Returns status of relay 0
relay read 031 – Returns status of relay 31
The data returned in response to this command will be either “on” or “off” depending on the current status of the relay.
relay readallReads the status of all relays in a single operation. The return value will be a hexadecimal number with binary value 1 at bit positions for relays in ON state and 0 for relays in OFF state. Eg: a return value 00000000 (binary 0000 0000 0000 0000 0000 0000 0000 0000) means all relays are OFF. A value FFFFFFFF (binary 1111 1111 1111 1111 1111 1111 1111 1111) means all relays are ON.
relay readall – Returns status of all relays
Refer Understanding readall/writeall commands for Relay Modules to know more.
relay writeall xxxxxxxxControl all relays in a single operation. A hexadecimal value must be specified with desired bit positions set to 0 or 1. A value 0 at a bit position will turn off the corresponding relay. A value 1 at a bit position will turn on the corresponding relay.
relay writeall ffffffff – Turns on all relays
Refer Understanding readall/writeall commands for Relay Modules to know more.
relay poweron xxxxxxxxThis command is to control the relay status in a single operation.
Eg. relay poweron ffff0000
Relays 0 - 15 are in off state and relays 16 -31 are in on state after the poweron.

The image below is an example of  how to send commands to the module using Tera Term. It shows the interaction process and the corresponding responses from the module.
Sending Commands

Was this helpful?

Leave A Comment
*
*