Arduino client for the Serial To TCP Bridge Protocol PC side service

Arduino Serial to TCP Bridge Client

Arduino client for the Serial To TCP Bridge Protocol gateway service.

Open a TCP connection to a server from the Arduino using just serial. No Ethernet/WiFi shields necessary.
Quickly communicate with other servers and make network apps using minimal hardware.
See this for more information on the protocol and for the Protocol Gateway you will need to run on the host PC the Arduino is connected to serially.

Requires:

  • Serial 0 (Main serial through USB)
  • Timer 1

Dependencies

  • NeoHWSerial - Install manually
  • CRC32 v2.0.0 - Can be installed from the Arduino Library Manager

After installing the dependencies and this library, make sure you have all 3 present inside your libraries sub-directory of your sketchbook directory.

How to

  • Get the Protocol Gateway and build it.
  • Change the gateway's config to listen on the COM port connected to your Arduino and start it.
  • Your Arduino app can then use the ArduinoSerialToTCPBridgeClient API which is similar to the EthernetClient API to make tcp connections to servers as long as they are reachable from the host PC and the gateway service is running.

Web Client Example

  • Modified version of the Ethernet shield's Web Client example.
  • The HTTP response data cannot be printed out over USB serial as in original example, because it is already in use by the protocol.
  • Instead it uses the software serial library to send it out over another serial connection.
  • Note that you would need to connect this second serial line to your PC if you wish to get the data or view the result in the Arduino IDE Serial Monitor.
  • On other boards with more hardware serial ports than the Uno the example can be modified to use those instead (Serial1,2,etc.) and remove the software serial lib.

MQTT Client Example

  1. Install PubSubClient - Manually, or from the Arduino Library Manager.
  2. Get a MQTT Broker running on your host PC, listening on localhost. I used HiveMQ.
  3. Open and upload the example from the Arduino Examples menu.
  4. Run the Protocol Gateway on the same PC, with the right COM port configuration.
  5. When the Arduino is connected to the MQTT broker, it will publish a message and subscribe to the led topic.
  6. You can use another MQTT client like MQTT.fx to publish characters 0 and 1 to the topic led to toggle the led on and off on the Arduino board.

Details

  • Tested only on Arduino Uno. It would probably not work for the Arduino Due.

  • You cannot use the same serial port in your app that is being used by the protocol, e.g. You cannot use Serial (Serial0) when the library uses NeoSerial, etc. You can modify this lib easily to use other hardware serial ports on bigger boards than the Arduino Uno if you want to free up your USB Serial connection.

  • Your app's instance of ArduinoSerialToTCPBridgeClient needs to be a pointer and created with new(). It doesn't work otherwise and I don't know why yet.

  • The protocol provides the app an in order, duplicates free and error checked byte stream by adding a CRC32 and simple retry mechanism. See this for background.

  • The Protocol Gateway opens a real TCP connection to a set destination on behalf of the Protocol Client running on the Arduino, and forwards traffic bi-directionally.

  • ArduinoSerialToTCPBridgeClient is derived from the standard Arduino Client class. This means existing code written for Ethernet/Wi-Fi shields should work with this.

  • NeoHWSerial is an alternative for Serial, used to gain access to the AVR UART interrupts.

  • The protocol cannot run over the standard Serial API or something like software serial because it needs hardware level RX interrupts when bytes arrive.

Owner
Roan Brand
Developer by day. Electronic Engineer at night.
Roan Brand
Similar Resources

Arduino HTTP Client library

ArduinoHttpClient ArduinoHttpClient is a library to make it easier to interact with web servers from Arduino. Derived from Adrian McEwen's HttpClient

Jan 6, 2023

MQTT client for Arduino

ArduinoMqtt About MQTT Client library for Arduino based on the Eclipse Paho project. This library bundles the C/C++ MQTTPacket library of the Eclipse

Nov 11, 2022

Websocket client for Arduino, with fast data send

Websocket client for Arduino, with fast data send This is a simple library that implements a Websocket client running on an Arduino. Rationale For our

Aug 4, 2022

OAuth 1.0 client library for Arduino

Arduino_OAuth Library for Arduino OAuth 1.0 client library for Arduino. This library depends on ArduinoHttpClient and ArduinoBearSSL. License Copyrigh

Dec 13, 2022

Arduino Arduino library for the CloudStorage server project. The library provides easy access to server-stored values and operations.

Arduino-CloudStorage Arduino/ESP8266 library that allows you to easly store and retreive data from a remote (cloud) storage in a key/value fashion. Cl

Jan 30, 2022

Arduino library for making an IHC in or output module using an Arduino

Introduction This is an Arduino library for making an IHC in or output module using an Arduino. (IHC controller is a home automation controller made b

Mar 26, 2020

ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT Cloud

ArduinoIoTCloud What? The ArduinoIoTCloud library is the central element of the firmware enabling certain Arduino boards to connect to the Arduino IoT

Dec 16, 2022

A simple C++ API client for the Ark Blockchain.

A simple C++ API client for the Ark Blockchain.

Ark C++ - Client A simple C++ API client for the Ark Blockchain. Lead Maintainer: Simon Downey Documentation You can find installation instructions an

Jan 21, 2022

Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames.

Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames.

107-Arduino-MCP2515 Arduino library for controlling the MCP2515 in order to receive/transmit CAN frames. This library is prepared to interface easily

Nov 16, 2022
Comments
  • Specify library dependencies in library.properties

    Specify library dependencies in library.properties

    Specifying the library dependencies in the depends field of library.properties causes the Arduino Library Manager (Arduino IDE 1.8.10 and newer) to offer to install any missing dependencies during installation of this library.

    arduino-cli lib install will automatically install the dependencies (arduino-cli 0.7.0 and newer).

    Reference: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format

An Arduino library with additions to vanilla Serial.print(). Chainable methods and verbosity levels. Suitable for debug messages.

advancedSerial This library provides some additions to vanilla Serial.print(): 1. Chainable print() and println() methods: // you can chain print() a

Dec 13, 2022
A Wiring/Arduino library to tokenize and parse commands received over a phisical/software serial port or buffer.

A Wiring/Arduino library to tokenize and parse commands received over a phisical/software serial port or buffer.

Jun 9, 2022
Connecting an ESP8266 to a Google Calendar service to turn an useless "On Air" sign into a smart meeting indicator
Connecting an ESP8266 to a Google Calendar service to turn an useless

ESP8266-GoogleCalendar Intro I had an useless "On Air" sign hanging around my home, and I thought it would be cool to connect it to my Google Calendar

Jan 20, 2022
Minimal bit-bang send serial 38400/115200 baud for 1MHz or 115200/230400 baud for 8 or 16MHz ATtiny clock
Minimal bit-bang send serial 38400/115200 baud for 1MHz or 115200/230400 baud for 8 or 16MHz ATtiny clock

Attiny Serial Out Available as Arduino library "ATtinySerialOut" Version 2.0.1 - work in progress Minimal bit-bang send serial 115200 baud for 1/8/16

Jan 4, 2023
Software emulated serial using hardware timers for improved compatibility
Software emulated serial using hardware timers for improved compatibility

AltSoftSerial Library Improved software emulated serial, using hardware timers for precise signal timing and availability of CPU time for other librar

Dec 12, 2022
Easily and asynchronously interact with a serial device requiring call-and-response style commands.

Arduino Managed Serial Device Note This library was formerly less-descriptively named "Arduino Async Duplex" This library allows you to asynchronously

Nov 20, 2022
Easily and asynchronously interact with a serial device requiring call-and-response style commands.

Arduino Managed Serial Device Note This library was formerly less-descriptively named "Arduino Async Duplex" This library allows you to asynchronously

Nov 20, 2022
Arduino TopLevel Client for aliyun IoT Platform

运行于 arduino 的 阿里云 IoT 接入 SDK,在底层连接的基础上增加数据回调绑定、发送数据和事件等 api 的封装,免去自己解析数据的痛苦

Dec 13, 2022
Anto client library for ESP8266-Arduino

Anto client library for ESP8266-Arduino ESP8266-AntoIO provides common and easy way to connect your ESP8266 to Anto.io IoT platform service. Stable ve

Dec 1, 2021
Arduino client library for websocket based communication with archer panels.

ArduinoArcherPanelClient Arduino client library for websocket based communication with archer panels. Archer Cloud panels provide you an easy and fast

May 18, 2018