Here is the very basic webserver implementation, featuring only the Ethernet interface, and the minimum software, that runs a local webserver. This leaves very little room for additional logic. The problem is the ENC28J60’s mini TCP/IP stack uses a lot of the Atmega8’s available flash memory. It comes as a small WEBSERVER, configured as 192.168.2.24 in code, and supports a DS18B20 temperature sensor connected to the PC4 pin, as well as a DHT-11 temperature and humidity sensor, to show the temperature via the web interface:
CODEVISION 1.24 MEGA2560 SOFTWARE
Here is the software to get this running. It will work well, especially if you don’t have other devices connected via SPI. The webpage shows the number of times it has been accessed.įor a simpler variant, you can skip the buffer and just connect the ENC28J60 module directly to the Atmega8. The firmware replies to PINGs which are counted and displayed on the LCD and on the Atmega webpage.
CODEVISION 1.24 MEGA2560 CODE
In my sample I’ve used, but you’ll need to change the code for a new IP that matches your network settings. I made it as a simple webserver, to open TCP port 80, so you can connect with your browser but you need to provide a few parameters. The software I’ve prepared for this article, comes with a minimalistic TCP/IP stack supporting IP, ARP, UDP and TCP, based on the original work of Guido Socher and released under GPL V2 license. SO goes to MISO, SI to MOSI, SCK to SCK, I have connected CS to PB2(SS/OC1B) and INT to PD2 (INT0). Now you are ready to connect it to the Atmega8.
CODEVISION 1.24 MEGA2560 HOW TO
Here is how to connect the Ethernet board to the SN74LS125AN buffer. The board takes 3.3V so make sure you use a regulator. I’m currently using only INT,SO,SI,SCK,CS, VCC and GND. The connector exposes CLKOUT, INT, WOL, SO, SI, SCK, CS, RESET, VCC and GND.
Here is the circuit diagram for these boards: Correcting this, solved the problem and the boards were ready for use. Looking carefully I’ve noticed the crystals are soldered improperly and were shorting a few paths of the circuit. I bought two, and both refused to show any led activity. When the 3.3V are applied and the network cable is connected, the two leds green and yellow should turn on from time to time. For the Ethernet chip I purchased a simple board from Ebay, featuring the enc28J60 chip, the 25MHz crystal, the magnetic ethernet connector, and a few other components: He also sells ready made Ethernet boards that are extremely well built and will save you considerable time for such a project. I have decided to use a buffer, as indicated by Mirek, from Poland, here. There are numerous reports of issues caused by the voltage difference in the SPI link. The solution is a good starting point, but it has lots of issues like: no buffering between the microcontroller and the Ethernet chip, microcontroller takes CLK signals from the Ethernet chip, not being able to run at various values, not a chance at 16MHz as I need it. I found the original project posted on tuxgraphics. The two chips must communicate using the SPI interface. My Atmega8 will use an external crystal, and run at 16MHz. Here is how to use Atmega8 and enc28j60 together for an Ethernet capable application. Now I have to build everything from scratch, and the target microcontroller is an atmega8, so the little program memory must be considered. It’s not my first time working on microcontrollers and Ethernet interfaces, last time I’ve used an Arduino board with Ethernet shield for a voice control application.