A short post today to show you how to set up WiFi on a Wemos D1 Mini.
For me, the whole point of ESP8266 boards (and their variants) is to get them hooked up for networking and IoT fun stuff, so this was a bit of a key one for me to write down!
New to the Wemos? Check out my Wemos setup guide and simple Wemos GPIO LED tutorial.
Initial Setup
I’m going to assume the use of a Wemos D1 Mini here. It may work for other variations of the Wemos, and maybe even other ESP-based boards like the Node MCU.
I’m also going to assume you’ve set up your Wemos board and have the Arduino IDE installed and ready to go. If not, follow my Wemos D1 Mini setup guide here.

The Wemos D1 Mini – small and reliable
No Settings Required
If like me, you’re used to the Raspberry Pi way of doing things, the way WiFi is configured on the Wemos will throw you for a second. There’s no separate files or settings for WiFi – it’s just added as part of your sketch. I know right – mind blown!
For example, if you make an LED sketch and want to control that with WiFi, you add the WiFi code to your sketch.
On the flip side, if your project doesn’t need WiFi, you leave that part out and pretend it’s 1996 again (and I reckon it’ll save you some power as well).
WiFi Code
There are two ways I like to do this:
Basic Connectivity
This super-simple option gets you connected with just a few lines of code, but gives you no info on the connection.
It’s great for a project where you’ve already tested WiFi and know everything works. You can always check if it’s connected by using a tool such as Fing (Android/iOS) or Advanced IP Scanner (Windows).
Here’s the code you add to your sketch to enable WiFi in this very basic fashion. You need to update lines 4 and 5 with your SSID (WiFi name) and password:
#include <ESP8266WiFi.h> // Network SSID const char* ssid = "YOUR-SSID-HERE"; const char* password = "YOUR-PASSWORD-HERE"; void setup() { // Connect WiFi WiFi.hostname("Name"); WiFi.begin(ssid, password); } void loop() { //Add project code here }
Connectivity with Serial Monitor Output
This slightly more code-calorific version offers serial printing to let you know if things are working as they should. Just like this:

Check your connection and IP address with the Arduino IDE Serial Monitor
Open up the serial monitor before you upload the code, and again, change the details in lines 4 and 5 with your SSID and password:
#include <ESP8266WiFi.h> // Network SSID const char* ssid = "YOUR-SSID-HERE"; const char* password = "YOUR-PASSWORD-HERE"; void setup() { Serial.begin(115200); delay(10); // Connect WiFi Serial.println(); Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); WiFi.hostname("Name"); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); // Print the IP address Serial.print("IP address: "); Serial.print(WiFi.localIP()); } void loop() { //Add your project's loop code here }
That’s all for now, short one today!
Rich
Try this: https://github.com/tzapu/WiFiManager
It lets you start up your Wemos and if it can’t connect to an AP it starts up a local AP (SSID=”Wemos” password=”ConfigureMe”) which scans your neighbourhood and looks for available SSIDs. You enter the credentials, the Wemos restarts and connects to the infrastructure network. It’s seriously clever stuff.
This is some serious shit indeed…loving it!