MicroWebServer

From Wiki

Jump to: navigation, search
Features

Contents

Introduction

The MicroWebServer is a small Webserver using the popular ENC28J60 (produced by Microchip) and an ATMega168 AVR (Atmel).

It was designed to act as a platform for developing hardware-drivers for the ENC28J60 which still should be useful afterwards. In order to be useful, the MicroWebServer extends the unused I/O-pins to a 20 pole extension header that can be connected to another circuit board with relays, just to mention one example.

Hardware

Board

As you can see, the board-layout has been kept very common. Therefore it is possible to use this board in a versatile way. Still the board has become very compact by using SMD parts and small isolate values regarding the ground plane. The all-over size of the board measures 38x31mm². The board can be bought at IT-WNS Shop (Germany) either together with the needed electrical components or PCB-only. You can also make the PCB yourself and order the components at some random shop.

Voltage regulator

Among the electrical components there is a 3.3V fixed voltage regulator (LM1117). With an average drawn current of 150mA and with the approximately 1.1V dropout voltage, I have decided to set the mark of maximum input voltage to 7V and the minimum input voltage to 5V. The absolute minimum input voltage is 4.4V.

Attention
The generated 3.3V are also available on the 20 pol extension header. Be sure that you dont draw more than 350mA on this line when you use an input voltage of 5V (Already about 0.6W power dissipation!). If you are even using 7V as input voltage, you shouldn't draw that much current at all.

Ethernet-Jack

The IT-WNS Shop ships different versions of the kit, depending on what ethernet-jack is currently available. Therefore there are two different board-layouts, since the original MagJack SI-60024-F uses another pinout than the Halo FastJack™ HFJ11-2450E-L12RL or ERNI Modular Jack M3D01-203199. Moreover the pinout of the integrated LEDs isn't always the same, so either you accept that you have some swapped colors or you change the initialization word of the ENC28J60 chip, which needs a recompile of the project (See FAQ).

The mentioned ethernet-jacks integrate an isolating ethernet-transformer needed for the electrical isolation according to the ethernet specifications.

Extension header

The MicroWebServer offers a 20 pole extension header to connect the 14 I/Os to external periphery. The remaining 6 pins on the extension header are 2xGND, 2x3.3V and 2xVin. All of the 14 I/Os can be configured to act as an input or output. Some of the pins utilize a special function like for example an integrated I²C module (No integrated pull-ups on board) or a 10-Bit A/D Converter (Reference decoupling capacitor present on board) using a reference voltage of 3.3V or 1.1V integrated. Moreover there are pins having an output-compare function to produce PWM waveforms for example. Also all of the 14 I/Os can trigger a pin-change interrupt.

Software

Network-Stack

The uip-Stack is used to implement the upper network-layers (IP, ARP (Echo), ICMP, UDP and TCP).

Stack-Application

For demonstration purposes there is a usual webserver-application added to the download-package. This application takes place on the top of the stack (according to the OSI layer model). It implements a server for webpages that can be accessed by a regular internet browser. The server currently supports GET and POST request, to configure the 14 I/Os on the extension headers or set the output value of those. (HIGH +3.3V, LOW 0V)

Assembly

Necessary tools

  • Soldering iron (SMD capable)
  • Advanced soldering experience (0805-SMD, TQFP44)
  • Atmel AVR programmer with a 6 pin header and compability for 3.3V target voltage
  • Voltage source of 5V - 7V and at least 150mA

Mounting

  1. lower parts like 0805 capacitors/resistors
  2. ATMega168, ENC28J60 and LM1117
  3. crystal and remaining capacitors
  4. pinheaders
  5. ethernet jack
  • Don't heat up a single part too long
  • Solder carefully without creating short circuits
  • If necessary, use a magnifier or microscope while soldering

Setup

  1. Download sources (Downloads)
  2. Connect to network via RJ45 connector patch cable
  3. Connect voltage source to 2-pin header
  4. Connect programmer to 6-pin header
  5. Optional: Modify sources and recompile (See #Configuration)
  6. Flash HEX file into microcontroller using the programmer
  7. Modify Fuse-bits of AVR (LFuse: E0h, HFuse: DDh)
    1. Use ext. clock as clock-source (startup-time: 65ms)
    2. enable Brown Out Detector using 2.7V as threshold

After successfully programming the AVR, it automatically begins to initialize the ENC28J60 and switches to 12.5MHz main-clock. Now the green light of the ethernet should be glowing. This means that the ENC28J60 sensed an ethernet connection. The green light goes off while packets are being received. If packets are being sent, the red light begins to light up.

Attention
In case you want to alter the LED configuration, you have to adjust some #defines in the source. See FAQ.

If the configuration of step 5 hasn't been altered, the server should be available under the IP-address 192.168.0.55. For a quick function test, you can use the command-line tool "ping" to send out ICMP Echo requests:

ping 192.168.0.93

Configuration

Initial configuration:

  • MAC-address: 00:03:6F:55:1C:C2
  • IP-address: 192.168.0.93
  • Netmask: 255.255.255.0
  • Gateway: 192.168.0.254
  • WebServer-Port: 8080

The mac-address configuration can be altered in the file Hardware/Enc28j60.h. The IP-address, netmask and gateway can be changed within Main.c and the TCP-port of the WebServer can be configured in Net/TcpApps/HttpD.h. After every change you have done, you have to recompile the project. It is necessary to have a working installation of AVR-GCC in order to do this.

Personal tools
In other languages