Ethernet GPIO Modules

32 Channel Ethernet GPIO Module With Analog Inputs

1616 views February 18, 2016 admin 0

Introduction

32 Channel Ethernet GPIO Module

Numato Lab’s 32 Channel Ethernet GPIO Module is a versatile product for controlling electrical and electronic devices remotely from a PC over Ethernet link. Ease of use and wider operating system compatibility are the primary goals behind this product’s design. This simplicity allows the use of off-the-shelf Terminal Emulation programs such as HyperTerminal and TeraTerm for controlling the module with a simple set of human-readable commands through Telnet/Web page. For power users, this module can be controlled by writing programs in various programming languages.

Features:

  • 32 TTL (3.3V) compatible GPIOs
  • 14 analog inputs with 10-bit resolution (multiplexed with Digital IOs)
  • Microcontroller: Microchip PIC18F97J60(1-Mbit Flash Microcontroller with 10Mbps Ethernet communication peripheral).
  • Memory: Microchip 25LC1024 serial EEPROM provides 1024 Kbits of storage for both web pages and nonvolatile configuration options.
  • MAC Address: Separate Serial EEPROM(24AA02E48) with Globally Unique value used as MAC Address.
  • Reset Jumper: To reset the firmware of board to factory defaults.
  • The password-protected Web console and Telnet communication interface.
  • LED indication for Power.

Some of the possible uses of this module include:

  • Home Automation
  • Lighting Control
  • Garden Equipment Control
  • Industrial Automation
  • Test Fixtures
  • DIY and Hobby

How to use the module

The following section describes how to use this module.

Components/Tools required

Along with the module, you may need the items in the list below for easy and fast installation.

  1. CAT 5e Ethernet Cable(Straight through cable)
  2. 7-12V 1A DC power supply
  3. Medium size Philips screwdriver

The above image shows the basic connection diagram that can be used in most of the situations. Use a Straight Through Ethernet cable for communication when connecting the board to a switch or router. A Crossover Ethernet Cable may be required in some situations if connecting directly to a PC/Laptop port.

The following sections identify individual connections in detail.

USB Interface

The onboard USB Interface helps a PC/Linux/computer to communicate and configure this module seamlessly. This module detects as COM port and the user can configure the module using any serial emulator program like hyper terminal, Teraterm, etc. Use FTDI drivers for the USB COM port device.

Use a USB A to micro USB cable to connect to a PC. Please visit numato.com to buy cables and accessories for this product.

Ethernet Interface

32 Channel Ethernet GPIO Module Ethernet PortThe onboard Ethernet port supports Ethernet 10 Mbps transmission speed that helps a computer to communicate and control this module easily. There are two basic network configurations for this board/can be used in two ways.

 

  1. Direct connection to Local Area Network(LAN) via common straight-through Ethernet cable.
    Eg: Connecting the module to a switch in a network.
  2. Direct connection to a PC through a cross over Ethernet cable. Eg: Connecting the module directly to the PC. Some PC/Laptops can detect and adapt to the cable type. In such situations, a straight-through cable also can be used.

DC Power Supply

DC Power SupplyThis board can be operated with a single DC power supply. Use a 7-12V 1A DC power supply on DC jack(J1/Vin) on the Board for the logic circuit.

Connecting power supply incorrectly can cause damage to the module and/or other devices.

Factory Reset

This Jumper is used to reset the settings onboard to factory defaults. To execute the factory reset, please follow the steps below.

1. Power off the device.
2. Configure the FACT RESET Jumper to 2-3.
3. Power on the device.
4. Wait for 15-20 sec until the LED D2 onboard turns on.
5. Configure the FACT RESET Jumper back to 1-2.
6. Power off the board and back on.

Below steps are applicable only for hardware version 3( with USB Micro Connector) and firmware version 5

7. Connect the USB Cable.
8. Using any serial emulation software connects to the COM Port and ENTER.
9. Login using the config user name and password as “admin” and send a “reboot” command.
10. LED D2 will turn off and you can see the Config details in the terminal.

Please use this feature only for recovering the User name / Password. This action will reset User name, Password, Device ID and also other settings as well. After reset, the board can be accessed using the default User name and Password.

The factory default settings will be as below table.

User nameadmin
Passwordadmin
Config user nameadmin
Config Passwordadmin
Device ID00000000
IP Address169.254.1.1
Telnet AuthenticationON
Telnet Port23
Access IPDisabled
IP0 to IP9255.255.255.255
Access MACDisabled
MAC0 to MAC9FF FF FF FF FF FF
DHCP Status Enabled

GPIO/Analog inputs

32 Channel Ethernet GPIO Analog inputs

The module has 32 General Purpose IO pins that can be used for various custom applications. Some of these pins can be used as Analog to Digital Converter inputs as well. All IO pins support 3.3V TTL signals and the ADC input range is 0 to +3.3V. The ADC can acquire analog signals at the resolution of 10 bits per sample. It is recommended to use a series resistor with the GPIO/ADC pins when interfacing with other circuits. In output mode, GPIOs can source up to 25mA (IO source/sink capacity varies depending on IO. Please refer to the Technical Specifications at the end of this document for more details). So no additional circuitry is needed to drive regular LEDs. A 470 Ohms series resistor is recommended for current limiting when connecting LED to a GPIO.

In contrast to GPIOs, Analog inputs can read voltages at any level between 0 to 3.3V volts. It is recommended to use a series resistor to protect the input from stray voltages and spikes. The internal Analog to Digital converter supports 10 bits resolution which is adequate for most applications. The table below summarizes the GPIO and Analog to Digital Converter input positions on the Screw terminals.

GPIOADC
IO0 ADC0
IO1ADC1
IO2ADC2
IO3ADC3
IO4ADC4
IO5ADC5
IO6ADC6
IO7ADC7
GNDGND
IO8 ADC8
IO9ADC9
IO10ADC10
IO11ADC11
IO12ADC12
IO13ADC13
IO14NA
IO15NA
GNDGND
IO16NA
IO17NA
IO18NA
IO19NA
IO20NA
IO21NA
IO22NA
IO23NA
GNDGND
IO24NA
IO25NA
IO26NA
IO27NA
IO28NA
IO29NA
IO30NA
IO31NA

Configure 32 Channel Ethernet GPIO

Connect a DC power supply and power up the device as mentioned DC Power Supply section above. A red LED (D1) will glow which indicates active power. For configuration over USB connect a USB Micro cable to the module also connect the module to a PC or a Switch/Router as mentioned in the Ethernet Interface section above. Run the hyper terminal program or any serial terminal program like TeraTerm, PuTTY, etc.

NB: By default, the module is configured with factory settings. To login to USB configuration settings, users need to send a reboot command from telnet or do a factory reset.

Connect the Module COM port and use the default settings as similar to the below images.

Users will be prompted to enter the User name and Password. The default User name and Password is ‘admin‘. You may change the User name and Password once logged in.

If the user name and password are correct, we will be able to see the login successfully message.

Configuration Command Set

No. Command Example Description
1usrusr set xxxxxxxxSets the new username for telnet, where x can be any alphanumeric character. The username can be 1-8 characters long.
usr getRead the current username of telnet. The default username is "admin".
2pass
pass set xxxxxxxx
Sets the new password for telnet, where x can be any alphanumeric character. The password can be 1-8 characters long.
pass get

