The IoT Discovery Gateway is a powerful and complete testbed for connected products and services powered by Electric Imp. It is based on the Electric Imp imp005 module.
The IoT Discovery Gateway incorporates three Grove System-compatible headers, each of which connects to a four-wire cable with two data wires (yellow and white) plus 3V3 (red) and GND (black). For more information on the Grove System, please see the Seeed Wiki.
The IoT Discovery Gateway’s standalone Grove System Connector is intended to be used solely for I²C applications. Its data wires can be used to drive a variety of Grove-compatible devices. It connects to the imp005’s hardware.i2c0 bus. The yellow wire provides the clock line (SCL); the white wire the data line (SDA). Only 3V3 I²C devices are supported.
The two adjacent headers labelled A and B are intended for Grove Analog and/or Grove Digital peripherals. The two headers are both connected as follows:
|Grove Connector||Digital 1
When the analog functionality of a Grove connector is required, the appropriate imp005 pin must be configured as a digital input.
The IoT Discovery Gateway can operate as a USB host for USB 1.1/2.0 devices using its USB A connector. Only one USB device may be connected to the Gateway at any one time, and USB hubs are not supported. Please see the impOS™ USB API for further details on the classes used to manage the Gateway’s USB connection.
The USB port supplies a current-limited 5V for USB devices with maximum recommended load of 500mA. USB power is controlled by the imp005’s GPIO pin R and over-current on USB events are reported via GPIO pin W. For more information, please see the imp005 Hardware Design Guide.
|R||USB power enable|
|W||USB over-current indication|
Please see the imp API usb object documentation for more information on programming the Gateway to interact with USB devices.
The IoT Discovery Gateway’s RS-485 connector includes a ground connector intended for establishing a signal ground.
The imp005’s UART1 bus is dedicated to the RS-485 port and the module’s GPIO pin L is utilized to control the data direction: the data direction line must be set to be high for transmission. Transmission from the Gateway can be disabled via hardware control by removing the red jumper J2 on the PCB.
|L||Data direction: High for TX, Low for RX|
Note For TX, jumper J2 must be populated.
The IoT Discovery Gateway has a downstream port intended to provide access to Ethernet-equipped industrial equipment such as Programmable Logic Controllers (PLCs). The downstream port is implemented using a Wiznet W5500 SPI-to-Ethernet bridge and uses the W5500’s integrated PHY.
The W5500 is accessed using the imp005’s hardware.spi0 peripheral and the active-low chip select (nCS) pin dedicated to hardware.spi0. The W5500 interrupt and reset pins are connected to imp005 GPIO for additional control. SPI communications are limited to 8MHz.
Note The downstream port does not support auto MDI-X, so if connected directly to another device, a crossover cable may be required.
|SPI0_MISO||Master In, Slave Out|
|SPI0_MOSI||Master Out, Slave In|
|SPI0_CS_L||Chip Select (nCS)|
Electric Imp provides a series of Modbus libraries to help you work with Modbus devices attached to the IoT Discovery Gateway’s Ethernet or RS-485 ports:
The IoT Discovery Gateway includes a Microchip MCP3208 8-channel 12-bit ADC which connects to the host imp005 via hardware.spiBCAD.
Electric Imp provides Squirrel library for the MCP3208. You can find its documentation here. To initialize the ADC, use the following code, replacing
<version> with the library’s latest version number (available via the above link).
#require "MCP3208.device.lib.nut:<version>" // Code for IoT Discovery Gateway spiBus <- hardware.spiBCAD; spiBus.configure(CLOCK_IDLE_LOW | MSB_FIRST, 50); adc <- MCP3208(spiBus, 3.3);
The library allows you to read the value at any of the MCP3208’s eight inputs (channels) or the difference between two separate channels. These are the inputs:
|MCP3208 Channel||Connected To...|
|0||Grove Connector A yellow pin (hardware.pinS)|
|1||Grove Connector A white pin (hardware.pinM)|
|2||Grove Connector B yellow pin (hardware.pinJ)|
|3||Grove Connector B while pin (hardware.pinK)|
|6||28V AC IN|
|7||5V IN (the mini USB power port)|
The IoT Discovery Gateway’s three user-controllable LEDs are connected to specific imp005 GPIO pins as listed below:
|LED||imp005 Pin||Startup State|
The LEDs are configured with the imp005 sinking current to illuminate the LED, and so the imp005 control pin is driven high to extinguish the LED.
The IoT Discovery Gateway includes a bridge rectifier so there are no polarity concerns for the two-terminal AC/DC power connector. Maximum recommended voltage for operation is 24V DC via AC/DC power connector.