Is ENC28J60 supported


#1

Hi,

I’d like to use a nano instead of an uno for a project but need to use a enc28j60-based ethernet shield. Any support for this chipset yet?


#2

I’m sure you are like me and have several Nanos not being used and it makes sense to use what you have. But, if I wanted to install a smaller network capable board I would go with an ESP8266 . I have a couple of the Adafruit Huzzah ESP8266 break out boards running now.

Sorry I didn’t answer the real question, maybe @bestes or @rsiegel will chime in.

-Ian


#3

Ian,
Have to confess I’m not familiar with that board, but I might look at it if ENC28J60 is not supported (or a generic equivalent as Adafruit is not readily available in my part of the world). Which of the internet option sketches would one select to work with this board? Or is there more to using this board than I imagine (in my innocence). Thnx …Bren


#4

Brendan,

The ESP8266 is a microcontroller with built in wifi and a bunch of other stuff that I don’t even pretend to understand (Espressif product page). It can be procured as a bare module, or as a full dev board. It can be programmed via the Arduino IDE and acts a lot like an Uno in practice.

Arduino Uno sketches with minor tweaking

Craig did a quick tutorial here on how to get the code correct. If I can do it, anyone can.

Craig (@kreggly) just posted that he believes you should be able to get the ENC28J60 to work here. So maybe all this discussion is for naught.

Hope this helps,

-Ian


#5

Not for naught. The ESP is a great little board. Still doesn’t have the flash space for all his libraries though. I bet there is a lot more baggage that can be heaved though, but that’s another story.


#6

I’ve ordered this and will try it out myself when it comes in. In the meantime, let me know if you can get it to work! There was some discussion here about it you might want to check it out:
Ethernet module enc28j60

-B


#7

Hi @bestes, so did you try ENC28J60?
Or anyone else?


#8

Hi @akuljana,

I have had it next to me for a week and haven’t had the change to try test it out :frowning: Hopefully someone else is able to test it out.

-B


#9

@akuljana, @bestes,

As a start, I’d try this:

1. Install the Arduino UIP library https://github.com/ntruchsess/arduino_uip.
2. Create a Cayenne sketch say with a Uno and a W5100 shield.
3. Replace #include <CayenneEthernet.h> with the following:
    #include <UIPEthernet.h>
    #include <BlynkSimpleUIPEthernet.h>
    #include <CayenneDefines.h>
    #include <CayenneEthernetClient.h>

Give that a try and let me know.

Cheers,

Craig


DHT11, DHT22 Sensors
#10

Man!!!

THAT’S WORKS FOR ME!!!
I’m using A.Nano, used your code and now I’m able to connect with my ENC28J60 module!

My code:

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
#include <CayenneDefines.h>
#include <CayenneEthernetClient.h>

// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "YourToken";

void setup()
{
	Serial.begin(9600);
	Cayenne.begin(token);
}

void loop()
{
	Cayenne.run();
}

Thank you!


#11

@eteroxee,

That’s awesome! @bestes, another module verified.

Craig


#12

That’s excellent, thanks for the feedback.

I’ve moved this topic to the FAQs category to make it a little easier for someone to find @kreggly’s solution until we have official in-platform support for this module.


#13

I’m so happy to help the community, thank you! :blush:
Here is a working system with a DS18B20 temperature sensor, and an LED. It also works with the incredible If-THEN trigger, so now I can make a thermostat that is connected to the internet!!!
WOW!

//#include <UIPEthernet.h> //I've switched it off since the code works without this
#include <BlynkSimpleUIPEthernet.h> //Interesting, why a Blink library needs :-), but the code doesn't work without this
#include <CayenneDefines.h>
#include <CayenneEthernetClient.h>

//Include DS18B20 temperature sensor, just for example
#include <OneWire.h>
#include <DallasTemperature.h>

//The key for Cayenne dashboard
char token[] = "YourToken";

//Defining PINs for LEDs
#define LED_VIRTUAL_PIN 1
#define LED_DIGITAL_PIN 6

#define VIRTUAL_PIN 2 //Define virtual pin for DS18B20 temperature sensor
const int tmpPin = 7;

OneWire oneWire(tmpPin);
DallasTemperature sensors(&oneWire);

void setup()
{
  Serial.begin(9600);
  Cayenne.begin(token);
  sensors.begin();
 }


    CAYENNE_IN(LED_VIRTUAL_PIN)
    {
      // get value sent from dashboard
      int currentValue = getValue.asInt(); // 0 to 1023
      analogWrite(LED_DIGITAL_PIN, currentValue / 4); // must be from 0 to 255
    }

    CAYENNE_OUT(VIRTUAL_PIN)
    {
    	// Send the command to get temperatures.
    	sensors.requestTemperatures();
    	// This command writes the temperature in Celsius to the Virtual Pin.
    	Cayenne.celsiusWrite(VIRTUAL_PIN, sensors.getTempCByIndex(0));
    	// To send the temperature in Fahrenheit use the corresponding code below.
    	//Cayenne.fahrenheitWrite(VIRTUAL_PIN, sensors.getTempFByIndex(0));
    }

    void loop()
    {
      Cayenne.run();
    }

#14

Hi guys.

i am trying with uno and enc28j60…this way i didn’t success…

please can you help me?
tks…


#15

Just a little addition: if it is about being able to use a Nano or even a Promini, as the reason to use an enc28j60 module… there also is a w5100 module.
The enc28j60 is a bit memory hungry and i reckon the great UIPEthernet lib is a bit memory hungry too, so there will not be much memory left.

Having said that… I believe both the enc28j60 as well as the w5100 module cost a few bucks (say 5 usd) which is more than the ESP8266, so it is a bit of a judgement call if one wants to invest in one of those modules


#16

Hi,

Im working on enc28j60 lan module. i tried all these codes and something experimental. I need some help to mix suitable library and cayenne sketch.

    /*
This example shows how to connect to Cayenne using an Ethernet W5100 shield and send/receive sample data.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Set the Cayenne authentication info to match the authentication info from the Dashboard.
2. Compile and upload the sketch.
3. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.
*/

//#define CAYENNE_DEBUG       // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space

#include <UIPEthernet.h>
#include <BlynkSimpleUIPEthernet.h>
#include <CayenneEthernetClient.h>

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "fe756de0-dd8f-11e7-a824-91d417d3812a";
char password[] = "219cc6c5876e82689773149ad14b0ad1b176aeb5";
char clientID[] = "9ed184e0-128d-11e8-9beb-4d400e603e7e";

void setup() {
  Serial.begin(9600);
  Cayenne.begin(username, password, clientID);
}

void loop() {
  Cayenne.loop();
}

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
  // Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
  Cayenne.virtualWrite(0, millis());
  // Some examples of other functions you can use to send data.
  //Cayenne.celsiusWrite(1, 22.0);
  //Cayenne.luxWrite(2, 700);
  //Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
  CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
  //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}