Read the current password of telnet. The default password is "admin".
3config usrconfig usr set xxxxxxxxSets the new username for configuration over USB, where x can be any alphanumeric character. The username can be 1-8 characters long.
config usr getRead the current username of configuration over USB. The default username is "admin".
4config pass config pass set xxxxxxxxSets the new password for configuration over USB, where x can be any alphanumeric character. The password can be 1-8 characters long.
config pass getRead the current password for configuration over USB. The default password is "admin".
5telnettelnet auth on/offEnable and disable the telnet authentication. telnet auth on enabling the telnet authentication and telnet off disabling the telnet authentication.
telnet auth getRead the status of telnet authentication.
telnet port set xx
Sets the telnet port, where xx can be in the range of 00 to 99. The default value of telnet port is 23.
6accessaccess ip on/offEnable or disabling the IP based access to the module, this command adds filtering. Once the command is enabled, the stored IP using the access ip set command will be able to access the module. By default access IP is disabled.
access ip set N xxx.xxx.xxx.xxxSet the acceptable IP in the network and save the same. Where N is the number 0-9, maximum 10 IP we can store in the non-volatile memory.
Eg: access ip set 0 192.168.0. 2
access ip getRead the stored IP in the memory.
access mac on/offEnable or disabling the MAC-based access to the module, this command adds filtering. Once the command is enabled, the stored MAC using the access mac set command will be able to access the module. By default access MAC is disabled
access mac set N XX XX XX XX XX XXSet the acceptable MAC in the network and save the same. Where N is the number 0-9, maximum 10 MAC we can store in the non-volatile memory.
Eg: access mac set 0 D4 93 98 D2 4A 34
access mac getReads the stored MAC in the memory.
7dhcpdhcp on/offEnable or disable the DHCP of the module.
8ipip set xxx.xxx.xxx.xxxSets the static IP to the module.
Eg: ip set 192.168.5.48
ip getRead the status of DHCP and the static IP. If DHCP is enabled it will display the DHCP status and if it is disabled it will display the static IP too
9mac id getmac id getRead the MAC id of the module.
10rebootrebootExit the configuration interface and enter to the application mode and start the telnet communication.

Configuration Command Images

Example commands and results after executing the commands.

 

 

Powering Up 32 Channel Ethernet GPIO module

Connect a DC power supply and power up the device as mentioned DC Power Supply section above. A red LED (D1) will glow which indicates active power. Connect the module to a PC or a Switch/Router as mentioned in the Ethernet Interface section above. Run Numato Lab Device Discoverer.jar, (Java Runtime must be installed on the target machine), click on Discover Devices. The window will display the IP address, Host Name, MAC Address, and Other information.

32 Channel Ethernet GPIO Numato Lab Device Discoverer

IP Address and MAC Address can be seen in command prompt also, open the command prompt and type the command ‘arp -a’. This will display the available network interfaces and connected devices along with the MAC address and IP address of each device. Look for the IP address that corresponds to your device’s MAC address. The MAC address for each GPIO Module is printed on a label on the board for your convenience. Use the IP address obtained in order to access the device.

command prompt

Accessing the module

The module can be controlled by using one of the two interfaces below.

  1. Through HTML/Web Page served from the device.
  2. Through a Serial Terminal Emulator that supports TELNET (Eg: HyperTerminal, TeraTerm, PuTTY…).

Accessing the module using web interface

The easiest method for controlling the module is through a web page served from the device. To open the administration web page, type in the IP address into the address bar of any web browser and press enter

8channel-accessingmoduleimg2

You will be prompted to enter User name and Password. The default User name and Password is ‘admin‘. You may change the User name and Password once logged in.

8channel-accessingmoduleimg1

Enter the default User name and Password then click OK.

You will be presented with the device home page that shows the status of GPIOs.

32 Channel Ethernet Device Status Summary

GPIO Status and Control

This board has 32 general-purpose input/outputs among 14 multiplexed with analog input. Click on the GPIO/ADC link on the menu bar to access GPIO configuration page. The GPIOs can be turned on/off by clicking on the Toggle GPIO button next to the corresponding GPIO.

32 Channel Ethernet Device Status Summary1

Individual GPIO can be configured in three modes.

  1. Digital Input(I/P)
  2. Digital Output(O/P)
  3. Analog Input

Digital Input(I/P)

To configure a GPIO as Digital Input, click on corresponding GPIO’s Change Config button. Select Digital I/P radio and click the Submit button.

32 Channel Ethernet GPIO Input Configuration

Digital Output(O/P)

To configure a GPIO as Digital Output, click on corresponding GPIO’s Change Config button. Select Digital O/P radio and click the Submit button.

32 Channel Ethernet GPIO Output Configuration

Analog Input (I/P)

To configure a GPIO as Analog Input, click on corresponding GPIO’s Change Config button. Select Analog I/P radio and click the Submit button.

32 Channel Ethernet GPIO Analog Input Configuration

Device Settings

Device Settings page displays the current firmware version, Device ID, Account Settings and Basic Network Settings. A logged-in user can change and save the Device ID, User name, Password and network settings

