MegunoLink supports TCP Client connections to a TCP Server in your Arduino sketch over WiFi or wired Ethernet connections. Arduino hardware supporting TCP connections includes:

  • ESP8266, a low-cost Arduino with built-in WiFi
  • ESP32, a low-cost Arduino with built-in WiFi and bluetooth
  • EtherTen, an Uno compatible Arduino with built-in Ethernet
  • Ethernet shield, an Arduino compatible shield that adds an Ethernet connection

Plot data, build interfaces

MegunoLink plotting and interfaces work just as well over TCP as serial. Check out our article on talking to a ESP32 TCP server over a WiFi network or learn about interface panels and data visualization.

create TCP Client connection

Create new connections from the Add Connection menu.

Creating a TCP Client Connection

To create a TCP Client connection in MegunoLink:

  1. Open a connection manager visualizer
  2. Choose TCP Client from the Add Connection drop-down menu.

A configuration panel for the new TCP Client connection will be added to the Connection Manager:

TCP Client with mDNS

A TCP Client connection panel with the mDNS addressing option selected

Configuring the Connection

The TCP Client connection panel displayed in the Connection Manager is used to configure the connection.

TCP Client Configuration

Configure the TCP Client connection in the Connection Manager

The controls for configuring the connection are:

  • Connecton name: a free-form name to help you identify the connection. This name will be displayed on the Connection Selector.
  • Address type: selects the type of address to use for connecting to the remote device.
  • Delete connection: remove the connection from the project.
  • Connect/Disconnect: open/close the connection to the remote device.
  • Remote address: address of the remote device you are connecting to. The appearance of the remote changes depending on the type of address selected.

To connect to a remote device you must know its address. The TCP Client lets you supply the remote device’s address using several common methods including:

  1. mDNS Address: each device advertises the services it supports and its name on the local network. You can select the service and device name from the drop-down controls. Click the Service link to open the mDNS Browser window to configure available services.
  2. DNS Address: if your device is registered with a domain name server (DNS) you can enter its DNS address and the port on the remote device that MegunoLink will connect to.
  3. IP Address: enter the IP address of the remote device and the port MegunoLink will connect to.

Arduino TCP Server

For MegunoLink to connect to a remote device it must be running a TCP Server. Use the WiFiServer class to create a WiFi Server in your Arduino program.

Handle Commands

Check out our TCP Command Handler to process and dispatch commands to functions in your Arduino sketch.

For example, to create a TCP Server on a wireless Arduino such as the ESP32 or ESP8266, you can use:

Learn More

Adding a TCP Server to your Arduino sketch will let MegunoLink open a connection but not much else. For information on using the connection, check out:

  • TCP Command Handler: an Arduino library to process messages received over a TCP connection. You can register a function in your program to be called whenever a command is received.
  • mDNS Browser: Multicast DNS provides a handy way to discovery devices on your local network to open connections.

Start typing and press Enter to search