Arduino LLDP ENC28j60 and SSD1306 Oled I2C

Hi All

i can across simon's lldp tool https://molzy.com/blog/lldp-tool/ and struggling as the schematic and shopping list does not seem to match

i am no coder and basically trying to follow his project but not coming right

What i want to achieve is to display the following info

My Mac, My IP, Subnet, Gateway, DNS, Switch Name, Switch Port Number

i have the following

ssd1306 i2c oled disply 0.96

enc28j60 network module

arduino mini pro 5v 16

my pins are connected as follows:

Ethernet PINS to Arduino Mini

GND --> Gnd

VCC --> 5v

Reset -->

CS --> PIN 9

SCK --> PIN 13

SI --> PIN 11

SO --> PIN 12

WOL -->

INT -->

CLKOUT -->

SSD1306 LCD PINS to Arduino Mini

GND --> Gnd

VCC --> 5v

SCL -->PIN 4

SDA -->PIN 5

try this webserver works on a UNO OK so should work on a Pro Mini
note CS is on pin 10 so you need to change the ini() setting or your circuit

/*  Web Server  using a ENC28J60 ethernet shield

https://github.com/UIPEthernet/UIPEthernet

 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 modified 02 Sept 2015
 by Arturo Guadalupi
 
 */

// connections UNO, Feather 32u4, Due, MKRFOX, ESP32
 // ENC28J60 CS  UNO 10 CS    32u4 D10  10  MKR D5        ESP32 CS   GPIO5  setup with Ethernet.init()
 // ENC28J60 SO  UNO 12 MISO  32u4 MISO 14  MKR MISO D10  ESP32 MISO GPIO19
 // ENC28J60 SI  UNO 11 MOSI  32u4 MOSI 16  MKR MOSI D8   ESP32 MOSI GPIO23
 // ENC28J60 SCK UNO 13 SCK   32u4 SCK  15  MKR SCK  D9   ESP32 CLK  GPIO18
 // ENC28J60 RST UNO RES      not connected 
 // ENC28J60 VCC UNO 3.3V     32u4 3.3V     MKR 3.3V      ESP32 3.3V
 // ENC28J60 GND UNO GND      32u4 GND      MKR GND       ESP32 GND
 // ENC28J60 INT not connected

 // DUE is similar to UNO except use SPI pins (not pins 11 12 13) 

//#include <UIPEthernet.h>
#include <EthernetENC.h>
//
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);

// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(5);  // ESP32 
  //Ethernet.init(11);  // ESP8266 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  delay(1000);
  Serial.println();
  Serial.println("Ethernet WebServer Example");

  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);

  // Check for Ethernet hardware present
  if (Ethernet.hardwareStatus() == EthernetNoHardware) {
    Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
    while (true) {
      delay(1); // do nothing, no point running without Ethernet hardware
    }
  }
  delay(2000);    // added otherwise "Ethernet cable not connected" is displayed on some micros
  if (Ethernet.linkStatus() == LinkOFF) {
    Serial.println("Ethernet cable is not connected.");
  }

  // start the server
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");  // the connection will be closed after completion of the response
          client.println("Refresh: 5");  // refresh the page automatically every 5 sec
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("<br />");
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disconnected");
  }
}

Thank you, but not really anything to do with lldp and my oled.......

the idea is to use the Pro Mini to test each module in turn
the code of post 3 is a simple test of the enc28j60 network module
I have checked and it works with a Pro Mini 5V, e.g.

Ethernet WebServer Example
server is at 192.168.1.177
new client
GET / HTTP/1.1
Host: 192.168.1.177
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Sec-Purpose: prefetch;prerender
Purpose: prefetch
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8

client disconnected

web client display ADC values
image

do you already have the enc28j60 working?
if so what are you planning to test next?

once you know all the modules work independently you can start putting them together

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.