Hardware component

Arduino UNO × 1
PHPoC Shield 2 for Arduino × 1
PHPoC Smart RS232 Board × 1

Why should we?

In the era of IoT, do you still own serial devices?

The answer is yes for me. I have a Pan-tilt camera which only supports RS485 interface, and I am not going to throw it away any time soon . There are tons of serial devices over there in the real world, not to mention that most of industrial devices still use serial interfaces. Serial communication is simple, cost-efficient, reliable, and can come to the rescue whenever you need to get the console access to the device.

But, let me remind you, it is 2019. Everything is going to be Internet-connected! Isn't it great if we can add network capability to those serial devices, so that in case of need, we can connect and access them from wherever we want.

Here I will show you how I made a simple Ethernet to RS232 converter by using Arduino Uno and PHPoC Shield. Any TCP data bypass Ethernet connection can be transformed to serial data, and vice versa.

System Architecture

How can we?

For serial interface, here I use a Smart RS232 Board. Along with a PHPoC Shield 2, they are stacked on an Arduino Uno.

A PHPoC shield supports both Wi-Fi and Ethernet connectivity, but you can only choose either of them for network connection. In my project I set up an Ethernet connection for PHPoC Shield. And with a small change in hardware setup, it can be used as Wi-Fi/Ethernet to RS232/RS422/RS485 converter. Maybe with a little more effort, you can even make a Wi-Fi/Ethernet Serial gateway, since an Arduino board can carry up to 14 smart expansion boards, and by combining with a PHPoC shield, it can support up to 4 TCP connections simultaneously.

Arduino Uno + PHPoC Shield 2 + Smart RS232 Board

With cables

In my project, I made the Arduino board with PHPoC shield as a TCP client, so that it can connect to a TCP server via Ethernet network. Well, TBH, you can just call my project "TCP to Serial converter" as well.

Each Smart RS232 Board has a RS-232 port, and is addressed by ID, which can set by manually setting DIP switches. In this project, the board are addressed as 1.

Basically, the Arduino code does read the incoming data from serial, then send it to TCP server, as well as read incoming data from TCP server and forward it to serial.

For the demonstration, you can take a look at the screenshot below: