1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Free PIC Web Server (under development)

Discussion in 'Microcontrollers' started by TiagoSilva, Jan 24, 2010.

  1. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    Hi,

    I'm thinking (I'm on the thinking phase yet) about making a free PIC based web server project to place on my personal web page, I already have (too much) parts, but I don't know what to choose, should I go with PIC18, PIC24 or PIC32 ?
    I'm proficient with programming, so, making a web server is nothing that much to me, but, I still have some issues when working with microcontrollers. Oh, I will be using Microchip C (their libraries are very useful).
    To store the website files I will add a SD storage card.
    To control the PIC pins and get some values (temperature, clock, voltages, etc…) I will use get/post on a virtual (not stored anywhere) PIC generated page
    I had this idea on the bed... This way I can cook a nice looking flash or java based web page with gauges, buttons and all those nice looking controls without running out of PIC memory!

    What I have (to work with):
    Some PIC18F67J60 (but guess what, TCP/IP stack with BSD support doesn't support this PIC…), some ENC28J60, some PIC32MX340F256, some PIC24HJ256GP206, some PIC18F6720, some PIC18F2610 and some other bigger and smaller (pin count).


    The final device would be to (examples) control house lights, water the garden, open or close doors/windows, check their status, to remote control greenhouses, to check on oven temperatures, etc…


    What I’m really asking of you is help to choose the best platform to make a simple and small (circuit and board) design, and yet, polyvalent (at the software and peripherals level), so, based on your own projects what do you think? What is your advice? Or just comment!
     
  2. kchriste

    kchriste New Member Forum Supporter

    Joined:
    Jul 23, 2006
    Messages:
    3,677
    Likes:
    47
    Location:
    Victoria BC, Canada
    Since you want it expandable, go for the PIC with the most MIPs, memory, pins, etc. I would use PIC32 or PIC24.
    Microchip already has sample code for a Webserver where you can read the ADC and control LEDs via a web page.
     
    Last edited: Jan 24, 2010
  3. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    I know about their Web Server software but I haven’t explored it yet, but, I seriously doubt they're using the same logic I described, but this is nothing new, just different ;)
    Microchip is eager to flood the market with PIC32’s, I could give them a hand :) And about the ENC chip, do you recommend this one or the 100base-T ones?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Wilksey

    Wilksey Member

    Joined:
    Aug 16, 2009
    Messages:
    553
    Likes:
    20
    Location:
    Somerset, UK

    I have explored their webserver stuff, and all of the tcp/ip examples that come with the stack and developed upon that stack, all of the things you mention are possible. I haven't used any SD or MMC device with the PIC's yet, as that would require a file system of some kind I presume like FAT12 / 16, from the sounds of what you want to acheive a 100 MBp/s controller chip would be wasted IMO, but for development / research, why not.

    You can achieve what you want with some transistors, a PIC18LF4620 (or a 18F4620 with level shifting chip) and a ENC28J60.

    The provided MCHIP example for a web server is quite good in terms of ADC for temperature and input / LED outputs etc.
    And it updates dynamically which is quite good. I believe they use an EEPROM to store their data.

    So. in short, if it was me, I prefer a bit of space when prototyping so I have room to "maneouver" so to speak, I would use a PIC18LF4620 an EEPROM and an ENC28J60 chip.
    I would really like to use a PIC with embedded controller, but I through hole prototype so I have put it off so far.
     
  6. kchriste

    kchriste New Member Forum Supporter

    Joined:
    Jul 23, 2006
    Messages:
    3,677
    Likes:
    47
    Location:
    Victoria BC, Canada
    Yea, I can't see the advantage of using 100base since a PIC will not be able to come close to saturating a 10base connection. The only reason for using 100base would be if you wanted to connect it to a 100base network via a hub. Good switches and routers are so cheap today and hubs are a really crappy solution on a busy network so I can't see why you'd use one anyway.
    It looks like MicroChip has the TCP/IP Stack for PIC18, PIC24, dsPIC, and PIC32 MCUs so you are covered for most of the families.
     
    Last edited: Jan 24, 2010
  7. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    For some time I've been toying with a PIC based web server kit (actually using the PIC18F67J60). I assume BSD support means Linux.
    Here's what I've noticed, many computer savvy folks now have home servers. Be it a Linux LAMP or Windows Home Server (I'm running Linux Clark Connect free version) an excellent, useful and very stable system that is alas I/O poor.
    So I've halted work on the PIC web server in favor of using something as an I/O expander for a Linux / WHS server. The USB based UBW came to mind as an excellent starting point (I have another thread on this in these forums) Just add a few relays and opto inputs and IMO this would be an pretty handy solution for a home automation system.
    It might even work with Linux based routers with USB ports.
    Below is an example of Linux on a WRT54G router
    http://www.batbox.org/wrt54g-linux.html
    Just my 2c
     
    Last edited: Jan 24, 2010
  8. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    Only means that they follow the API design by Berkeley University. The code use structure follows this example:
    Server (TCP based):
    1 - Initialize (Do all necessary support configurations)
    2 - Bind (Port and IP)
    3 - Listen (Starts listening for incoming connections)
    4 – Accept (Gets a remote client socket to communicate with)
    5 – Close (Closes the socket, no further communication possible)
    I did knew about Linux for the WRT54G, I didn’t knew about this distribution thou, if you search you will get Linux open Hotspot software, I even worked in a small company that was offering a commercial product based on this open source Linux for WRT54G distribution… (lol if they find out) I think it is based on this: OpenWrt
    I want to make something easy and small like a matchbox!
    I was going towards to the PIC32 and since the project is for an intranet like environment, 10base-T (2 cable pairs) would be nice.
    I don’t want to add level shifters or buffers to convert 5v to 3,3v levels, which would only make the board bigger.
    I want to design something free and small like this not free marvel: Computer and Device Networking Solutions - XPort Pro - World's Smallest Linux Networking Server - Lantronix
    Ok, getting real now, not that small but a matchbox small is enough.

    What do you think?
     
  9. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    Ok, that is just for sightseeing, its marketing, that only means that the offer a TCP/IP stack that work with the ENC chips, and this means that all PICs having SPI bus will have TCP/IP stack support too  Although, it’s a different story with PICs with built-in Ethernet support, only a restrict few are supported… Unfortunately.
     
  10. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    If you want it as small as the lanport not likely. Why not just get a lanport? Seems to have what you need.
     
  11. DirtyLude

    DirtyLude Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    1,904
    Likes:
    56
    Location:
    Toronto, Canada
    There have been loads of PIC Web projects. Do something new and use one of the new Coretex-M3 chips with the integrated MAC/PHY on them. Something like the LPC 17xx, the Luminary Micro 6xxx, 8xxx, 9xxx.
     
  12. blueroomelectronics

    blueroomelectronics Well-Known Member

    Joined:
    Jan 21, 2007
    Messages:
    12,536
    Likes:
    168
    Location:
    Toronto, Canada
    Tiago. Is this a one off project or are you planning to make kits or just start a repository?
     
  13. mudassir_semiconductor

    mudassir_semiconductor New Member

    Joined:
    May 16, 2006
    Messages:
    19
    Likes:
    0
    i made web server which controls .... or automate by mirco controller (atmel 89c51) but storage was system itself.
     
  14. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    I want to make a free available project that can be further developed. I don’t want to rely on Linux either. No OS.

    This is an off project and it is to start a repository, of course that if people start to ask if I sell kits I might take care of this too, why not.

    I might also make a pro-version (software would cost a little more) and a lite-version (free open source code !). But this is just a thought, it is not set yet.
     
  15. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    I know about these Luminary ICs, they are very small, but the ones that have internal MAC/PHY have 100 pins, PIC32 has only 64, and If I go lower I can get less pins too, the ENC chip gives all network I need as the others agree :) And I already have development tools for Microchip devices and some experience. And I’m not full of money on my pockets to start buying ARM development boards lol :)

    This project will be new! My idea, if I didn't make myself clear was to develop a simple device with outstanding ease of use, anyone capable of coding HTML would be able to use this device! The controls would be made be a simple POST/GET data transfer, and the overall status would be made by dynamically generating a XML page with all the info about peripherals and pins!
    Want anything newer than this? :p
     
  16. DirtyLude

    DirtyLude Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    1,904
    Likes:
    56
    Location:
    Toronto, Canada
  17. hantto

    hantto Member

    Joined:
    Oct 25, 2002
    Messages:
    380
    Likes:
    1
    Location:
    Finland
    I say go for it!
     
  18. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    Who would have guessed…?! I know this web site, but this article is new to me… and thinking that this was new, hmm, now here’s a new dilemma, PIC24, I don’t have one small like this one… I only have the 64 pins ones, should I get some small PIC24 like the ones they use or should I change a little and build a PIC32 based ?
    As I said, this is an off project, as such, there are no hurries, I have time to learn PIC32, I’m also new to the PIC24, and I only have some experience with the PIC18 and PIC16 families…
    I you were me which would you choose? (I will also take samples from their code :p, but I’m guessing it would be no hassle changing from PIC24 to PIC32, I think Microchip also has some papers on this matter)
    Is this wise? Or should I just get a smaller PIC24 (the one on their project)?
     
    Last edited: Jan 25, 2010
  19. DirtyLude

    DirtyLude Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    1,904
    Likes:
    56
    Location:
    Toronto, Canada
    I don't use PIC's. But to give you an idea on what to look for, speed is not really an issue here, the only thing I would look out for is FLASH memory. I've done this already, but I used a Z8 Encore! chip. All I can say is that 24k was definitely not enough to put all the functionality I wanted on it and I didn't need to put a TCP/IP stack on it like you do, so I later made one with a AT91SAM7. I would have liked to have been able to log data to SD card as well as just read pages and report over HTTP, but putting both the FAT16 read and write with all of the other code was too much for the 24k of flash. All I did was use special codes within the HTML pages that the uC would scan for when serving them up. If it found the code, it would insert whatever data the code was for, so there were codes for pin statuses, ADC values, sensor readings...

    ...and it's not that expensive to do ARM development. $50 for a USB JTAG programmer. The free GNU based development solutions are pretty annoying, though. I just went with a personal license for Crossworks, which has worked out great. Also it means I have a single programmer/debugger and development environment for a large range of chip classes; OS class ARM9, specialized ARM7, super cheap Coretex-M3, and low power Coretex-M0 so far. They've pretty much replaced everything else I worked with.
     

    Attached Files:

  20. TiagoSilva

    TiagoSilva Member

    Joined:
    Feb 15, 2004
    Messages:
    207
    Likes:
    1
    Location:
    Portugal, Lisbon
    Well, that’s what ASP and PHP technologies is all about, he he he, pre-hypertext processing. Which in this case is also a good idea, but, will delay the page data transfer a bit (a lot?) I’ve made some simple servers in C# dot Net 2.0 and Java SE (all non embedded languages, at least for now), and such thing would slow the client connection’s thread.
    My idea on using Post/Get system will work when you use HTML and Javascript, or Flash and or Java Applet based web site. Almost every browser today has these features available, so, I’m thinking in doing this way.
    I’ve always liked ARM a lot more than MIPS… The only thing was the damn expensive prices on the development tools… I love cortex, it is small, and it is 32 bits…
    You are almost making me changing my mind lol, one last thing left before I change!
    Free C libraries for ARM based microcontrollers? Where can I find a (free) TCP/IP stack with Berkeley API support? If you provide me a free (or trial) IDE, easy to use like visual studio or MPLAB, or a Plug-In for eclipse IDE or other good free IDE… and lots of libraries, with TCP/IP, SPI, FAT16/32 file support, etc… ?
     
  21. Wilksey

    Wilksey Member

    Joined:
    Aug 16, 2009
    Messages:
    553
    Likes:
    20
    Location:
    Somerset, UK
    If theres one thing i've learnt over the short space of time i've been doing electronics, and i'm sure some of the golden oldies will tell you on this board, the best practise is to keep it simple and then expand upon that.
    Yes it would be nice to have an ARM9 super processor churning out all kinds of things, but the question is, do you really need it? All PHP and ASP.NET do is expand upon the CGI technology (Common Gateway Interface). C# and Java are both interpreted languages, they heavily rely on a framework around them. Embedded systems are much more resilient to time processing, apart from the main stack operations, Microchip kindly offer a lot of assistance in the form of example source code when it comes to modern day applications for the PIC processors. I've even found some through hole versions of the dsPIC, excellent for prototyping.

    The TCP/IP stack will fit and then some onto a PIC18F4620 processor, yes you need a level shift or go for an LF or a embedded chip as previously mentioned in this post.

    A PIC24 would be a good start if you "have on lying around", but think about what you actually want to acheive as an end result.

    It's a bit like going into a computer store and buying an all singing all dancing gaming PC just to run MS Word on or browse the internet for example, you could do the same on a lot less power.

    My advice would be to start simple, then move on from there.

    But you need to decide what platform you are going to build it on first, the PIC would be a good one, as it is a good way to show non-believers how powerful a PIC can really be (especially a PIC18).
     

Share This Page