Average Ticker

How To Set up WiFi on a Wemos

Wemos WiFi SetupGet your Wemos online - it's what it was born to do!

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.

Wemos D1 Mini

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:

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:

Arduino IDE Serial Monitor IP Address

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:

That’s all for now, short one today!

Rich

1 Comment on "How To Set up WiFi on a Wemos"

  1. 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.

Leave a comment

Your email address will not be published.


*


This website uses cookies. Please visit our privacy policy page for more information. Privacy policy

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close