In compliance with high industry standards

Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria

How to use TTL on an industrial Arduino based PLC


On this blog we will talk about the Serial communication TLL of our Arduino based industrial controller. Serial or sequential communication, in telecommunications and computers, is the process of sending data one bit at a time sequentially, over a communication channel or a bus. There is another way to send the information, in parallel, when all the bits are sent at the same time, so we have as many lines of communication as the bits we are sending.

The advantage of serial communication is that you need a smaller number of transmission lines than in a parallel communication transmiting the same data. 


In order to work with serial TTL  communication, you will need any of our industrial programmable logioc controllers for industrial automation:


IMPORTANT:  Make sure that your PLC is powered (12-24Vdc). 

In relation with the pins we use and the switch configuration for our industrial PLC controller Arduino, we need to know that in the Ardbox family we do not have Serial TTL, only by software.

Serial TTL for the M-Duino family, there are the pins RX1 (receiver) and TX1 (transmitter).

For the following models, we need to configure the switches that we see in the image. We need to know that the switches need to be in the OFF position beacuse the On position is not connected.

  • M-DUINO PLC Arduino 21 I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino 19R I/Os Analog/Digital PLUS

For the next ones, we need to choose between RX1 , TX1 / I1.1 , I1.0.

  • M-DUINO PLC Arduino 38R I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino 57R I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino 38AR I/O Analog/Digital PLUS

  • M-DUINO PLC Arduino 53ARR I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino 54ARA I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino 50RRA I/Os Analog/Digital PLUS

For the next ones we need to choose between RX1 , TX1 / I1.6 , I1.5.

  • M-DUINO PLC Arduino 57AAR I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino  42 I/Os Analog/Digital PLUS

  • M-DUINO PLC Arduino 58 I/Os Analog/Digital PLUS


IMPORTANT:  Make sure to download the Arduino based PLC boards for Arduino IDE. 

Software Configuration

Once the hardware configuration is done, it is possible to proceed with the software configuration and also its usage. Firstly, it is necessary to include the RS232.h library provided in our boards. Then please do not forget to implement the proper initialization of your communication on the setup() function:

In this example, the speed of transmission is 9600bps.


Basic Serial TTL write example   

Reads an analog input on  I0.2, prints the result to the serial monitor.

Graphical representation is available using serial plotter (Tools > Serial Plotter menu) on Arduino IDE serial monitor.

// the setup routine runs once when you press reset:
void setup() {
  pinMode(I0_2, INPUT);
// initialize serial communication at 9600 bits per second:
// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(I0_2);
  // print out the value you read:
  delay(1);        // delay in between reads for stability

In the following example, you can see how to change the speed of transmission.

void setup() {

Serial.println("Hello Computer");
    Serial1.println("Hello Serial 1");
    Serial2.println("Hello Serial 2");
    Serial3.println("Hello Serial 3");

Looking for your ideal PLC?

Take a look at this product comparison with other industrial controllers Arduino.

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC controller comparison >>

Do you want more information?

Just fill the form!

Tell me more!