I am a newbie to ethernet controller. I need to use ethernet controller to send sensor data to our server using http get method. I went through ENC28j60 documentation and microchip's TCP/IP stack as well. But I couldn't find a proper example similar to my project.

briefing my application below.

PIC18F4520 will read some sensor data and send it to server every 3 minutes. for example sensor data are voltage,current,temperature etc. It should push these data using http GET method to an URL like abc.com/index.php/add/add_data?volt=dc_volt&current=dc_cur&temp=temp. Where dc_volt,dc_cur and temp are the measured values in microcontroller. How can I do this using ethernet interfacing? Atleast what are the things I should learn to do this? Can I do this with the Microchip TCP /IP stack?

any help is appreciated.



3 Answers 3


Yes this is possible with TCP/IP stack. I think you should not directly jump into reading some sensor data and send it to server every 3 minutes, instead try to build the demo app provided by Microchip and access their webpage (or your own page).

Microchip provide TCP/IP library which is included in Microchip Application Libraries v2013-06-15(MAL). Download and install MAL on your system. Build the the TCP/IP demo app and upload it on your MCU. Connect the LAN cable between ENC28J60 and your PC. If everything went ok, then you can open the TCP/IP Discoverer Tool which is found in C:\microchip_solutions_v2013-06-15\Microchip\TCPIP Stack\Utilities, to get the IP address. Enter the IP address in your browser and you can access their default webpage.

Now next thing you have to do is build your own webpage and put all web files inside webpages folder. So next time when you enter the IP address in browser, it will open your webpage. In the code you will have to put some dynamic variables to get and post data to your webpage. I cannot explain everything here. But you can read below tutorials which include everything you want.

Part 1: Web based monitoring

Part 2: Web based control

Part 3: Advanced web based control

You can watch these video tutorials for step by step explanation tutorial1 tutorial2 tutorial3

  • \$\begingroup\$ Thanks a lot. Such a precise explanation. This is exactly what I was looking all over the web. \$\endgroup\$
    – Vishnu.P
    Commented Dec 11, 2015 at 10:25

HTTP is not a "push" protocol. Normally, your Windows/Linux/OSx client would use a GET method to GET the data from the PIC18F4520. The Microchip TCP/IP stack will respond to GET requests.

The Microchip TCP/IP stack does not include a web browser like IE or FireFox or Safari, that send GET requests. There is nothing in the stack to send GET requests.

You can modify the stack to send anything at any time, and you can write a Windows/Linux/OSx client to listen for what your sensors are sending, but that requires more work than simply using the Microchip TCP/IP stack.

A simple method would be to use something like CURL to send a GET request to the Microchip part. The Microchip stack can understand GET requests, and there are examples provided that showing it replying with different types of data. you just need to connect up your sensor to a variable, so that the stack has a value to send in the reply.

  • \$\begingroup\$ According to this, you can encode this information in a GET request via URL parameters. en.wikipedia.org/wiki/Query_string \$\endgroup\$
    – Daniel
    Commented Dec 11, 2015 at 3:40
  • \$\begingroup\$ Thanks for the reply. My application is data logging. I should send data in a format I mentioned above so that the server will process it. First I done the application using arduino with ethernet shield and UIP ethernet library and it is working fine. For GSM/GPRS connectivity I've done using PIC16F877A with SIM900 module. In both the cases I used HTTP get method to send data to server. I need to integrate both ethernet and GSM/GPRS connectivity in one device. So we decided to go for a PIC controller with higher memory (PIC18F4520). \$\endgroup\$
    – Vishnu.P
    Commented Dec 11, 2015 at 4:38
  • \$\begingroup\$ Thanks David. We do have a web page from which user can monitor the sensor data. So the device is supposed to send the collected sensor readings to the server using either GPRS or ethernet. I have implemented both and it is working. But when it comes to interface ethernet IC enc28j60 with PIC I got lost. \$\endgroup\$
    – Vishnu.P
    Commented Dec 11, 2015 at 4:46

Considering that you are a "newbie", I think you should keep it simple. The ENC28J60 is a complex and low-level Ethernet controller. If Microchip provides a driver for it, that's great, but I would not want to write one!

Consider using something like a WIZnet module that would allow you to send TCP packets directly. There is a lot more done for you there, and writing an HTTP client is relatively simple.

Even consider using a Raspberry Pi for something like this. You can just write shell scripts to read the data and send it out to a web server! That thing really is amazing.

Unless you're just trying to learn something about the Microchip parts, don't feel bad about using these amazing and cheap components that are available.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.