I've read that we can interface a microcontroller to the ethernet using ENC28J60 ethernet interface chip, but can I use the same to interface the controller with the internet? I've googled about it for over a month and i felt that there is no single proper explanation which covers all parts of this concept.

I got to know how to interface the ENC28J60 with the controller through SPI, and how to configure ENC28J60 IC, but then I ran into something called as a "TCP/IP" stack. Now this is supposed to be a set of internet protocols. But all I want to do is a simple webserver so isn't UDP/IP and ARP enough to do this?? why will I need TCP?

  • 1
    \$\begingroup\$ The HTTP protocol relies on TCP/IP so there's no way to avoid this, but perhaps you could explain the application and why you need the ENC28J60 a little further? Some microcontrollers can easily support a TCP/IP stack and there are ethernet devices available that embed the stack. \$\endgroup\$
    – PeterJ
    Jan 16, 2015 at 8:35
  • \$\begingroup\$ I wanna monitor my aquarium temperature using a LM35 sensor, and show the sensed temp on a webpage. And is there any way I can simulate ENC28J60 in proteus? Including the data packets? \$\endgroup\$ Jan 16, 2015 at 8:45
  • \$\begingroup\$ Just realised I thought you were using a PIC, but for an ENC28J60 which is a Microchip part as well it probably makes the most sense to use a PIC. I've never used Proteus but after a quick search looks like it does support simulating a ENC28J60. See if you get an answer to your other question about that but I have seen a lot of questions here about some of their simulations not being accurate as per a comment that someone left. \$\endgroup\$
    – PeterJ
    Jan 18, 2015 at 12:17

2 Answers 2


You can use the ENC28J60 over the Internet but to access your device from a web browser you will need TCP/IP support, from the Hypertext Transfer Protocol article on Wikipedia:

HTTP is an application layer protocol designed within the framework of the Internet Protocol Suite. Its definition presumes an underlying and reliable transport layer protocol, and Transmission Control Protocol (TCP) is commonly used.

The problem with UDP is that it's classed as an unreliable protocol, packets may not arrive at all and they can arrive out of sequence. If designing your own protocol you could add in your own packet sequencing and acknowledgment but that's not a part of HTTP so wouldn't work with a standard web browser. There's a few options I can think of:

  • Use UDP and instead of a web browser write a PC or phone app that sends a request to the temperature sensor for data that it can respond to. You can just retry if the packet goes astray and for a simple temerature reading the packet sequence shouldn't matter.

  • Do something like the above on your PIC but use a PC or embedded Linux board like a Raspberry Pi with a full TCP/IP stack to serve the latest temperature reading as a web page. You could have a background process to periodically poll the latest reading from the device for display.

  • Put a TCP/IP stack on the PIC along with something to directly respond to the HTTP GET requests. If you're using a PIC18 or better Microchip have a free TCP/IP Stack for PIC18, PIC24, dsPIC & PIC32 and while I haven't used it personally it does include a ENC28J60 driver.

There's a fairly good (although old) book called TCP/IP Lean that goes into detail on rolling your own TCP stack by taking a few shortcuts so it can fit in the smaller memory footprint of devices like a PIC16. That's pretty heavy going though so I think your best shot is likely to be using a PIC18 with a decent amount of FLASH / RAM and using the Microchip TCP/IP stack. There seem to be quite a few tutorials and YouTube videos on using it along with the ENC28J60.

  • \$\begingroup\$ I came across this amazing TCP/IP stack from tuxgraphic, this is so well written that it apparently fits into an ATmega88. But still I'm a little skeptical about implementing it because the code is not well explained. So I won't be able to customize it. \$\endgroup\$ Jan 21, 2015 at 19:44

Generally speaking, a microcontroller is way underpowered to be able to withstand the slams it would get from a direct connection to the Internet. In case you want to do this, you'd also have to implement TCP/IP on the microcontroller because that is the protocol spoken on the Internet. So, you most probably don't want to connect your microcontroller to the Internet that way.

What I would do: buy a SOHO Wifi AP/router box, which is capable of running Linux, and has a USB host port. Connect that box to the Internet, connect the microcontroller to the box through the USB port, with a TTL-level USB-serial adapter, and run the software interacting with the microcontroller on the box. The TCP/IP part is handled by the OS (Linux), and the web interface is provided by the software running on the box. And the microcontroller would only have to handle a serial connection, which is way easier to program.

Even though you could use ENC28J60 to connect your microcontroller to the box through an Ethernet LAN connection, there's usually no point in doing so: most microcontrollers provide a serial interface, and programming the serial interface on the microcontroller is a lot easier than programming the Ethernet interface.

Examples for the components:

SOHO router: Asus WL-500gp, TP-Link WR1043ND

Linux distribution: OpenWRT

TTL-level USB-serial adapter: Ebay


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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