Stryfeduino – Part 2 – It’s alive

By | 8. July 2016

Ethernet


This section will be specifically about the ENC28J60, if you wan’t to use a W5100 please take a look at this guide on instructables.

Installation

First up I have to say I’m a little bit embarrassed – In the first part I didn’t think everything through and now it’s time for an adjustment. The interior of the Nerfgun only has one spot to fit the ENC28 module and that’s of course exactly the same spot where I positioned the power toggle switch. The good news: We can fix it without leaving a trace.

Stryfeduino - RC - 34 - Enc28 fitting

Remove the toggle switch and mark the outlines of the RJ45 socket around the hole for the switch. To make room we can take a side cutter, make some rough cuts inside the marked space and use a file to clean out the edges. One side won’t be enough space for the RJ45 socket, so we have to remove a little bit from the other side as well. Then we use the holt melt adhesive to keep the ENC28 in place.

Stryfeduino - RC - 35 - Ethernet space ripped Stryfeduino - RC - 36 - Ethernet space cleaned Stryfeduino - RC - 37 - Ethernet space counter part Stryfeduino - RC - 38 - Ethernet mounted 2

Wiring

There are some ENC28 modules that work with 3.3V and some that work with 5V. I ordered some with 3.3V because I wanted to use them with the Arduino ProMini – Well I got the 5V version delivered. Since this information is not visible on any part of the board, I found out the hard way: Even though the 3.3V aren’t enough to make the connection, the thing is so evil and makes the LEDs blink just fine as if it should work. Finally, in all my rage I decided to connect them to my Arduino Nano with 5V expecting some magic smoke, but they just worked fine as they should.

Since I’m rather lazy when it comes to sending stuff back, we can just supply the 5V power with the already stripped down USB. So if you get the right modules use the 3.3V from the Arduino ProMini.

Stryfeduino - RC - 39 - Nano enc28j60

ENC28Arduino
VCC+5V or +3.3V depending on your module
GNDGND
CS8
SI11
SO12
SCK13
INT3
#include <EtherCard.h>
 
static byte mymac[] = { 0x74,0x69,0x69,0x2D,0x30,0x31 };
 
byte Ethernet::buffer[700];
 
void setup () {
  Serial.begin(9600);
  Serial.println(F("\n[testDHCP]"));
 
  Serial.print("MAC: ");
  for (byte i = 0; i < 6; ++i) {
    Serial.print(mymac[i], HEX);
    if (i < 5)
      Serial.print(':');
  }
  Serial.println();
 
  if (ether.begin(sizeof Ethernet::buffer, mymac) == 0)
    Serial.println(F("Failed to access Ethernet controller"));
 
  Serial.println(F("Setting up DHCP"));
 
  if (!ether.dhcpSetup())
    Serial.println(F("DHCP failed"));
 
  ether.printIp("My IP: ", ether.myip);
  ether.printIp("Netmask: ", ether.netmask);
  ether.printIp("GW IP: ", ether.gwip);
  ether.printIp("DNS IP: ", ether.dnsip);
}

void loop () {}

If everything is up and running we should see the acquired IP Address, DNS and Gateway information in the serial monitor.

Stryfeduino - RC - 40 - Serial Monitor

Leave a Reply