Table of Contents

XTension Multipurpose GPIO Kit

NOTE: These instructions are preliminary for those testing the beta units. This is not complete nor final at this time.

The XTension GPIO module is available as a kit or as a pre-assembled and tested device. It is based on an ESP32 processor and can be reprogrammed by the Arduino IDE if you wish to use the hardware without the built in firmware. The device requires 2.4ghz WiFi to be available and an XTension instance running or other software that can connect to it.


XTension Setup:

An instance of XTension running on the same subnet as the device is required. Only one instance of the XTension Kits Plugin needs to be setup to support any number of XTension kit devices on the same subnet.

In XTension visit the Interface Status window and click the New Interface button in the toolbar. Select “XTension Kits” from the plugin/Device popup. Give the interface a descriptive name and save it. Now back in the Interface Status window check the enabled checkbox next to the new entry you just created.


WiFi Setup:

When the device is powered up for the first time, the Setup button is pressed or there are no wifi networks configured, it will start it’s configuration access point. When in Setup Mode the LED will flash quickly twice every second. See the “Status LED Patterns” section below for more info on the status LED. From your mobile device or with a laptop join this wifi network. A captive portal will display with a subset of settings for the device. From here you can enter up to 3 wifi networks to connect to. The device will chose the one with the best signal strength. Here you should also give the device a better name and bonjour/mDNS name than the defaults. If you wish you can also set a static IP address or change other networking parameters at this point. Click the save and restart button to make your changes live. The device will restart and if it connects properly to wifi the captive portal will disappear and your device will reconnect to the previously selected WiFi network.


GPIO Web Interface:

Once the device has joined your WiFi you can access it’s built in configuration web pages from any browser. Use the Bonjour/mDNS name or the static IP address that you entered during the WiFi Setup step above.


Main Web Page:

When visiting the built in web server you will first see this page. When first started up no GPIO is configured so the page will show only the toolbar of links to other config pages and the block with the CPU temperature and WiFi signal strength. If you have GPIO configured as outputs, 1-wire devices or DHT-22 sensors attached their current status will be displayed on this page as well.


Device Settings Page:

Most device settings including WiFi can be set from this page:

After making any changes you must click the Save and Restart button to make them live. If you navigate to another page of the interface after making changes they will not be saved.


GPIO Settings Page:

To setup the GPIO or configure the expansion module you have installed click the link in the navigation toolbar labeled “GPIO.”

Expander Module Settings:

If you have installed an expansion module you need to select it’s type from the popup list on this page. Once selected the appropriate interface for that module will be displayed. See the individual sections below for more info on available expander modules.

GPIO Settings:

Below the Expander settings there is an entry for each of the GPIO pins. There are 8 gpio pins brought out to the removable screw terminals on the top of the board and 11 more available through the expander connection. See the section below about GPIO Ratings and Safe Usage for more information. GPIO capabilities are different for each pin, some supporting higher level functions and more interesting connections. See the table below for more info and also the user interface on the web page though that is incomplete as of this beta version.

GPIO Function Description:


GPIO Ratings and Safe Usage:

The pins brought out to the screw terminals have extra protection to try to protect the CPU from excessive voltage or spikes from static but it is still definitely possible to damage or destroy the CPU by using these improperly. The aux GPIO on the expander connector may have other limitations and not support all the functionality. (BETA: As of this beta version the capabilities of these are not limited in the UI so you can select functions they won’t support.) The maximum current output per GPIO pin should be limited to 12ma and the total output from all the GPIO pins should be limited to 40ma. In reality the ESP32 seems to support quite a bit more than this without damage but if you do that you are taking your fate into your own hands. If you need to run more than a 5mm led from a GPIO pin directly you should use the GPIO to turn on a transistor or mosfet. There are many diagrams and tutorials available for safely connecting such things to an esp32 or arduino. In the case of an NPN channel mosfet no other hardware is required, in the case of a transistor a 1k or so resistor in between the GPIO output and the transistors gate is required or the transistor will burn itself out fairly quickly.


Controlling Relays:

A more common use of the GPIO may be controlling relays. Please do not connect a relay directly to a GPIO pin as it will draw too much current and the back EMF pulses from the coil will eventually destroy the ESP32 chip. A transistor or mosfet control as well as a snubber circuit is absolutely required to control such a thing from a GPIO output. There are many inexpensive logic level relay boards available on the internet that are optically isolated and can be used directly from the GPIO pins. A 3.3v relay board can be powered from the 3.3v output on the board itself as long as the entire current usage with all the relays on doesn’t exceed an amp. The GPIO output can be used to control a 3.3v board of this type as well as a 5v board of this type, but if a separate power supply is needed the grounds must be connected to the ground on the GPIO board or they cannot talk to each other. 12 volt relays can probably be used also and possibly powered from the same 12v power supply that is used to power the GPIO board. The boards I have tested with however have not been activated by the level of output possible at 3.3v that is output from the GPIO. I have had success by removing the jumper on the boards that connect the relay power with the logic power and powering the logic on the board from the 3.3v supply and the relay power directly from the 12v supply. This has let me use several 12v relay modules successfully here, but there are so many out there that your experience may be different. I will create a page with details on how to separate the 2 power sections on most of the relay boards at some point or drop me a note if you need that sooner.

Repeat! Do NOT just connect the coil of a relay to a GPIO output. It will damage or destroy the ESP32.


Firmware Page:

You can manually upload firmware update files, or start an over the internet update from the firmware update page. When you load the page the current firmware version, current web interface version and the hardware revision of your board are displayed. A check for update is started and if there is firmware available for your specific device and hardware revision it will be displayed here and a button will show to let you start that update automatically over the internet.

Note that when doing an update over the internet the device may restart twice as the web interface and firmware are loaded in separate steps.

Most software updates will include both a Firmware file, The file name will end in .bin and include somewhere in the name the hardware revision. For example a firmware update for the initial unit with a hardware revision of “GPIO2” will be named something like “gpio firmware.134.GPIO2.bin. The web firmware will also include the hardware revision but will end in “.spiffs”

Unless an update has specific instructions to the contrary you should load the firmware file first, and then the web interface file.

Once a file is uploaded the hardware revision is validated and if it matches the software is loaded. Upon success the device will reboot and the page will reload showing the new firmware version. If you have a second web interface file load it at this time.


Status LED Patterns:

The GPIO device has a status LED that will flash different patterns depending on the connection state. During startup the LED will do a quick breathing animation to let you know that the hardware and firmware has loaded.

Setup Mode:

If the device has no WiFi networks configured or at any time if you press the setup button it will go into setup mode and advertise it’s own configuration wifi access point for you to conenct to. When in Setup Mode the Status led will flash twice quikly every second.

Connecting To Wifi:

During the connection to WiFi the status LED will flash 1 second on and 1 second off. Normally it takes about 15 seconds or less to connect to the network. If this continues for much more than that you should check the SSID and password you entered and that the WiFi is within range. You can press the setup button during this process to skip the connection and restart the Setup access point.

No XTension Connection:

If the wifi has connected but no XTension has found the device the status LED will quickly flash once a second. This is also displayed if the XTension connection checkbox on the device settings web page is turned off.

Normal Operation:

In normal operation with a valid XTension connection the LED will be dimly lit to indicate that everything is working properly. You can configure the brightness of the LED or even set it to 0 if you do not wish the LED to be lit all the time. This setting is available on the settings web page. If the wifi drops or the connection to XTension is lost the LED will change to the appropriate state to indicate that.