I want to give my project a simple web GUI to change config options. I know I could get a shield and write some horrible HTML in C but I'm wondering if there is a better way. Is there another IC I could get to help with this? What's the recommended solution for an embedded web server?
I'm currently using the ESP8266 modules. They are available for little money on eBay and the like and they provide a pretty nice Wifi-Module. You can even (and I would recommend that) be programmed by the Arduino IDE using some clever core that a few people built here: https://github.com/esp8266/Arduino
Using that you got a Wifi-Server built into the delivered Libraries that can provide basic functions. It can also output files from an SD card if available, there is an example for that.
Aside from that the module has a lot of Flash and you might not even need the Arduino if you don't need a lot of I/O, if you need a lot of I/O then you might want to communicate across a serial link. You will need to make sure to lower the voltage for the ESP, either use a 3.3V Arduino or build a level converter between the Arduino and the ESP, like this: http://www.hobbytronics.co.uk/mosfet-voltage-level-converter
It's not as easy as using a Wifi-Shield but it's very cheap to use.
The Arduino in combination with a wifi/ethernet module will not give you a lot of options to work with. There are currently no libraries that will give you features like including stylesheets, AJAX or websockets. If your project allows it, due to the number of I/O pins you need etc: replace your Arduino with a ESP8266
If you want to produce something fancy: go with the ESP8266. Getting everything setup and working will be a bit harder than with the Arduino, but it will be worth the effort. You can program it in Lua, but that will only give you access to some basic functions. Just write your program in C like you did on the Arduino. There is a thing called Sming framework which allows you to import Arduino libraries with only changing in few lines of code. The Sming framework also includes a HTTPserver with AJAX, websocket, POST/GET, pre-processing, and style/js-file inclusion features.
The web framework is easier than it is in most webframeworks for the pc! The hard part is installing the toolchain and uploading your first bit of code, but once you've got that done it will be easy to figure out the rest. The Sming framework also contains examples for everything you think of.
If you are planning on buying an ESP8266 I recommend you get a few. The basic ESP-01 cost around $2,40 on ebay, but get a fancier one too with a few extra IO pins. I have also got a development version which can be programmed with a USB cable. It is really usefull for developing your program since you don't have to connect a USB-serial device every time just plug a USB cable. When I think my program is done, I upload it to a more basic and replaceable version of the ESP8266 and fix it in my project.
So a summary: It will be harder to figure everything out, but once you've got everything done it will be worth the effort! Here are a few links:
This will show you the power of a ESP8266: ESP8266 oscilloscope with websockets video
The Sming framework: Sming framework github repo
You can buy an ethernet shield of any kind, ENC28J60, wifi module etc etc, and NOT do the html on the chip, just set it up as a server (usually specific the the shield/module you use).
Then you can actually create a local html file on your computer, or even use any webserver on your network or even online. As long as you send the commands to the local address of your arduino.
So if your Arduino ethernet module has the IP-address: 192.168.1.123 then the following form will send a command to the arduino that you can handle in the arduino code:
<form action="http://192.168.1.123/acommand=1"> <input type="submit" value="click to send command"> </form>
So if you create a simple web form to send a command to the arduino you can put this page anywhere, as long as the action is pointing at your arduino IP-address. If you want to go into the whole jquery standard it might be a bit different, unsure how asyncronious submits are handled.
I want to point out that IF you put your simple html page online you dont need to and SHOULDNT open anything in your firewall or router. The code will work as long as the device you are accessing the page from is on the same network as your arduino.
I personally find that one of the simplest solutions to a web server is one of the two following options.
Buy a serial cable, and transmit data using the Serial port on your Arduino. You can transmit data to a PC, and use PHP to read the serial port and display the data you would like.
Buy a Raspberry Pi. You will be doing the same as step 1, however you don't need a serial cable to use serial between Pi and Arduino. However you might need a 3.3V / 5V converter, which depends if the arduino serial port outputs data at 3.3V or 5V.
I would recommend getting a simple Wi-Fi and/or Ethernet module.
Then simply set up routes to receive and send data to Arduino (assuming
arduino_ip to be your Arduino's IP), and
POST being HTTP verbs:
Receive data from Arduino:
Send data to Arduino:
Now use any Web development Framework/Language (
Python) to receive and send data.
NO ADDITIONAL MODULES SOLUTION:
The above method will allow the arduino and server to communicate if they're on the same network. However, if you can constrain the server to be connected by
USB to Arduino, you can use
PHP) to directly communicate to Arduino.
Add a Raspberry Pi, have it connected to Arduino by USB (Arduino's
Serial), and the use Raspberry's Ethernet to bring in networking (Raspberry Pi can host a server itself)