Set up communication between Arduino and LOGO


I'm new to Arduino and working on a project. I want to connect a Siemens LOGO 8 to a Siemens IOT 2020 (Arduino Based). The plan is: all inputs are connected to the LOGO. I want to connect my Arduino with a Ethernet cable. I want to program counters and a few other things in the Arduino with the information that comes from the LOGO. and Display all the information from the Arduino to an LCD display. I have no idea how to set up the communication between the LOGO and the Arduino.

anyone done something similar or know how to do this.


I think you're going to need to use ethernet. If it isn't supported by your Siemens IOT 2020 (never used it before), then you will need a shield and a library to support ethernet comms.

I'm new to Arduino and working on a project. I want to connect a Siemens LOGO 8

A link to the datasheet or user-manual for the Logo would be useful ...


That link does not tell us much beyond it uses an ethernet cable.

it does not even tell us what the devices are for.


I don't know if this is useful? It's the users manual for a older type of LOGO but it's basically the same as a new one. except that the older model doesn't have a Ethernet connection


Jeez, that thing has 342 pages.

What page are you having difficulty with?


I figured I am going to use the Modbus TCP protocol which the LOGO uses. My Arduino knowledge is really basic so I don’t understand how to implement it in Arduino. if found this online

Modbus IP

There are four examples that can be accessed from the Arduino interface, once you have installed the library. Let's look at the example Switch.ino (only the parts concerning Modbus will be commented):
#include <SPI.h>
#include <Ethernet.h>
#include <Modbus.h>
#include <ModbusIP.h>

Inclusion of the necessary libraries.
const int SWITCH_ISTS = 100;

Sets the Modbus register to represent the switch. This value is the offset (0-based) to be placed in its supervisory or testing software. Note that if your software uses offsets 1-based the set value there should be 101, for this example.
ModbusIP mb;

Create the mb instance (ModbusIP) to be used.
mac byte [] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
ip byte [] = {192, 168, 1, 120};
mb.config (mac, ip);

Sets the Ethernet shield. The values ​​of the MAC Address and the IP are passed by the config() method. The syntax is equal to Arduino Ethernet class, and supports the following formats:
void config (uint8_t * mac)
void config (uint8_t * mac, IPAddress ip)
void config (uint8_t * mac, IPAddress ip, IPAddress dns)
void config (uint8_t * mac, IPAddress ip, IPAddress dns, gateway IPAddress)
void config (uint8_t * mac, IPAddress ip, IPAddress dns, IPAddress gateway, subnet IPAddress)

Then we have:
mb.addIsts (SWITCH_ISTS);

Adds the register type Input Status (digital input) that is responsible for detecting if a switch is in state on or off. The library allows you to set an initial value for the register:
mb.addIsts (SWITCH_ISTS, true);

In this case the register is added and set to true. If you use the first form the default value is false.
mb.task ();

This method makes all magic, answering requests and changing the registers if necessary, it should be called only once, early in the loop.
mb.Ists (SWITCH_ISTS, digitalRead (switchPin));

Finally the value of SWITCH_ISTS register changes as the state of the selected digital input.

What I don’t understand is: how do I tell my arduino when an input from the Modbus is active? I figure it has something to do with ‘‘SWITCH_ISTS’’ but I don’t know how to connect this switch to the switch on the other side of the Modbus.

I hope you understand what I mean

I hope you understand what I mean

At the moment, NO.

I refer you back to my question in Reply #6

With a bit of luck someone who knows more will come along.


I don't have any difficulties anymore with the LOGO. what I now don't understand is how do I use the Modbus TCP signal that comes from the LOGO in my Arduino code


I want to reply to this old topic for one reason - this topic is number 1 result in google when you search for "how to connect Siemens Logo with Arduino".

Modbus TCP/IP is supported since Logo version 8.FS4, it has model number 0BA0 bellow the OK button. There are older versions with the LAN port not supporting Modbus TCP/IP - 0BA8 and 0BA7.If that is enough for you, you can connect these older v8 modules together via ethernet and use the inputs and outputs of the remote modules.

Now back to the Modbus, Siemens Logo can work only as master (client), not as slave (server). If that is fine for you, you need buy the Modbus TCP to Modbus RS485 converter, for example on Aliexpress it cost around 15 USD, here is the module as screw mounting and as din rail mounting version.



And the arduino RS485 shield.


There are many Modbus libraries, most of them don't support all Modbus commands in exchange for their smaller size. Full Modbus support has this official Modbus library, but it has low memory issues on 2 kB RAM Arduinos, check also this library Modbus-Master-Slave-for-Arduino.

Good luck :slight_smile: