Project tutorial
Get Connected! WiFi Registration Using AP Mode!

Get Connected! WiFi Registration Using AP Mode! © Apache-2.0

Stop reflashing your devices everytime the WiFi password changes! Learn how to use anduinoWiFi and AP mode to initiate WiFi registration!

  • 23 respects

Components and supplies

Apps and online services

About this project


So I've just spent an "all nighter" working on this new IoT device that's going to change the world. The sun comes up, and I'm off to demo the device and pitch to my friends for some seed capital and soul crushing criticism. I get to their house, turn the device on, it won't connect... quickly I realize the device is still flashed with my home WiFi credentials. Time to quickly edit my code, reflash, and demo. But wait...there's a better way!

AnduinoWiFi ships with an example sketch, 'connectToWiFi'. With just a few lines of code you can add device hosted WiFi registration to any of your WiFi enabled prototypes. When the device first boots up it broadcasts it's own WiFi hotspot and serves a WiFi registration page at Once you enter the SSID and password anduino attempts to connect to the network you've just specified. Voilà internets!

Getting Started

In order to add end user facing WiFi registration to your arduino prototypes you'll need to make sure you've cloned the anduinoWiFi library and loaded it into your Arduino IDE. As long as you're using anduinoWiFi, or any WiFi101 enabled arduino, you should be able to immediately run the example sketch 'connectToWiFi'. This sketch runs the device registration process, hosts an access point named 'Anduino WiFi', and serves the registration page at

Open the serial terminal at 115200, join the 'Anduino WiFi' on your laptop or phone, enter your home WiFi SSID and password, and then follow along in the terminal. If all goes well you'll see something similar to this returned in the serial terminal.

SSID: Anduino WiFi 
Device IP Address: 
signal strength (RSSI):-100 dBm 
Registration server Running at  
  • Registration mode is ready.
GET /register HTTP/1.1 
Connection: keep-alive 
Cache-Control: max-age=0 
Upgrade-Insecure-Requests: 1 
User-Agent: Mozilla/5.0 (Macin...
  • We've received a request from your laptop or phone for the registration page!
POST /enterCredentials HTTP/1.1 
Content-Type: application/x-www-form-urlencoded 
  • Now we've received your submission with the SSID and password query args! Time to attempt to connect to the local WiFi...
Attempting to connect to SSID: Andium 
With password: totallynotthepassword 
Success! Connected to... 
SSID: Andium 
Device IP Address: 
signal strength (RSSI):-50 dBm 
WiFi connected  

Success! We're connected, lastly the 'connectToWiFi' example sketch attempts to connect to a web server...

char testSite[] = "";     //we'll connect and GET / to test our WiFi connection 

And GET/ the '/' root directory. If your local WiFi has a internet and no proxy settings you should see the web server's '200 OK' HTTP response header and then a ton of html stream across the terminal. It worked!

How can I add a device hosted WiFi registration process to my sketch?

Well that's a mouthful, I'm glad you've asked! In your sketch you'll want to include the library at the top and create you're own instance of the anduinoWiFi() class:

#include "AnduinoWiFi.h" 
AnduinoWiFi newWifi = AnduinoWiFi();

Next, within your setup() routine:

newWifi.begin("Anduino WiFi"); 

Begin AP mode and name your WiFi Access Point SSID (just replace "Anduino WiFi" with whatever you'd like to name the local network) This next chunk just creates the the wifi registration listener and waits until AP mode is disabled. Just below that add:

WiFiClient regClient; 
 //While we're in AP mode serve--------------  
 //reg webpage and parse POST response------- 
   regClient = newWifi.getClient(); 
   //if we receive a client request to the server 

As soon as the wifi registration successfully connects to your network it will drop out of this loop and continue with your setup() routine. That's all you need!

What's next?

Well that's up to you! Add this library to your toolbox and use it anytime you'd like to enable WiFi registration without requiring a full reflash of your hardware. I used it in a consumer facing prototype that scans NFC tags and purchases the associated item on Amazon, NFC Replenisher.

'connectToWiFi' in NFC Dash Replenisher @ 0:39


An Arduino library for the Andium(Anduino) shield. Transform your Arduino into an AndiumNode.
WiFi Registration library for anduino and WiFi101 enabled devices.


Similar projects you might like

Connecting Anduino to IFTTT

Project tutorial by Brian Carbonette

  • 15 respects

Arduino RFID Keycard Access

Project tutorial by Brian Carbonette

  • 1 comment
  • 27 respects

NFC Color Changer

Project tutorial by Brian Carbonette

  • 3 respects

AnduinoWiFi Getting Started

Project tutorial by Brian Carbonette

  • 10 respects

Smart Door Lock Using WiFi Login Page by Arduino & ESP8266

Project tutorial by ElectroPeak

  • 57 respects

Measuring CO2 Levels aka "The Sleepiness Multiplier"

Project tutorial by Brian Carbonette

  • 21 respects
Add projectSign up / Login