Communication Problem Help(Arduino Mega+Ethernet Shield+Raspberry+Node-Red+MQTT)

Hello! I am trying to make a project using 1 mega arduino 2560 R3, 1 Ethernet Shield W5100 and a Raspberry Pi 3 Model b for the purpose of communicating the arduino (mega + ethernet shield) through the network using the protocol MQTT (mosquitto breaker) in the Node -Red. Well, I followed with the installation and configuration correctly of everything that was used to make this communication. I used these projects as references to complete the installation:
1 - Complete Guide to Home Automation - DO IT YOURSELF BLOG - HOBBYTRONICS PK

2 - MQTT with Arduino Ethernet Shield - YouTube

3 - Raspberry Pi 3 with Mosquitto, Node-RED, InfluxDB, Grafana and Nginx (as a reverse proxy) · GitHub

4 -

I really tried all these options and I was not successful. I tried to use these codes too and I did not succeed

#code 1

#code 2

The Node-Red communication appears as connected, but does not send or receive any data from the Arduino, it is as if it is not connected. The configuration images on the node-network:

One of the codes tested:

#include <SPI.h>
#include <Ethernet.h>
#include <PubSubClient.h>

//Definicoes de IP, mascara de rede e gateway
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192,168,15,10);          //Define o endereco IP
//IPAddress gateway(192,168,15,1);      //Define o gateway
//IPAddress subnet(255, 255, 255, 0); //Define a máscara de rede
IPAddress server(192, 168, 15, 16);

const int lightPin = 8;
const int buttonPin = 9;
int buttonState = 0;
int a=1, b=1;

void callback(char* topic, byte* payload, unsigned int lenght);

EthernetClient ethClient;
PubSubClient client(server, 1833, callback, ethClient);

void callback(char* topic, byte* payload, unsigned int lenght) 
  if(payload[0]== '1'){
    client.publish("outTopic","Light On");}
  if (payload[0]=='0'){
    digitalWrite(lightPin, LOW);
    client.publish("outTopic","Light Off");}

void setup() 
 pinMode(lightPin, OUTPUT);
 digitalWrite(lightPin, LOW);
 pinMode(buttonPin, INPUT);

 Ethernet.begin(mac, ip);
 if (client.connect("arduinoClient","pi","raspberry"))
      client.publish("outTopic","Hello World");

void loop() 
  buttonState = digitalRead(buttonPin);
  if (a== 1)
    if (buttonState == LOW)
     digitalWrite(lightPin, HIGH);
  if (b==1)
     if (buttonState == HIGH)
       digitalWrite(lightPin, LOW);

Could someone please help me, I will provide the information you need for me that can help me with this problem, I do not know what else to do to solve it. Thank you!