One of the friendliest way was number 4 (Creating a temporary ad-hoc Wi-Fi network). This method was chosen by Twine and also by HeatMeter and Belkin WeMo.
In normal use, the device connects to the home Wi-Fi network as a client, then sends (http GET/POST) the collected data to a web server.
Sometimes, when the device needs to be configured, it creates its own Wi-Fi network and runs a local web server. At this moment it allows other Wi-Fi devices (PC, smart phone etc) to connect, as clients, to the local web server and send configuration data, specifically the name of the home Wi-Fi network and the password. Once this configuration data is acquired and stored internally (in eeprom), the device returns to its normal state and uses it to connect to the home Wi-Fi network.
The configuration mode is selected by the user. One simple method is by holding down a button after a reset. Another is by placing the device (which has on-board accelerometer or even a tilt sensor) in a specific orientation (as done by Twine).
Below are diagrams I drew to show these two modes of operation (configuration mode and regular use mode).
The steps are:
1.After reset, if a switch is pressed by the user, the board enters the configuration mode. This makes the Wi-Fi module a Wi-Fi server.
2.The user connects to it from laptop. Then user is presented with a web page that contains a form allowing the selection of the Wi-Fi networks that were detected, and the password.
3.These 2 elements (network name and password) are then saved in the eeprom. They will be used later to access the Wi-Fi network any time the sensor data gets sent to the collection web server.
1.Data is read from the sensor.
2.Sensor data is sent as an http POST request through the Wi-Fi module.
3.Wi-Fi module posts the sensor data to the web server.
A nice feature for a network-connected device is that it can get program upgrades remotely, "over the air" in the case of Wi-Fi. This requires a bootloader that can connect to the internet and checks if a new version of the program is available for download on a given web server. The Readiymate team wrote such a bootloader for ATmega1280/2560 (the processor(s) found on Arduino Mega).
The next diagram shows how the remote program upgrade would work.
The steps are:
1.Bootloader makes an http GET request through the Wi-Fi module.
2.Wi-Fi module passes the request the web server used for “program updates”.
3.Web server starts streaming the latest program file (sketch).
4.The sketch is uploaded into the program memory.