Setting up an Access Point


In the previous tutorial we covered the very basic function of most micro controllers, blinking an LED, but the whole reason we're interested in the ESP devices is their ability to establish a WiFi connection. There is a library for this and it's very easy to set up. 

The ESP8266 WiFi library has the ability to operate in a range of modes. It can act as a station where it would connect to an existing Wifi network, it can become an access point where it creates it's own wifi network and it lets devices connect directly to it. Finally it can operate in a mixture of both modes which is useful for forming mesh networks

The internet of things is a brave new world where people are putting all kinds of things online, even simple things like lightbulbs can be hacked and turned against the owner, because of this I've written all of my software in access point mode. I'm sure simple common sense could secure these devices on your local network but it's one less thing for me to worry about this way round.

I've written a very basic sample to initialise an access point with a predefined ssid and password.


The sample initialises the serial port functions before starting the wifi, the serial port is useful for debugging the application. In this instance the serial port sends details of the exact ssid and password being used to create the wifi network. The network name is created by combining a fixed string with the unique Chip ID, that way if I have more than one device turned on at the same time they'll both generate different network names.

In reality the sample boils down to two lines of code,
"WiFi.mode(WIFI_AP);" which sets up the device to operate as an access point.
"WiFi.softAP(ssid, pass);" which sets up the wifi with a given name and password.

It's worth noting that the ssid should be at least 8 characters long and less than 64 characters. If you want to set up a wifi network without a password just leave the password field blank.

Now when you open up a list of wifi devices from your laptop or mobile phone you should see the wifi network available to access.



Popular posts from this blog

Wiring the Ruida Controller

Laser Cut Cryptex

Rainbow Puzzle Box