Hi,
First of all I probably should start with usual thing and point out that im no expert in the field.
Anyhow; I've been trying for a while to get communication going between a Siemens LOGO V8.3 and my arduino.
I don't think the Siemens LOGO is the issue since I simulated being the slave useing ModScan64 and I see that both the Coil and the value im sending on a Holdingregister from the logo are being sent.
But when I serial print the same coil and HR useing the arduino I get nothing. I've tried with 2 different arduinos (MEGA from AZ and a original UNO REV3) and even tried with 2 different shields (an original W5500 and a W5100 from AZ)
I really need some help. I do get a feeling that either i'm doing something wrong or they simply can't talk too eachouter.
I've tried different librarys and ways, but without any success. I even tried chatGDP for the first time, bu no no.
Now you guys are my last chance. This is one of the codes I've tried. This time I tried to listening to several coils and writing to several coild from the LOGO, but nothing recieved:
#include <SPI.h>
#include <Ethernet.h>
#include <Modbus.h>
#include <ModbusEthernet.h>
int HR_Value;
bool CoilValue;
bool CoilValue1;
bool CoilValue2;
bool CoilValue3;
bool CoilValue4;
bool CoilValue5;
bool CoilValue6;
bool CoilValue7;
bool CoilValue8;
bool CoilValue9;
bool CoilValue10;
bool CoilValue11;
ModbusEthernet mb;
void setup() {
Serial.begin(9600);
// MAC and IP address
uint8_t mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
uint8_t ip[] = { 192, 168, 0, 177 };
// Configuring Modbus Ethernet
delay(2000);
Ethernet.begin(mac, ip);
delay(2000);
mb.config(mac, ip, 502);
// Adding Holding Register and Coil
mb.addHreg(0);
mb.addCoil(1);
mb.addCoil(2);
mb.addCoil(3);
mb.addCoil(4);
mb.addCoil(5);
mb.addCoil(6);
mb.addCoil(7);
mb.addCoil(8);
mb.addCoil(9);
mb.addCoil(10);
mb.addCoil(11);
void loop() {
// Modbus task
mb.task();
HR_Value = mb.Hreg(0);
CoilValue = mb.Coil(0);
CoilValue1 = mb.Coil(1);
CoilValue2 = mb.Coil(2);
CoilValue3 = mb.Coil(3);
CoilValue4 = mb.Coil(4);
CoilValue5 = mb.Coil(5);
CoilValue6 = mb.Coil(6);
CoilValue7 = mb.Coil(7);
CoilValue8 = mb.Coil(8);
CoilValue9 = mb.Coil(9);
CoilValue10 = mb.Coil(10);
CoilValue11 = mb.Coil(11);
Serial.print("HR Value: ");
Serial.println(HR_Value);
Serial.print("Coil1: ");
Serial.println(CoilValue ? "ON" : "OFF");
Serial.print("Coil2: ");
Serial.println(CoilValue1 ? "ON" : "OFF");
Serial.print("Coil3: ");
Serial.println(CoilValue2 ? "ON" : "OFF");
Serial.print("Coil4: ");
Serial.println(CoilValue3 ? "ON" : "OFF");
Serial.print("Coil5: ");
Serial.println(CoilValue4 ? "ON" : "OFF");
Serial.print("Coil6: ");
Serial.println(CoilValue5 ? "ON" : "OFF");
Serial.print("Coil7: ");
Serial.println(CoilValue6 ? "ON" : "OFF");
Serial.print("Coil8: ");
Serial.println(CoilValue7 ? "ON" : "OFF");
Serial.print("Coil9: ");
Serial.println(CoilValue8 ? "ON" : "OFF");
Serial.print("Coil10: ");
Serial.println(CoilValue9 ? "ON" : "OFF");
Serial.print("Coil11: ");
Serial.println(CoilValue10 ? "ON" : "OFF");
Serial.print("Coil12: ");
Serial.println(CoilValue11 ? "ON" : "OFF");
delay(2500);