About me‎ > ‎

Web Server Project


Some days (months) back, I purchased this web platform (web server board) from the online store -- seeedstudio. The final application of this project is for my home automation (water heater, power monitoring, monitoring of my home entrance and car over camera etc) and this board will be a good web server.

This board has the following major parts: -

1. dsPIC33FJ128GP204 -- big flash to store the entire TCP/IP stack and enough pins for all external devices.
2. ENC28J60 -- SPI based Ethernet controller, very popular.
3. RJ45 connector for Ethernet connection with inbuilt magnetics.
4. FTD-232 serial to USB, works both as serial port (over USB, virtual). This is very useful for laptops as they do not have DB9 connector serial port. Moreover, the USB also supplies the 5V required for the board power. Hence no external power required.
5. Micro SD card connector.
7. 32.768KHz crystal connected to dsPIC for RTC (The picture above does not show the crystal, but my board has).
8. 3.3V LDO
9. Connector, if you need to use external power.
10. 13 external pins brought out (including analog pins) for external LCD/ sensor/ relay interface.
11. LEDs for power, status, serial communication.

With all these parts, I got the board shipped from HK to India for $40 (includes shipping), which I feel is perfect value for money. You can get more details from the following links: -

Dangerous Prototype SD card based web server
Hardware Design


Now that the hardware is taken care, lets concentrate on software. The board is intended to run the free TCP/IP stack provided by Microchip and there is already a copy of software on the website of Dangerous Prototype that provides the modified files (demo code) required to run the stack on this particular board. I tested the code and it works almost fine on this board.

But the problem is that, the demo code is based on the older version of stack released by Microchip. The latest release of stack from Microchip has many more features built in it. Hence, I took the task of porting the stack demo to this board by myself and share the details with everyone else.

Step - 1: Downloading the Microchip's TCP/ IP stack

The stack comes along with many other application code of Microchip such as USB, Graphics, SD card etc. The entire pakage is called Microchip Application Libraries which can be downloaded from this link -->
Link to MAL

During the time, I wrote this web page, the version of MAL is following.

Once downloaded, the installer will be a file as shown below --

Install the library into your computer.

Step - 2: Replacing files
The TCPIP stack demo provided  by Microchip is written for their development board. But for our webserver, we need to modify certain files. The files which needs modifications are shown below. There are 5 files in total.

The modified files are provided in the bottom of this web page. After modification, I have tested + verified. So, you can use them straight. The modifications were required because: -

1. Pins are different for SD card, UART, SPI etc. These modifications are in line with the demo code provided by Dangerous Prototype.
2. Web server uses the inbuilt FRC as its clock source.
3. TCP/IP demo provided by Microchip uses UART2, while our web server board uses UART1.

Basically, down load the code from the bottom of my web page and replace the same files from Microchip's installation with these files.

Step - 3: Opening Project
Our web server is based on SD-card and hence we will use the project as shown below --

Step - 4: Powering the board and Programming
If everything goes fine, the project should build without any error (+ 2 trivial warnings, which you can ignore).
Connect the board to your PC using Micro USB connector. The driver for FT232 needs to be installed from this link.
By now, the board is powered up (through USB).
Program the code into the device with a suitable programmer.

Step - 5: Web server content into SD-card
Please follow the following instructions

Once the contents are loaded on SD card, plug in the SD card into the connector provided on the board.

Step - 6: Board setup and menu on serial port
The following screen shots are self explanatory: -

Once the board is connected thro serial (virtual COM ports), press the reset button on the board.

Enter "0" and the router will assign an appropriate IP for the board.

I opened my router configuration and could see the IP assigned for the board: -

Step - 7: Running demo and viewing web page stored on SD card
Open browser and type in the IP number. The web page appears as shown below. You can control the LEDs of the board from the web page. There are many more controls possible, please refer to Microchip's documents.

Step - 8: Running TELNET
I could also establish a TELNET connecting between the web server board and my PC and this I feel, would be great for my future application of home automation. For establishing TELNET with the web server: -

Open command (Windows>Run>cmd) window and type "telnet 9761". Please note that is the IP number assigned for the board at my end. You might get a different IP number for your board. Also, 9761 is the port number.

Step - 9: Bug in the demo code
For some unknown reason, the webserver board keeps sending ARP packets "who has..."!! I believe, this could an existing bug in the Microchip TCP/IP demo. If somebody has a solution to this issue, please send me over email -- debrajdeb123[AT]gmail.com

Debraj Deb,
Apr 28, 2012, 10:21 AM
Debraj Deb,
Apr 28, 2012, 10:21 AM
Debraj Deb,
Apr 28, 2012, 10:21 AM
Debraj Deb,
Apr 28, 2012, 10:21 AM
Debraj Deb,
Apr 28, 2012, 10:21 AM