Viewing Arduino Serial Monitor on Smartphone

Let’s take a look at how to view a serial monitor and Arduino on a smartphone via Wi-Fi without installing any mobile applications.

Components

To implement our idea, we need the following components:

  1. Arduino UNO × 1
  2. PHPoC WiFi Shield 2 Shield for Arduino × 1

PHPoC Shield and PHPoC WiFi Shield are internet shields for Arduino Uno and Arduino Mega.

These shields have a built-in web server and a WebSocket server. They contain some built-in web applications. One of the built-in web applications is “Web Serial Plotter”. Web Serial Plotter is similar to Serial Plotter in Arduino IDE, except for the following points:

  • Access the web plotter via a web browser over the Internet (the serial plotter is available in the Arduino IDE via a USB cable).
  • Web Serial Plotter can be accessed from any OS (Android, iOS, Windows, macOS, Linux) without any installation.
  • The network serial plotter is easily configured through the settings page.

Project idea

The Serial Monitor and Serial Plotter tools in the Arduino IDE are used not only for debugging, but also for monitoring.

It is usually not very convenient to use these monitoring tools because:

  1. Available from PC only => No mobility
  2. Need to connect PC to Arduino via USB cable => distance limitation, short distance

But we can use other tools. Using Web Serial Monitor and Web Serial Plotter gives us:

  1. Access on any PC, smartphone and tablet if a web browser is available => mobility
  2. WiFi connection => unlimited distance (over the internet)
  3. No software or application installation required

Decision

To implement monitoring without using applications, we will follow the steps below.

1. Connect PHPoC Shield 2 or PHPoC WiFi Shield 2 to Arduino. In fact, we just put one on top of the other.

Arduino communicates with PHPoC [WiFi] Shield via pins 10, 11, 12 and 13 on Uno and pins 10, 50, 51 and 52 on Mega… Therefore, these pins CANNOT be used for general I / O.

2. Install the Arduino library for this shield from GitHub.

3. Load the code below into Arduino. This code example demonstrates how to use the “Web Serial Plotter”.

#include <Phpoc.h>

float y1;
float y2;
float y3;

void setup() {
  Serial.begin(9600);
  while(!Serial)
    ;
  // initialize PHPoC [WiFi] Shield:
  Phpoc.begin();
}

void loop() {
  for(int i = 0; i < 360; i += 10) {
    y1 = 2 * sin(i * M_PI / 180);
    y2 = 3 * sin((i + 90)* M_PI / 180);
    y3 = 5 * sin((i + 180)* M_PI / 180);

    Serial.print(y1);
    Serial.print(" "); // a space ' ' or  tab 't' character is printed between the two values.
    Serial.print(y2);
    Serial.print(" "); // a space ' ' or  tab 't' character is printed between the two values.
    Serial.println(y3); // the last value is followed by a carriage return and a newline characters.
    delay(100);
  }
}

4. Open a web browser and enter the IP address of PHPoC Shield:

Web UI after entering the IP address PHPoC Shield 2

Click “Web Serial Monitor” and “Web Serial Plotter” one by one, we can see Serial Monitor and Serial Plotter on the mobile as shown below.

That’s all. In this simple way, we can view a serial monitor on a smartphone.

About: Morozov Dmitry

My specialisation is software engineer. I am 35 years old and have been working in the IT field for over 15 years. I have accumulated experience in programming, project management, training and administration.