32 Channel Ethernet Device Settings

In the above image, firmware version is displayed as 00000008, default device ID 00000000, default User name and Password as ‘admin’. The user can change and save the Device ID, User name and Password as explained in command set or changing the appropriate field on this page and clicking on the save button on right side. The User name and Password can be reset to factory defaults via Factory Reset explained elsewhere in this document. The Basic Network Settings Shows the Device MAC address, Host Name and IP Address. The default host name and IP Address can also be changed according to the user wish. After saving changes the board will reboot with the new network settings.

Controlling the module through TELNET interface

The simple set of ASCII based human-readable command set supported by this module makes controlling GPIOs easy via TELNET protocol very easy. The following sections give examples of how to use the module with HyperTerminal and TeraTerm.

To use this module with HyperTerminal, please follow the steps below.

          • Connect the module to the PC or LAN.
          • Open HyperTerminal and enter the IP address corresponding to the module, leave the port number as 23.
          • Click OK.

          • If everything goes well, you should be presented with a screen as below.
          • Select the properties button and do as same as shown below, then press OK.32 Channel EthernetGPIO32 - HyperTerminal1
          • Type in the TELNET User name and Password when asked and press ENTER key.
          • Press ENTER key again and the command prompt should appear. 32 Channel EthernetGPIO32 - HyperTerminal2
          • Commands listed in the table below (please see section “Sending Commands”)can be entered here now. For example, here is the response for “ver” command.32 Channel EthernetGPIO32 - HyperTerminal3

    Using the GPIO module with TeraTerm is just as easy. Please follow the steps below.

    impTeraTerm is an open-source software. A free copy can be downloaded from http://en.sourceforge.jp/projects/ttssh2/releases/

    • Run TeraTerm and type in the IP address corresponding to the module in the “New connection” dialog and click OK.32 Channel Ethernet Teraterm (disconnected) VT
    • Then select the terminal setup from the setup button and make sure the settings are as shown below, and press OK.32 Channel Ethernet Tera Term Terminal Setup
    • Type the User name and Password when asked.32 Channel Ethernet GPIO Teraterm - VT
    • Press ENTER key and the command prompt should appear. Commands listed in the table below (please see section “Sending Commands”) can be entered here now. For example, here is the response for “ver” command.

    32 Channel Ethernet GPIO Teraterm - VT1

Sending Commands

One of the most powerful features of this module is the simple easy to use command set it supports. This command set allows for a very simple interface to access the features of the module through the TELNET protocol. The following sections give details of the command set and how to use the command set.

The TELNET command set

This product supports a very simple command set that is designed to be less cryptic and easy to use manually (using terminal emulation programs that support TELNET) or through a program written in one of the many supported languages.

List of currently supported commands.

No.Command
ParametersExample Description
1verNoneverReturns firmware Version
2idget/set xxxxxxxxId get, id set 12345678Reads/Sets id of the module
3usr get/set xxxxxxxx usr get, usr set admin Reads/Sets User name
4pass get/set xxxxxxxx pass get, pass set admin Reads/Sets Password
5gpioset/clear/read, gpio number readall/writeall/ iomask/iodir, gpio notify on/off/getgpio set 0, gpio clear 0, gpio read 0, gpio readall, gpio writeall ffffffff, gpio iomask ffffffff, gpio iodir 00000000,
gpio notify on,
gpio notify off,
gpio notify get
Control General Purpose Input/Output
6adc read, channel adc read 0Read Analog to Digital Converter input
7rebootNonerebootExit the application mode and enter to the configuration interface and start the configuration via USB.

The table below has more detailed information about available commands

No. Command Example Description
1ver ver Returns current firmware version.
2idid get
id set xxxxxxxx
Id get reads the module ID. Id set will assign a new ID to the module. “x” stands for alphanumeric characters including symbols. The new ID must be exactly 8 characters in length.
3usr
usr get
usr set xxxxxxxx
usr get reads the default User name. usr set will assign a new usr name to the module. “x” stands for alphanumeric characters including symbols. The new User name can be 1 – 8 characters length.
4passpass get
pass set xxxxxxxx
pass get reads the default Password. pass set will assign a new Password to the module. “x” stands for alphanumeric characters including symbols. The new Password can be 1 – 8 characters length.
5gpio
gpio set xSets the GPIO output status to high. Here “x” is the number of the GPIO. This command accepts GPIO number from 0 -9 and A – V, total 32 values Please see examples below.
gpio set 0 – Sets GPIO 0 to high state
gpio set A – Sets GPIO 10 to high state
gpio clear xSets the GPIO output status to low. Here “x” is the number of the GPIO. This command accepts GPIO number from 0 -9 and A – V, total 32 values Please see examples below.
gpio clear 0 – Sets GPIO 0 to low state
gpio clear A– Sets GPIO 10 to low state
gpio read xReads the digital input status present at the input mentioned. Here “x” stands for the number of GPIO. This command accepts GPIO number from 0 -9 and A – V, total 32 values. The response will be either “on” or “off” depending on the current digital state of the GPIO. Please see examples below.
gpio read 0 – Reads GPIO 0 status
gpio read 4 – Reads GPIO 4 status
gpio iomask
xxxxxxxx
Set mask for selectively update multiple GPIOs with writeall/iodir command. A hexadecimal value(xxxxxxxx) must be specified with desired bit positions set to 0 or 1 with no “0x” prepended (eg 00000002, 000000ff). A 0 in a bit position mask the corresponding GPIO and any update to that GPIO is ignored during writeall/iodir command. A 1 in a bit position will unmask that particular GPIO and any updates using writeall/iodir command will be applied to that GPIO. This mask does not affect the operation of set and clear commands.
gpio iomask ffffffff– Unmask all GPIOs.
gpio iomask 00000000 – mask all GPIOs.
Refer Understanding readall/writeall commands for GPIO Modules to know more.
gpio iodir xxxxxxxxSets the direction of all GPIO in a single operation. A hexadecimal value(xxxxxxxx) must be specified with desired bit positions set to 0 or 1 with no “0x” prepended (eg 00000002, 00000045, 000000ff). A 0 in a bit position configures that GPIO as output and 1 configures as input. Before using gpio readall/writeall commands, the direction of GPIO must be set using “gpio iodir xxxxxxxx” command. GPIO direction set by using iodir command will be modified with subsequent set/clear/read commands (only affects the GPIO accessed using these commands).
gpio iodir 00000000 – Sets all GPIO to output.
Refer Understanding readall/writeall commands for GPIO Modules to know more.
gpio readallReads the status of all GPIOs in a single operation. The return value will a hexadecimal number with binary value 1 at bit positions for GPIO in ON state and 0 for GPIO in OFF state. Eg: a return value 00000000 (binary 0000 0000 0000 0000 0000 0000 0000 0000) means all GPIO are OFF. A value ffffffff (binary 1111 1111 1111 1111 1111 1111 1111 1111) means all GPIO are ON.
gpio readall – Reads all GPIO status.
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.

To turn on the Notify feature, send the command in the format below.
"gpio notify on"

The GPIO change notification is sent to the host is in the below format.
<Current value> <Previous value> <IODIR>

Current value - 32 bits in hexadecimal format that represents the current input states of all GPIOs.
Previous value - 32 bits in hexadecimal format that represents the previous input states of all GPIOs.
IODIR - Current IODIR value on the device.

For example, a GPIO change notification "FFFFFFFE FFFFFFFF FFFFFFFF" means the following.

1. Current IODIR value is FFFFFFFF which means all GPIOs are set to input mode.
2. Input values present on the GPIOs is FFFFFFFF. This means input logic applied to all IOs were login 1s
3. Current input values present at GPIOs is FFFFFFFE. All IOs stayed the same except for IO0 which 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 getThis command returns whether Notify feature is enabled or disabled.
gpio
writeall xxxxxxxx
Control all GPIOs in a single operation. A hexadecimal value (xxxxxxxx) must be specified with desired bit positions set to 0 or 1. A value 0 at a bit position will turn off the corresponding GPIO. A value 1 at a bit position will turn on the corresponding GPIO. Iodir and iomask commands must be issued as necessary before issuing writeall command.
gpio writeall ffffffff – Sets all GPIO to high state.
Refer Understanding readall/writeall commands for GPIO Modules to know more.
6adc adc read xReads the analog voltage present at the ADC input mentioned. “x” stands for the number of ADC input. The response will be a number that ranges from 0 – 1023. This command accepts adc number from 0 -9 and A – D, total 14 values. Please see examples below.
adc read 0 – Reads analog input 0
adc read D – Reads analog input 13
7rebootrebootExit the application mode and enter to the configuration interface and start the configuration via USB.

NOTE!

  1. For the commands like gpio read/set/clear, the gpio numbers greater than 9, should be given in upper case(A – V).
    Egs :- gpio set A, gpio clear H
  2. For the commands like gpio writeall/iomask/iodir, the value should be in lower case hexadecimal value(0000 – ffff).
    Egs :- gpio writeall f9ce, gpio iodir a2d5, gpio iomask 4ba8
  3. For the commands like gpio readall/notify on, the output will be showed in upper case hexadecimal value(0000 – FFFF).

Refer Understanding readall/writeall commands for GPIO Modules to know more.

Additional Information

Analog to Digital Converter

32 Channel Ethernet GPIO does support Analog to Digital Conversion on some of the GPIO terminals. A list of GPIOs that supports analog function in this product is listed elsewhere in this document. There is no special command required to execute to switch between analog and digital mode. Executing the “adc” command will set the GPIO to the analog mode and executing the “gpio” command will set the GPIO back to digital mode on the fly. Resolution of the ADC is 10 bits unless otherwise noted. The input voltage range of the ADC is 0 – VDD (this product uses 3.3V power supply, so the range will be 0 – 3.3V). The result will be returned as a number starting at zero and ending at 1023. Zero indicates zero volts at the ADC input and 1023 indicates VDD (3.3V for this product) at ADC input.

Using GPIOs with switches

digitaltoanalog-8ethernetrelayIt is possible to read the position of a switch that is connected to a GPIO. An SPST or SPDT switch is recommended to use with GPIOs. Push switches do maintain the contacts closed only for a very short time so using them is discouraged. The fundamental idea of using a switch with GPIO is to have the switch cause a voltage level change at the GPIO pin when pressed. Usually, this is achieved by using an external pull-up resistor along with the switch. The pull up resistor is connected between the GPIO and VDD and the switch is connected between the GPIO and ground. When the switch is not pressed, the pull-up resistor will cause the GPIO to stay at VDD voltage level. When the switch is pressed, the GPIO is short-circuited to ground and stays at zero voltage. This change in voltage and thus the position of the switch can be read using “gpio read” command.

Technical Specifications

Parameter *Value
Unit
Basic Specifications
Number of GPIOs 32
Number of analog inputs (Multiplexed with GPIOs)14
Digital circuit power supply voltage (External)7-12V
Maximum current drawn by digital circuitry 450mA
IO Specifications
Maximum IO source currentIO0 – IO9 2mA
IO14-IO2325 mA
IO24-IO318 mA
Maximum IO sink currentIO0 – IO9 2mA
IO14-IO2325 mA
IO24-IO318 mA
GPIO input low voltage 0.15V
GPIO input high voltage 3.3V
GPIO output low voltage 0 V
GPIO output high voltage 3.3 V
ADC Specifications
Resolution 10bits
Full scale range0 – VDDV
Reference voltage VDDV
Recommended Impedance of Analog Voltage Source2.5KΩ

* All parameters considered nominal. Numato Systems Pvt. Ltd. reserve the right to modify products without notice.

FAQ

Q. What is the connector marked as ICSP on this module?
A. This connector is used to program the on-board microcontroller. This connector is primarily intended for factory use.

Q. I need a customized version of this product, can Numato do the customization for me?
A. Yes, we can definitely do customization but there may be minimum order requirements depending on the level of customization required. Please write to [email protected] for a quote.

Q. Where can I buy this product?
A. All Numato products can be ordered directly from our web store http://www.numato.com. We accept major credit cards and Paypal and ship to almost all countries with a few exceptions. We do have distributors in many countries where you can place your order. Please find the current list of distributors at http://numato.com/distrib.

Physical Dimensions

32 Channel Ethernet GPIO Physical Dimensions

Suggest Edit