A few months ago I started exploring the ESP32, a tiny though powerful microcontroller with built-in WIFI. I found numerous great examples for ESP32, especially those provided by Sam Chen on Github helped me a lot. But they all share one disadvantage: To rebuild them you need to dig quite deep into software development. If it would be possible to order a preinstalled product that just needs some wires to be connected, anyone could enable their devices to receive IOTA. So I started creating Espiota. It enables any machine powered by electricity to trigger its actions when a payment occurs. Espiota is fully configurable and no knowledge in software development is needed.

The current concept consists of two versions. An external box containing a display and buttons that will be easy to connect for anyone with basic knowledge in electricity. And a much smaller and more versatile board that can be placed inside the machine itself.

In the beginning of this series I will focus on the basic idea and on how the external box can be utilized to switch the main circuit of a machine. In the following articles I will further explain how Espiota can be integrated to trigger specific actions while observing the state of the machine.

Pay-For-Time

Espiota supports various operating modes with Pay-For-Time as default mode. More modes (Pay-For-Action etc.) will be introduced in the following articles, when we talk about deeper Espiota integration.

Imagine an air condition in a hotel room. The owner specifies a time period (seconds, minutes, hours, days, weeks) and the price in IOTA to use the air condition for the chosen period. He could configure Espiota to activate the air condition for a price of 10 Miota a day. When a guest pays 10 Miota to the specified address, Espiota activates the air condition for 24 hours.

Configuration

WIFI settings

Espiota uses WIFI for communication with the IOTA network and for configuration purposes. If no valid credentials for an existing WIFI network have been found (this happens when connecting in a new environment for the first time), Espiota acts as an access point, which allows to choose a network and to enter the password. The access point is available as a WIFI network called “espiota”.

Connect to the “espiota” WIFI

When connected to the access point the operator opens a browser which then redirects to the configuration page where he can choose the desired WIFI network for internet access:

Choose your WIFI network.

Espiota tries to connect to the WiFi network after entering a password and clicking “Join” .

Enter the password

If the connection is established, Espiota closes the access point and displays the connection details. The operator can now reconnect to his regular WIFI and access the configuration page by typing the displayed IP address into the browser.

Connection details

IOTA settings

Address

The IOTA address that should be checked for new payments.

Node

The IOTA node which is used to check the address for new transactions.

Port

The HTTP port of the IOTA node.

Monitor interval

Espiota regularly asks the node for new transactions on the payment address. The monitor interval specifies the time interval in seconds.

Minimum IOTA value

The minimum amount of IOTA required to switch on the connected device. A dropdown menu for IOTA units (Iota, Kiota, Miota, Giota) is available.

Costs

The costs to switch the connected device for a specific amount of time. A dropdown menu for IOTA units (Iota, Kiota, Miota, Giota) and for time units (seconds, minutes, hours, days, weeks, months) is available.

IOTA settings

Prototype

After writing the basic code I digged out an unused smart car and connected the ESP32 which was super easy as the car and the ESP32 both run on 5V and therefore no voltage converter or relay is needed. I sent some IOTA to the car and it turned on like expected for the configured amount of time.

Espiota integrated into rc car by connecting just three wires

Switching high voltage circuits

Now I wanted to switch main current devices (230V in Germany). So I added a 5V/10A buck converter and a relay module which theoretically allows me to connect most devices in my appartment. After wiring all together I successfully tested Espiota with my desk lamp.

Breadboard prototype for Espiota usage with main current

After the basic idea worked out, I built a smaller and more permanent solution. I designed the following circuit, ordered a 100x80mm stripboard (still could be done way smaller) and started soldering.

Stripboard design for permanent solution

The prototype basically consists of an ESP32 development board, a buck converter to power it with 5V and a relay to switch the main circuit. Furthermore, a switch to pause the connected machine while keeping the balance and an LED to indicate if the machine is switched on.

After spending a day on it I had the following result:

Finished Espiota prototype

I added a standard female socket to the Espiota output which allows me to connect any device in seconds.

Prototype with female socket connected to a desk lamp

Working with high voltage on a protoboard requires special safety measures. Therefore the current prototype should only run under observation and must not be connected to high power devices like a hairdryer.

Security

You might argue that anyone could remove Espiota to power the machine directly. First of all, the final product won’t use a plug like the prototype does (this is for showcase/testing purpose only, although I am thinking about a plug version for smart home usecases). Instead the wires will be fixed inside the enclosure. But someone could still open the enclosure to connect the machine directly, right? To complicate that the enclosure could have a lock in combination with security screws. If a hotel guest breaks the enclosure or cuts the wires, the owner would notice and could report the guest to the police and/or charge him for the incurred damage.

It really depends on the usecase if an external Espiota is suitable. Imagine a massage chair in an airport. Breaking the enclosure in front of other passengers, cutting high voltage wires and splicing the ends just to get a free massage without someone noticing is highly unlikely. Sufficient knowledge and criminal energy provided, any machine can be shorted to bypass the payment mechanism. What makes Espiota different though is that no coins can be stolen as they are stored on the ledger.

Now imagine an unobserved vending machine in a public space. Someone could easily come at night, remove Espiota and short the machine to empty it. In this scenario the internal Espiota version is way more efficient as the thief would need to break the machine first to access Espiota.

Next steps

Security

To protect against unauthorized configuration access, a password protection will be implemented into the settings page. Furthermore, Flash Encryption and Secure Boot will be added.

Display

A display will show the current balance, remaining time and a QR code with the IOTA address. Currently the address has to be printed out and changed manually. With a display new addresses can be generated automatically for each payment or customer with the QR code being updated on the display.

Deep integration

I am working on an Espiota powered safe and a coffee machine. Espiota can be configured to wait for the boiler to be ready, to know if coffee is being dispensed or to pause charging IOTA if the door of the safe is open. All these features will be discussed in the upcoming articles.

Vision

The main vision is to create a shippable and secure product compliant with the law in Germany (CE, RoHS, ElektroG, et cetera).

Remote Control / Smart Home

Espiota could also be used for smart homes by integrating it into a smart plug. It could look like the one in the picture. By using MAM this would allow to securely control devices from anywhere in the world. If MAM will be added to Trinity like the roadmap suggests, this would even be possible by sending messages from Trinity wallet.

The Espiota smart home version could look like a standard remote controlled socket

Electric meter

I have the rough idea of integrating an electric meter into Espiota. This would enable to connect Espiota into the main electricity circuit of a house or an appartment, just like your energy provider does. It would be particularly useful for hotel rooms or AirBnB appartments. Instead of maintaining one Espiota for each device, a single Espiota could be used for the whole appartment. Furthermore the customer could pay the electricity he actually uses instead of being charged a fixed amount that might be unreasonably high or low.

Help

I want to turn the prototype into a real product. There is a huge amount of conceptual and development work to do that I cannot tackle alone. If you want to participate in any way, have questions/critiscism or can give any advice, feel welcome to message me.

Donations

If you want to support the project by donating, please use this address:

HLXRUNWPTOMSQQBEFFKYJUSORTWAC9OWCNZVQNVIWXOKQTNFTUVUZXOTEVQFTVAXDRSANAHAUWESTXJGZQWLCJKWFA