Arduino + ENC28J60 + Website = Problems

Hello everybody, I am living here with problems with my ENC28J60, already rolled the internet and have not found anything that works 100%, I searched here and in other forums, but people hardly wanted to do the same as me, so here we go.

I have a ENC28J60 and want to connect my arduino to this shield, and then connects them to a website, where there I can get information from sensors. Before research, I saw that they used the library "client.h " and also analyzed that there was an early form of connection, which looked like this:

byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { 192,168,0,6 }; // ip que o arduino assumirá
byte gateway = { 192,168,1, 1 }; // ip do roteador
byte subnet = { 255, 255, 0, 0 };

Also analyzed that in php for these connections to websites, have this snippet:

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
// Se conecta ao IP e Porta:
socket_connect($sock,“”, 8081);

Well, I guess that’s all information about my project and my doubt, I will also post the code I use to get the temperature sensor,

#include “etherShield.h”
#include “ETHER_28J60.h”

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24};
static uint8_t ip[4] = {192, 168, 0,6};
static uint16_t port = 80;

ETHER_28J60 e;

int analog;
float temperatura;

void setup()
e.setup(mac, ip, port);

void loop()
if (e.serviceRequest())
e.print(“Temperatura TESTE”);
e.print("Temperatura em Celsius: ");
analog = analogRead(0);
temperatura = (analog * 0.00488)*100;

In short: I can do local access with no problems, but I can’t put this on a website, use a website hoster, and it informs me the IP and Port of my site, then that’s personal, thank you!

I think you have two choices:

  1. Make the Arduino + ENC28J60 accessible from the public internet. This bypasses your "website hoster". But you probably don't want that for security reasons.
  2. Create an application on your website with two pages: one page for reading the temperature, that is accessed with a PC (or mobile, tablet, etc.) using a browser; the other for updating the temperature, which should be used only by the Arduino sketch. The Arduino would then connect to the second page periodically and write the temperature. Note that this is not a serviceRequest(), because a serviceRequest() requires the Arduino to function as a web server (as in choice 1): it is just a client request.

First try to make it happen using a PC and a programming language you know. If you can successfully read and update the temperature (just a test value) on your website then you will have a better idea of what you need to do on the Arduino.

Yes, security is very important in my project, I really need to use a host! :(

Do you have a example? I don't know how to start with this programming :/

I said before everything that I know about arduinoshield+website, if you know a site that could teach me, its okay too!

Thanks !!

Well I never used the shield myself, but I think you can start by planning more precisely what you want to do.

You will certainly need a web page to display the values. It can be written in php, if you know the language and your hosting service supports it. I'll talk about php, but the same applies if you are using python, or ruby, or server-side javascript, whatever.

You will have to think of some kind of authentication since this will be a page on the public internet. Php can manage authentication quite easily.

The important thing to consider is how this web page will get the values to display. They may be stored into a database or just a file. The choice depends on your hosting service and on your programming skills in the chosen language. There are very many examples around of php scripts that read from a db or a file and display the results on a web page.

On the Arduino side, the only thing the Arduino must do is to read the values from the sensors and call another page, used only to update the values. Then another php script on the host will extract the values and store them into the db or file. Again you'll have to think about authentication, but since the Arduino is more limited than a browser or tablet you'll have to keep it simple, perhaps just a password.

The Arduino will open a connection to the server and use a GET command or a POST command (more precisely, request a URL using the GET or POST method). They are almost the same, though POST would be more appropriate. And that will be all, until the next update.

If you search this forum you will find lots of examples of sketches doing exactly this, even complete ones. I have no link in my bookmarks but look especially for zoomkat's posts.

what arduino do you use?