Adding Wi-Fi to various devices

    Foreword


    One of my good friends is building automation. And somehow, over a glass of beer, he complained to me about one of the facilities that he is operating. The “head” of all the automation there is the PLC 100 of the well-known domestic manufacturer Aries. It works autonomously, without outside interference, but once a month it is necessary to remove logs from it and monitor the overall health of all automation in the building. The problem is that in the cabinet in which the PLC is located, for some reason they did not run Ethernet from the local grid. Pull out the wire, for some organizational reasons it is not possible. And you can’t hang a GSM modem, because the cupboard is in the basement, where there is no network. At the same time, a local Wi-Fi network reaches the cabinet with the PLC, but the PLC 100 does not have Wi-Fi.
    And every month you have to drive to the site with a laptop, turn on the USB-RS232 adapter in the device and shoot the logs. As a result, I promised to “finish” the PLC by adding Wi-Fi to it.

    General idea


    Looking at the description of the device, I saw that it has Ethernet, two RS-232 and RS-485 on board. At the same time, Ethernet, for the reasons described above, was useless to me. The RS-485 was used as a fieldbus for controlling automation. But RS-232 was used only for removing logs. It was decided to modify it in Wi-Fi.
    For this, it was necessary to get the UART-WIFI module, disassemble the PLC, find the UART-RS232 chip and solder directly to its UART (in other words, to the UART of the internal PLC processor on which RS232 sits).
    Having opened the PLC case, near the RS232 connectors, driver chips were quickly detected and identified. Interestingly, two different drivers are used for two different RS232 ports: MAX3232 from Maxim and ADM3251Efrom Analog Devices.
    image
    Well, for us it’s not so important, because The driver will be removed from the board and replaced with a Wi-Fi module.

    The second part is the search for a Wi-Fi module. The following requirements were set for him:
    1. output mounting of the module (i.e. not SMD) - so that it is easy to solder to the terminals, and not iron the board under it
    2. the presence of Transparent mode (UART-TCP bridge) - i.e. minimum number of AT commands required for operation
    3. the presence of an antenna directly on the module or the possibility of its easy connection
    4. UART control, of course
    5. preferably up to $ 10

    First of all, the idea was to use a module based on the esp8266 chip rattling the whole runet. But after reading about it on the Internet, I didn’t understand if it had Transparent mode, and besides, there were a lot of hints that while the firmware with AT commands is not stable enough. In general, I decided to look for more.
    As a result, a very suitable module by the name of RAK425 was discovered on aliexpress .. The manufacturer of this miracle was easily googled by the name of the module. The manufacturer’s website turned out to be sane documentation and some other files that I didn’t particularly look at. The guys impressed me as “decent” Chinese, so it was decided to take. True, it was not possible to find a unit sale, because I bought a “package” of 5 pieces for $ 50, not including delivery - let them lie, I will find use for the rest over time.

    We work with a soldering iron


    First of all, open the datasheet on the ADM3251E chip and look for contacts to power its TTL level - Vcc, GND (pins 2 and 10, respectively). Our Wi-Fi module works with a voltage of 3.3V, so just in case you need to measure how ADM3251E is powered by ARIES. Here's a bummer - the multimeter showed 4.9V.
    Let's try our luck with MAX3232. According to the datasheet, the power goes to contacts 15 and 16. I was lucky and the power there is 3.3V, so we decide to connect the module here.
    But what if the power is not 3.3V?
    If there is more power, then you can use an inexpensive and easily accessible linear voltage regulator a la bank, in some output housing such as TO-92. Type LP2950CZ-3.3 / NOPB - apparently it should pull current.

    We prepare the Wi-Fi module by soldering 4 wires to the necessary contacts (Vcc, GND, RxD and TxD in accordance with the pinout from the documentation). The module itself can be put right inside the PLC100 case. In order that he would not spend anything there, we wrap the module in heat shrink.
    image
    Now we find in the datasheet on the microcircuit the contacts to which we need to solder the RxD and TxD lines. We solder the driver and put our module in its place:
    image
    Now we put the module inside the PLC and assemble it. Everything fits very well, so the PLC looks pristine untouched from the outside.

    Configure W-Fi module


    What I liked about RAK425 is the transparent transmission that is beautifully implemented in it, i.e. the transparent UART-WIFI bridge in it is organized generally without support for AT commands, i.e. For the program in the PLC100, the transfer process to the computer did not have to be edited at all - it still believes that it is transmitting data to RS232.
    It works like this: after power-up, the module raises its own access point. Having connected the laptop to this point, we type the module address in the browser (by default, 192.168.7.1) and get to the web page for its settings. There we write the name of the Wi-Fi network to which we want to connect and the password to it. And also the TCP connection parameters: I opened a TCP server on the module on port 1234 on the module. We reboot the PLC100 for power (and therefore our module) and after restarting the module connects to our Wi-Fi network. Now all the data that we send to our server is automatically relayed to the UART of the module (and therefore to the UART of the PLC100 processor).
    I don’t see the point of giving screenshots of the configuration process, everything is very simple, clear and described in the documentation.
    That’s basically all. The only thing that was required next was to forward the port to the IP of our module in the router on the site and monitor the status of the automation via the Internet. This is already the second month at the end, how everything works there and you don’t have to drive to the object every month. Comrade Lafa, I have a bottle of cognac.

    Conclusion


    The purpose of the article is not to show how to fasten W-Fi to a specific PLC100 (it is unlikely that someone else will have a similar problem), but to demonstrate one of the possible approaches for setting up remote access to any equipment that was not originally intended for this.

    The method is simpler and faster. But not so exciting.
    After everything was done and started, they told me about a simpler way to implement the same. As it turned out, many modern routers can work in reverse mode, i.e. use Wi-Fi as a WAN, and Ethernet as a LAN. I just didn’t know then.
    Potential disadvantages of such a solution:
    1. the router needs to be powered by something - not the fact that there is such an opportunity in the cabinet;
    2. a DIN rail router is expensive and it’s not a fact that it can do that. Not a DIN-rack router can "not please the eye" of local electricians


    Also popular now: