Remote control for Arduino, pen test

It will take two years, and at the mention of “another smart switch” the author will be thrown eggs. But this will not be about this, the conversation will be about a development tool. I am not the first and not the last who decided to automate the development of user applications for remote work with electronic devices.

I was always interested in what solutions other developers in this area offer. Most often, what came across were quite serious tools with spreading documentation. However, it is difficult to expect something else from a full-fledged working tool.

In this regard, my service stands aside. And although it does not provide a comprehensive solution, but for some tasks, due to its lightness, it could be quite suitable. The simplicity of designing visual interfaces and a work program could speed up prototyping devices. Using the mnemonic editor, you can quickly place the controls, and then download the working program and modify it to fit your needs. Having handed over, all the work can be done in just five minutes.

The rapid creation of user interfaces, in our time, is not an exceptional feature, rather it is a necessary minimum by modern standards. The environment is another matter, that is, how significant will be everything else, besides the interfaces themselves. This is a typical example of SCADA, but here the graphics will always be on top, but will the developer want to try and fasten his piece of iron to an OPC server in order to test it? Without pre-harvesting the driver, the developer will surely refuse to use SCADA.

Where else to find a tool for creating interfaces? You can embed a Web server in the device, there are many ready-made visual elements for this, I don’t want to take it. I do not want? Does the device have no memory to host HTML pages? That is, again, a certain intermediate server (OPC server) begs.

Therefore, a new direction of cloud servers has appeared, you send your data there, and they visualize your data through HTML pages. This direction is quite fresh, and at the same time, these solutions are already finding their customers.

For serious automation, this will usually not be acceptable, but in everyday things, as cheap solutions, it’s very complete.

What I met among cloud solutions was aimed at storing user data. This is probably the most urgent task for which I do not have my own implementation yet. But, in my service, I did a good job of real-time management, developed compact protocols for exchanging data, implemented authorization and stream encryption. All the same, management requires increased security, unlike monitoring.

Now about the implementation itself and some techniques that I applied when creating the service.

The service consists of the site itself, where the user can create his account. By logging into your account, the user will see a list of their own control panels. Each control panel can control one or several devices at the same time.

The user also has a list of panels that friends have trusted him. And there is a third list of panels that are shared with everyone. All users of the service can trust their panel to a friend or share it with others.

To design your panels you need to go to the editor (for the editor you need the installed Silverlight plugin).
Sorry, sometime in the future, I’ll translate this editor into HTML5 and javascript technology (due to javascript, I already believed and even managed to fall in love).

Before creating a control panel for your piece of hardware, you need to create a "Connection Place". Each “connection point” is unique and is used as a link between the control panels and the electronic device.

At first glance, this entity is superfluous, because it was enough to assign each parameter a global unique identifier.

But I acted differently, parameter binding is done by name, which makes this process more visual (a name can consist of several words). Naturally, the uniqueness of the names must be respected within one “place of connection”.

The parameters mentioned above are another entity that has the name “signal” (the word “signal” is less overloaded in meaning). Each signal has its own type, permitted operations and access level. The access level is used only when the control panel is shared, and protection is needed for a certain action, for example, so that no one except the owner can write a specific parameter.

One “connection point” can connect up to 255 signals (for a single physical device, this number should be enough). It was important for me that the transport protocol was compact. For example, the transfer of one 4-byte parameter and 8-byte timestamp, as well as its name is packed in 8 bytes (4 + 8 + name = 8). Such a GSM modem arithmetic will only say thanks.

In general, with these terms there is a direct misfortune, everyone strives to invent entities without the need.
  • Control Panel - a graphical interface for remote interaction with equipment;
  • Place of connection - a logical unit connecting equipment and control panel;
  • Signal - a specific equipment parameter;
  • Editor - a tool for designing places and panels (installation of the Silverlight plugin from Microsoft is required);
  • Simulator - a graphical interface simulating the appropriate equipment.

Perhaps the creation of signals is the most unpleasant place, but do not rush to throw stones, this has its own reason. Based on this information, the source code of the working program will be automatically created for the developer (for Arduino, Windows, and FreeBSD platforms). This code will initially be operational and can be downloaded into Arduino. For the developer, it remains only to fill out the signal handlers with useful code (for example, turn on the LED or send a new button state).

Having received ready-made sources and a concise API in the form of sish functions, the developer does not need to understand the exchange protocols. And in general, with this approach, the probability of errors is many times reduced.

Everything, the physical device is ready and connected to the Internet. Now it remains to create a control panel.
We place the controls on the panel, bind them to the desired signals.

Now we will exit the editor and in the “My Panels” tab we will open the created control panel, immediately there will be an automatic connection to the equipment.

As a demonstration, I shared my Arduino, you can blink LEDs and take pictures from two JPEG cameras (as long as the household did not brush it off the table).

What else I would like to implement:
1) The ability to embed custom SVG controls.
2) The mechanism for switching from a cloud service to an offline mode (when there is no Internet).
3) Data recording (not an easy task).

In any implementation, there are pitfalls. I had a project where I developed a distributed system based on CANOpen, so there, in each execution node, I laid out a separate logic for handling emergency situations. There were about twenty nodes in the system. This was reliability, 100% working out of all emergency situations, while the reaction of the entire system fit into 5ms.

Also popular now: