Skip to main content
Bumped by Community user
Bumped by Community user
deleted 84 characters in body
Source Link

I'mI am using ENC28J60 with theand EthernetENC library and trying to connect myan Arduino UNO with ATmega328 to the network. Everything works fine within the local network, but outside of it, theI cannot ping doesn't go throughthe device. What could be the problem? The network configuration issettings are 100% correct (other devices work fine). Only the AdvancedChatServer example, and examples from the Ethernet library can be pinged. Other examples do notalso respond to pings at all).

I'm using ENC28J60 with the EthernetENC library and trying to connect my Arduino UNO with ATmega328 to the network. Everything works fine within the local network, but outside of it, the ping doesn't go through. What could be the problem? The network configuration is 100% correct (other devices work fine). Only the AdvancedChatServer example from the Ethernet library can be pinged. Other examples do not respond to pings at all.

I am using ENC28J60 and EthernetENC library to connect an Arduino UNO with ATmega328 to the network. Everything works fine within the local network, but outside of it, I cannot ping the device. What could be the problem? The network settings are 100% correct (other devices work fine, and examples from the Ethernet library also respond to pings).

deleted 28 characters in body
Source Link

I amI'm using ENC28J60 andwith the EthernetENC library to tryand trying to connect my Arduino UNO with ATmega328 to athe network. ItEverything works fine within the local network, but outside of it, the ping does notdoesn't go through. What could be the problem? The network settings areconfiguration is 100% correct (other devices are working normallywork fine). TheOnly the AdvancedChatServer example from the Ethernet library was able tocan be pinged for a while, but after some time, it stopped responding to pings. Other examples do not respond to pings at all.

I am using ENC28J60 and EthernetENC library to try to connect Arduino UNO with ATmega328 to a network. It works fine within the local network, but outside of it, the ping does not go through. The network settings are 100% correct (other devices are working normally). The AdvancedChatServer example from the Ethernet library was able to be pinged for a while, but after some time, it stopped responding to pings. Other examples do not respond to pings at all.

I'm using ENC28J60 with the EthernetENC library and trying to connect my Arduino UNO with ATmega328 to the network. Everything works fine within the local network, but outside of it, the ping doesn't go through. What could be the problem? The network configuration is 100% correct (other devices work fine). Only the AdvancedChatServer example from the Ethernet library can be pinged. Other examples do not respond to pings at all.

Source Link

The gateway is not working in Arduino EthernetENC

I am using ENC28J60 and EthernetENC library to try to connect Arduino UNO with ATmega328 to a network. It works fine within the local network, but outside of it, the ping does not go through. The network settings are 100% correct (other devices are working normally). The AdvancedChatServer example from the Ethernet library was able to be pinged for a while, but after some time, it stopped responding to pings. Other examples do not respond to pings at all.

////////////////////////////////////// Settings //////////////////////////////////////
#define DHCP false          // true/false
#define CUSTOM_MAC true     // true/false

#if CUSTOM_MAC              // if true you can enter your custom mac address
#define MAC 0x00,0x5f,0x1C,0x05,0x5f,0x1C
#else
#define MAC 0x00,0x5f,0x1C  // Organizationally Unique Identifier (OUI)
#endif

#define IP_ADDRESS  192,168, 11,242
#define SUBNET      255,255,255,248
#define GATEWAY     192,168, 11,241
#define DNS         192,168, 11,241


// #define UIP_CONF_MAX_CONNECTIONS 0
///////////////////////////////////// Libraries //////////////////////////////////////
#include <Arduino.h>
#include <EthernetENC.h>  // Include the Ethernet library
#include <Agentuino.h>    // SNMP library
#include <EEPROM.h>
#include <microDS18B20.h>
/////////////////////////////// Arduino sensor pins //////////////////////////////////
#define TEMPERATURE_1_PIN 0
#define TEMPERATURE_2_PIN 1
#define TEMPERATURE_3_PIN 2
#define TEMPERATURE_4_PIN 3
#define SENSOR_220V_PIN   4
#define SERVO_PIN         5
#define LED_ALERT_PIN     6
#if !SOUND_MUTE
#define SPEAKER_PIN       7
#else
#define SPEAKER_PIN       8
#endif
#define FLOOD_PIN         A0
#define DOOR_PIN          A1
#define GAS_PIN           A2


///////////////////////////// Ethernet / SNMP init ///////////////////////////////////
#if !DHCP
IPAddress ip(IP_ADDRESS);   // IP Address for arduino
IPAddress gateway(GATEWAY); // Gateway for arduino
IPAddress subnet(SUBNET);   // SubNet mask for arduino
IPAddress myDns(DNS);       // DNS for arduino
#endif

byte mac[] = {MAC};

//////////////////////////////////// My OIDs /////////////////////////////////////////
...
//////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////// function SNMP resived ////////////////////////////////
void pduReceived(){...}
//////////////////////////////////////////////////////////////////////////////////////

void setup(){
  ///////////////////////////////// init pins ////////////////////////////////////
  pinMode(TEMPERATURE_1_PIN, INPUT);
  pinMode(TEMPERATURE_2_PIN, INPUT);
  pinMode(TEMPERATURE_3_PIN, INPUT);
  pinMode(TEMPERATURE_4_PIN, INPUT);
  pinMode(SENSOR_220V_PIN, INPUT);
  // pinMode(SERVO_PIN, INPUT);
  pinMode(FLOOD_PIN, INPUT);
  pinMode(DOOR_PIN, INPUT);
  pinMode(GAS_PIN, INPUT);
  pinMode(LED_ALERT_PIN, OUTPUT);
  #if !SOUND_MUTE
  pinMode(SPEAKER_PIN, OUTPUT);
  #endif

  ////////////////////////////// init other //////////////////////////////////////
  Serial.begin(9600); // Serial monitor init
  Agentuino.begin();  // Begin Snmp agent on Ethernet shield

  ///////////////////////// Generate random mac address //////////////////////////
#if !CUSTOM_MAC
  if (EEPROM[0] == 255 && EEPROM[1] == 255 && EEPROM[2] == 255){
    for (int i = 3; i < 6; i++){
      randomSeed(analogRead(A5)); 
      mac[i] = random(0xFF);
      EEPROM.put(i - 3, mac[i]);
    }
  }
  else{
    for (int i = 3; i < 6; i++){ 
      EEPROM.get(i - 3, mac[i]); // Reed saved mac addres from EEPROM
    }
  }
#endif

#if DHCP
  Ethernet.begin(mac) // Initialize Ethernet Shield in DHCP mode
#else
  Ethernet.begin(mac, ip, myDns ,gateway, subnet); // Initialize Ethernet Shield in static mode
#endif

///////////////////////////////////// Debug //////////////////////////////////////
Serial.println();
Serial.println();
  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println(F("Ethernet shield was not found.  Sorry, can't run without hardware. :("));
    while (true) {
      delay(1); // do nothing, no point running without Ethernet hardware
    }
  }
  if (Ethernet.linkStatus() == LinkOFF) {
    delay(500);
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
  }

  Serial.print(F("localIP: "));
  Serial.println(Ethernet.localIP());
  Serial.print(F("dnsServerIP: "));
  Serial.println(Ethernet.dnsServerIP());
  Serial.print(F("gatewayIP: "));
  Serial.println(Ethernet.gatewayIP());
  Serial.print(F("subnetMask: "));
  Serial.println(Ethernet.subnetMask());
  Serial.print(F("mac: "));
  for (int i = 0; i < 6; i++){
    Serial.print(mac[i], HEX);
    if (i <= 4) Serial.print(F("."));
  }
  
  Serial.println();
  ////////////////////////////////////////////////////////////////////////////////
  
  Agentuino.onPduReceive(pduReceived);
  delay(10);
}


void loop(){
  Agentuino.listen();

  //////////////////////////////// Other code ////////////////////////////////////
  ...
  ////////////////////////////////////////////////////////////////////////////////
}