Ethernet Module (HCARDU0028)

Wireless and wired modules including Bluetooth, Ethernet, and IR kits.
dimplehouse
Posts: 2
Joined: Sat Nov 10, 2012 6:29 pm

Re: Ethernet Module (HCARDU0028)

Post by dimplehouse » Tue Oct 15, 2013 10:30 pm

I am trying to get the Ethernet module working with the Mega 2560 but without success.

The example given is for a Nano - are the connections different for a Mega?

The module EtherCard.h shows the pinouts are:

// PIN Connections (Using Arduino UNO):
// VCC - 3.3V
// GND - GND
// SCK - Pin 13
// SO - Pin 12
// SI - Pin 11
// CS - Pin 8

SCK, for example, on the Mega is Pin 52

Am I missing something?

Graham

andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: Ethernet Module (HCARDU0028)

Post by andrew » Wed Oct 16, 2013 8:36 am

Try the pinout as in the comments but with D10 for the CS pin. It looks like it's wrong in the comments. Please let us know if this fixes it and we will correct the sketch.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

dimplehouse
Posts: 2
Joined: Sat Nov 10, 2012 6:29 pm

Re: Ethernet Module (HCARDU0028)

Post by dimplehouse » Sat Oct 19, 2013 7:35 pm

Finally got the Ethernet module working with my Mega 2560 by following guidance from http://en.code-bude.net/2013/06/22/how- ... mega-2560/

Enc28j60 Arduino Mega 2560
GND -->>GND
3.3 -->> 3.3V
SO -->> Pin50
SI -->> Pin51
SCK -->> Pin52
CS -->> Pin53


EtherCard example code modified as follows:

Code: Select all

if (ether.begin(sizeof Ethernet::buffer, mymac, 53) == 0)
  {
    Serial.println("Failed to access Ethernet controller");
  }
  else
  {
     Serial.println("Ethernet is fine and up");
  }

Dixo
Posts: 13
Joined: Thu Jun 06, 2013 4:20 pm

Re: Ethernet Module (HCARDU0028)

Post by Dixo » Fri Dec 20, 2013 11:53 pm

dimplehouse I take it your ethernet socket wasn't damaged from the wrong wiring the sketch came with then?

@Admin / andrew: Sorry my year has been horrible! I've not had chance to even think about replacing my duff arduino and probably won't bother now until another 3 ops are out of the way and i'm working again. I'm going to let you off the hook with m ethernet card and just hope it's ok when i can grab another ardy. If it ain't.. well.. I'll have to find another ether card when the time comes.

Thanks for your help anyway..

andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: Ethernet Module (HCARDU0028)

Post by andrew » Sat Dec 21, 2013 6:33 pm

Well as it is an existing problem reported some time ago, we can keep the return option open.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

derek_j
Posts: 1
Joined: Sat Jan 18, 2014 8:11 pm

Re: Ethernet Module (HCARDU0028)

Post by derek_j » Thu Jan 23, 2014 5:14 pm

Anyone using this module with Linux should be aware that the ethercard library throws up a lot of compiler errors when using the arduino package provided in many distros.

The problem is because the ethercard library uses a deprecated method of using progmem variables no longer supported by avr-gcc.
See https://github.com/jcw/ethercard/issues/11


Workaround is to either locate a copy of avr-gcc version 1.6 or older for your distro, or else get arduino from the arduino download page, but then there will be another problem. The version of rxtx included by arduino cannot write lock files. The workaround for that issue is to set chmod 755 on /var/lock

AlanWooler
Posts: 10
Joined: Thu Dec 04, 2014 9:30 pm

Re: Ethernet Module (HCARDU0028)

Post by AlanWooler » Fri Dec 19, 2014 8:35 am

Hi,
I got this device working on my Uno instanly but not on my Mega or Nano, so nice to see there is an answer for the Mega, but do you have any idea for the Nano? I am also soon hopefully going to buy a Micro from you, so any idea if this would be the same pins/code as the Nsano?

Anoher quick question, the sample code shows adding test, then the value of an anoloug input, do you know if it is possible to output the contents of a string? As what I would like to do is something like:

buffervalue="This is a Test"

Then output to the web page:

"Sensor string is: ", buffervalue;

I haven't had a chance to do any playing yet, so thought I would ask as you may be able to save me a lot of time.

Thanks in advance for any help that you can give.

andrew
Site Admin
Posts: 907
Joined: Sun Aug 05, 2012 4:15 pm

Re: Ethernet Module (HCARDU0028)

Post by andrew » Fri Dec 19, 2014 11:09 am

I got this device working on my Uno instanly but not on my Mega or Nano, so nice to see there is an answer for the Mega, but do you have any idea for the Nano?
The Nano uses the same microcontroller as an Uno so a Nano is effectively a cut down Uno. The library and sketch should be able to work in its unmodified state and with the same pin connections as the Uno. I would would give your connections to the Nano a double check in case you have a bad or wrong connection.
I am also soon hopefully going to buy a Micro from you, so any idea if this would be the same pins/code as the Nsano?
The Pro micro uses different pins for its SPI interface so it is unlikely that the library will work in its unmodified state. Probably for the same reasons as the Mega.
Anoher quick question, the sample code shows adding test, then the value of an anoloug input, do you know if it is possible to output the contents of a string?
In the example try using $S instead of $D

You may also want to have a look at the manual here:

http://jeelabs.net/pub/docs/ethercard/index.html

It's a bit complicated for beginners but some of the examples may help.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

AlanWooler
Posts: 10
Joined: Thu Dec 04, 2014 9:30 pm

Re: Ethernet Module (HCARDU0028)

Post by AlanWooler » Fri Dec 19, 2014 12:16 pm

Thanks for that Andrew, I will have a play hopefully over the next few days.

Scuba_2
Posts: 6
Joined: Thu Dec 11, 2014 7:41 pm

Re: Ethernet Module (HCARDU0028)

Post by Scuba_2 » Sat Feb 14, 2015 11:53 pm

Slightly worried now!
I thought I saw a post saying this used the standard library , which I have just about worked out with my current uno shield.
I bought a couple of pro minis and thought adding a small Ethernet module would be an inexpensive way to monitor my door lock over the internet.
It seems, these don't use the standard library , so any help on how to start ,with this module.
I'm fairly new to this, so be gentle :)
My final aim would be to monitor a lock ( micro switch status on or off ) and it would be nice if I could turn my air on on or off ( I have the code for ken sherriff IR library to do the turning on off), just need a sketch to put it in.
Any help would be great thanks

Post Reply