I'm thinking about an Arduino project that involves having an Arduino host a basic web server and then connect to a wifi network using a wifi shield or something along those lines. You could then connect to the Arduino via the network and control it.

Most of that sounds very feasible, however, how do you initially setup an Arduino on the wifi network? How does the Arduino determine which wifi network to connect to, if there are more than one? And what happens if its a protected network? And once the Arduino is on, how would one determine it's IP address.

I know, a lot of this stuff could be hard coded into the Arduino's code, but what I'm theorizing it that this could actually be a product that could be sold on shelves. So it would have to be easy to use and flexible for the average joe at home.

It seems like the Arduino device would HAVE to have some sort of LCD screen and basic controls/buttons on it so you could connect to the network and input the secure password, etc... Is there any other way to do this?

  • \$\begingroup\$ @Jakobud - The generally accepted protocol is to wait 24-48 hours to accept an answer. This gives everyone time to compose a response, and makes sure that you get the best solution to your problem. You're free to select, change, or retract your accepted answer at any time, but you may want to wait a while. In the meantime, upvotes are a good way of saying "Thanks for answering quickly." \$\endgroup\$ Nov 22, 2011 at 17:28

2 Answers 2


How you tell the WiFi shield how/what to connect to is purely down to the shield. There will probably be a library, and that library will have functions you call.

How you then get that data from the user is entirely up to you.

Yes, an LCD and buttons is probably the easiest way.

Either that or you have some other interface to the Arduino (Serial over USB is the simplest as it already exists) that the user uses to configure the system using a PC. Once configured the system can be disconnected from the PC and will be stand-alone.

  • \$\begingroup\$ LOL, Yes I know the shield uses networking libraries to connect. I was more asking about how a user would get it to connect. Initialization via plugging into a PC is something I hadn't considered... \$\endgroup\$ Nov 22, 2011 at 16:42
  • \$\begingroup\$ Most things like routers / wifi access points, etc all require you to use a cable to do the initial configuration. \$\endgroup\$
    – Majenko
    Nov 22, 2011 at 16:50
  • \$\begingroup\$ Some routers allow clients to connect using push button authentication.. but you still need to tell the Arduino which network to Query.. damn.. problem NEARLY solved. \$\endgroup\$
    – Piotr Kula
    Nov 22, 2011 at 16:57
  • \$\begingroup\$ @ppumkin I believe that technology then requires your device to be able to do some sort of handshaking and then hold on to a key that it is given by the router. Most likely the shield wouldn't have this built in so you would either have to find a library that will or write your own. \$\endgroup\$
    – Kellenjb
    Nov 22, 2011 at 17:01
  • \$\begingroup\$ Yet another reason why the Arduino + WIFI shield is not a good not a good choice to do this. \$\endgroup\$
    – Piotr Kula
    Nov 22, 2011 at 17:16

This answer is based on the OP's question. mainly taking into account

but what I'm theorizing it that this could actually be a product that could be sold on shelves.

Well this is how i would do it - if i were forced to use and Arduino instead of an Arm based chip.

If you are going to host a webserver on the chip, then you need to write some admin code for it too. By default you would have the actual device you are building HOST peer-to-peer WIFI connection over an unsecured network. So you can use any laptop and connect to to it.. Viola- You are in the system without any LCD on the Webserver that you designed.

In the admin panel of the webserver you would have a script/page that scans the netowork for aviable network points, lets you choose one, enter the key and click save/connect.


Your disconnected form the peer-to-peer wifi connection and your arduino connects to your wifi and aqcquires a new IP via DHCP. You then have the device configured.

EDIT[ Since a comment says that ad-hoc might cause wifi scanning issues jsut prooved the arudino is not a great way to use wifi with. You would need your computer to scan the WIFI- then pipeline it to the arduino with the correct settings- entered manually- reset and then BOOM! ]

Keep in account there needs to be a reset button on the arduino to reset back to peer-to-peer mode incase you change your network or your router dies and you get a new one.

Using Arduino i assume you will have an WIFI shield, and a WEBSERVER Shield driven somehow to ineterconnect all this mess into something useful?

Problem with Arduino is that it is really bad at handling anything more than drawing some nice shapes on a small LCD screen.

If it was me- I would find a chip based on the ARM that uses the same C code that Arduino does but has got 32mhz/64mhz or 100mhz - which makes working with WIFI allot faster , and especially using lighttpd+php5 on a tinyLinux(as light as 2megabytes with pre compiled drivers into kernel) on it will be greatly improved and save you years of rewriting device specific codes and networking protocols.

You can then interface with the WIFI network faster than the 115kilobaud that serial will allow you on the Arduino.

Those chips do not cost much more than an Arduino and there are tons of code snippets available.

Another option would be to use a BlueTooth module that will connect with PushButton Authentication and write some software for your Android/iPhone or Server on your Netbook that connects via SPP (Serial Port) - You can get Bluetooth Modules that have upo to 20 Metre range with a bigger antenna and boosted signal. That would be more feasable way to control an Arduino without having any front end (webserver) at all!

When you come to realise that you want to realise this to the market and find that using a LCD screen and all the necessary things that go with it-- increase your cost "just to connet to wifi" - thats when you wills start asking your self- how to get rid of all the un necessary bits and bobs.

Dont reinvent the wheel. The Arduino is too weak to be released for anything more than a wireless temperature monitor on 433mhz..

  • \$\begingroup\$ I could potentially see some issues with being in ad-hoc mode and then scanning for other networks. I could see some shields not being capable of scanning for other networks while in ad-hoc mode. \$\endgroup\$
    – Kellenjb
    Nov 22, 2011 at 17:03
  • \$\begingroup\$ Thats odd- most likely the library or interface does not support it. But it does give another option - check edit. \$\endgroup\$
    – Piotr Kula
    Nov 22, 2011 at 17:13
  • \$\begingroup\$ Why ARM? Are they giving you a cut? I'd choose the chipKIT™ Uno32™ or Max32™ as they use the PIC32 at 80MHz and are code-compatible with the Arduino. \$\endgroup\$
    – Majenko
    Nov 22, 2011 at 19:53
  • \$\begingroup\$ Why not Ti-CC25xx SoC / MSP430? Why not 8086? Why not anything else apart arduino \$\endgroup\$
    – Piotr Kula
    Nov 22, 2011 at 19:58
  • \$\begingroup\$ Arduino = ATMEGA328&FTDI on a board with some software for noobs on it. It's easy to learn, but possibilities are limited. Hook 2 'big' shields together and the memory is full. Yes you can make one webserver, but I don't think people fancy a webserver with only 3 pages. The platform with ARM and tinyLinux on it is a whole different project. That involves a MCU with MMU, external memory, good supply and custom firmware. Boom, ton of time, costs etc. I think a chipKit is capable of doing a lot more than just a standard arduino which might be sufficient. \$\endgroup\$
    – Hans
    Nov 22, 2011 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.