Porting the ethernet library from Arduino

@aruangra, it isn’t on the IDE as the library is not fully tested and/or working. You can find the library above:


From you test so far, does the TCP client works? It is all I need. Could you point me to how to connect to a server at an IP address and a port? Thank you.

I found this…

The library supports STM32F which is the same MCU as Particle Photon/Electron.

Has anyone tried it?


I try porting at this time.

If anyone tried compile already, and have any information please share it.

Best Regards


Great that you work on this platform. I am happy to help you test on Photon and Electron. Thank you.


I ported the ETHER_28J60 + Ethershield libraries:

It is the simplest library for the ENC28J60 ethernet module. See the comparison in

I mainly replaced some functions in enc28j60.cpp with those in the ethercard library ported by @peekay123

The compilation went well. However, the binary didn’t work. Please anyone see what is wrong. My code is here:

The module works fine with Arduino boards running either ETHER_28J60 + Ethershield or Ethercard libraries. I wired as follows.
SS -> A2
SCK -> A3
SO -> A4
SI -> A5
VCC -> 3V3
I am sure it is correct. See photos in my google drive.

Any input would be appreciated. Thank you.

Good news! The library works now. I accidentally set the CS pin to D5 instead of A2. The ported library in my google drive is updated.

Please use one .ino file when compiling.

1 Like


Great job on this topic @aruangra & @peekay123

I bought few of the ENC28J60 on Ebay (Link) and try to test @aruangra’s library since today.
I saw the IP address one time when I ran the command netstat -n
But the status was SYN_SEND
Unfortunately, now I don’t see this ip address anymore.
Green led is solid
Yellow led is blinking few times per second with the same frequency.
I tried both firmwares provided by @aruangra

By the way I try to import the library in the web ide
Is there a better way than copy/paste code from each file from the Arduino ide to the particle web ide ?
(I’m a newbie in library…)


Hey Aruangra,

Was wondering if you were willing to help with setting up ethernet (using the enc28j60) on my photon with your library?

EDIT: If @peekay123 is willing to chip in also, any help would be appreciated. =]

Hello @peekay123,

I am currently working on Particle Electron. I saw your code for Ethernet connectivity. My device is totally working on TCP client-server communication. In your code, I found code for udpserver. Can you help me how can I get the code for TCP server??


@djs07, which code are you specifically referring to. The work I did on Ethernet libraries was to port them only, not design them.

Hey @peekay123,

I was referring to this code:
Porting the ethernet library from Arduino

Aye! I’ve interpreted it in a wrong manner! Sorry for that.
Have you worked for designing, then?


@djs07, as you can see in the above posts, there are many options for adding Ethernet though none of them are designed to connect to the Particle Cloud like the wifi or GSM firmware does.

Other members are working on Ethernet libraries for the Particle devices. I am focused on wireless communications. My previous interest was limited to porting for a member only.

@peekay123, Thanks for the help. My main task is to route Particle Cloud on Ethernet. Guess I have miles to go! I’m rookie in Socket Programming, though. I hope I can DM you if I get stuck somewhwere.:grinning:

@djs07, what you propose is not trivial. You may want to look here:

1 Like

@peekay123, I’ve looked into that thread before. I’ve also thought of using RPi, but it adds much more space on my hardware as well as it’s not feasible for my application.

And yes, you’re right! It’s not trivial. But, won’t it be great to have such an Ethernet module? No doubt, it’s gonna take ample amount of time! But, what they’re doing is something great work.

Pardon me, though.Meant no offence on your thinking.
Thanks for the help, again.

P.S.: Sorry for my grammar! :sweat_smile:

@djs07, no offense taken! Though Particle’s focus is on wireless, having an Ethernet-based variant is absolutely a great idea. :wink:

@peekay123, Aye Aye, Captain! It is!
So, can I DM you for any query?(It won’t be soon, though!:smile:)

@djs07, not sure how much help I can be but yup! You might also want to express your interest in the other thread.

3 posts were merged into an existing topic: ENC28J60 with Electron