gabriel
Active Member
Offline
Posts: 135
Thank You
-Given: 287
-Receive: 60
|
|
« on: June 28, 2015, 03:18:56 15:18 » |
|
Hello: I bought an ethernet to serial converter recently, is it possible to make an embedded web server using it and a PIC micro? and how? any useful link is appreciated
thank you
|
|
|
Logged
|
|
|
|
|
akacalo
Newbie
Offline
Posts: 9
Thank You
-Given: 9
-Receive: 2
|
|
« Reply #2 on: July 07, 2015, 11:29:28 11:29 » |
|
I think you can do it. Here I explain you, in a very simple form, the phases your web server needs to do to proccess a request 1- Analyze the headers of the requests, this wil tell you what resource are the client looking for. A very simple example:GET /index.html HTTP/1.1 -> This is the request method (GET or POST are the most common, but you can implement others like PUT or DELETEi) Host: example.com -> This is the host that the client is connecting to, I think you won't need to analyze it, unless you want multiple domains in same ip, which are very complex to implement Content-Type: text/html -> This obviously, is the content type, you usually will get this if your client wants an html page
2- Write the response headersHere you send the response headers. Here is an example: HTTP/1.1 200 OK -> his is the code for an ok request, also there are other codes 404 Not Found, 403 Forbidden and 500 Internal Server Error are very simple codes Content-Type: text/html -> This you send what type of data are you sending, text/html for html, text/xml for xml or text/plan for a txt file. Content-Length: number -> You here put the size of the data you want to send.
3- Send two CRLF to separate the headers from the content4- Send the contentsI hope you find this useful. WOW, I have used OpenWRT, but didn't know that there are adapters with OpenWRT!
|
|
|
Logged
|
|
|
|
h0nk
Senior Member
Offline
Posts: 257
Thank You
-Given: 226
-Receive: 231
|
|
« Reply #3 on: July 07, 2015, 04:42:54 16:42 » |
|
Hello Gabriel,
i would be wise to specify Your adapter more exact.
The range spans from "old" Printservers with a serial port, over Lantronix X-Ports, Equinox Ethernet-Serial Consolboxes to modules with Ralink/Atheros/... SoC's and many more...
Some require an external Controller to implement a HTTP-protocol, some are already equipped with a embedded Webserver.
Best Regards
|
|
|
Logged
|
|
|
|
gabriel
Active Member
Offline
Posts: 135
Thank You
-Given: 287
-Receive: 60
|
|
« Reply #4 on: July 08, 2015, 06:19:41 06:19 » |
|
|
|
|
Logged
|
|
|
|
pablo2048
Active Member
Offline
Posts: 113
Thank You
-Given: 136
-Receive: 86
|
|
« Reply #5 on: July 08, 2015, 07:02:20 07:02 » |
|
The second one You mentioned already has web server built in, but its not supported by OpenWRT yet (and seems to be little overpriced to me compared with RM04). For the first one i didn't find any open source firmware but only the datasheet here http://www.oomipood.ee/kasutusjuhend/USR-TCP232-T24_EN.pdf so no luck here :-(
|
|
|
Logged
|
|
|
|
akacalo
Newbie
Offline
Posts: 9
Thank You
-Given: 9
-Receive: 2
|
|
« Reply #6 on: July 08, 2015, 12:32:04 12:32 » |
|
With that you have to implement an entire web server in the pic, as I semi-explained before. As @pablo2048 mentioned a one with open wrt will be very simple to implement a web server, because is based on Linux and you can manually compile lots of open source web servers.
But if you need to have a web server on a pic this is the best choice, I am playing with it now and seems very good.
|
|
« Last Edit: July 08, 2015, 12:36:15 12:36 by akacalo »
|
Logged
|
|
|
|
UKFlyer
Newbie
Offline
Posts: 25
Thank You
-Given: 41
-Receive: 17
|
|
« Reply #7 on: July 08, 2015, 05:09:53 17:09 » |
|
Google "MM2: Web controlled Thermostat"
This has code (Basic so easy to read) that shows how to use a ethernet to serial converter (happens to be a wireless version but this has no impact on the code) to create a simple web site
|
|
|
Logged
|
|
|
|
h0nk
Senior Member
Offline
Posts: 257
Thank You
-Given: 226
-Receive: 231
|
|
« Reply #8 on: July 08, 2015, 06:52:18 18:52 » |
|
Hello Gabriel, the main controller on Your ethernet to serial adapter is an LPC1114F from NXP. This is an ARM-M0-Core which should capable doing the HTTP-stuff. With Google You should find some projects with this combination (LPC1114F ENC28J60). E.g.: https://developer.mbed.org/users/ban4jp/code/uIP-1-0_webserver/file/685224d2f66d/dev-enc28j60But You have to check, if You will be able to reprogram the main controller. You may use a serial bootloader, a JTAG-adapter or if the LPC1114F supports this a SWD (Single-Wire-Debug)-Adapter. Good luck, and Best Regards
|
|
|
Logged
|
|
|
|
bigtoy
Active Member
Offline
Posts: 238
Thank You
-Given: 337
-Receive: 297
|
|
« Reply #9 on: July 09, 2015, 04:40:38 04:40 » |
|
I know the OP was asking about PIC, but how about Arduino? Lots of easy-to-use stuff available there, and cheap. https://www.youtube.com/watch?v=Xj7BQMd0wc8
|
|
|
Logged
|
|
|
|
akacalo
Newbie
Offline
Posts: 9
Thank You
-Given: 9
-Receive: 2
|
|
« Reply #10 on: July 10, 2015, 12:07:07 00:07 » |
|
Arduino is very good to view library developed on top of it for controlling different modules and then port to pic c language, like Ccs or xc.
If you do a search on GitHub.com you will find a lots of open source projects that may help with your project.
|
|
|
Logged
|
|
|
|
gabriel
Active Member
Offline
Posts: 135
Thank You
-Given: 287
-Receive: 60
|
|
« Reply #11 on: July 10, 2015, 06:31:01 06:31 » |
|
Yep, I'll switch to arduino, very simple, cheap, too much libraries and books
Thanks all!!
|
|
|
Logged
|
|
|
|
hammerhead
Inactive
Offline
Posts: 6
Thank You
-Given: 7
-Receive: 1
|
|
« Reply #12 on: December 03, 2015, 06:01:13 06:01 » |
|
Actually, the PIC makes a pretty good little embedded web server. I've used both the PIC18F67J60 and PIC32MX795F512. The 67J60 has an integrated MAC/PHY so it's a nice little all-in-one. It is lacking in horsepower if you want to do anything with SSL so I moved to the PIC32 for more recent projects. Both have eval boards and free TCP/IP stacks from Microchip with working demos that are easily reconfigured to suit your application.
|
|
|
Logged
|
|
|
|
|