BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

A library for configuring Wifi and Blynk credentials dynamically

esp8266

#1

Hi guys, I’ve made a small wrapper library. It helps you to configure your credentials without hardcoding them.

link: https://github.com/Barbayar/EasyBlynk8266

EasyBlynk8266

If you are hardcoding your Wifi and Blynk credentials, and reflashing everytime when you need to change them, please stop it, seriously. I was like that before, but one day I woke up, and said enough is enough.
I understand that if you do Arduino as a hobby, it’s quite difficult to make time to write unnecessary features. But, with this library, you can do it without writing any extra code. Just replace, Blynk with EasyBlynk8266 in your code, then it should just work fine, technically.

So, how it works?

If it cannot connect to the Blynk server in 30 seconds, it will switch to Configuration Mode. You will see your built-in LED (if you have one) flashes every second. In Configuration Mode, it starts an access point called EasyBlynk8266-Config, like below. Connect to it.

After you connected, please, go to http://192.168.1.1. You will see a page showed as below.

Enter your credentials, then click Save. After you restarted, you will see your built-in LED flashes 3 times. That means, it connected to your Blynk server successfully.

Prerequisite

Hello World

Please take a look at examples, as well.

#include <EasyBlynk8266.h>

void setup() {
    EasyBlynk8266.begin();
}


void loop() {
    EasyBlynk8266.run();
}

#2

Thanks.
But be aware that this functionality is available in Blynk out of the box: https://github.com/blynkkk/blynk-library/tree/master/examples/Blynk.Inject
:slight_smile:

  • With Blynk.Inject you have bonus that the Blynk App can actually set up your device automatically.
  • We currently support ESP8266, ESP32, Arduino MKR1000 and MKR1010, TI CC3220.

#3

Oh, I should have done more research on Blynk, before I implement it. Thanks for the info.


#4

Strange choice of default IP address, as it’s also the default for probably 99% of domestic routers. Easy enough to change by editing the .cpp file, but a strange choice nonetheless.

Pete.


#5

Hi Pete. I’ve chosen 192.168.1.1, because it is easy to remember. 192.168.1.1 is the ip address only when it’s in Configuration Mode. When you finished configuration, it will use an ip address what your wifi router gives. So, there won’t be any conflict.

Barbayar


#6

Obviously when the computer/phone/tablet that you’re using to configure the ESP is connected to the EasyBlynk8266-Configured network there will be no conflict, but you have to consider that this config system may be used by people who aren’t very tech savvy.
If the ESP times-out of Station mode, then the computer being used will really-connnect to the default Wi-Fi network and the user will be presented with the login screen/homepage for the router. The same thing will occur of the user moves out of Wi-Fi range of the ESP, or if the ESP has its power interrupted or if the reset button is pressed. Whilst the ESP may go back in to config mode, the computer won’t reconnect to it by default.

Whilst 192.168.1.1 may be easy to remember for you and me, it’s just a string of numbers and punctuation for most people.
I just think that using an IP address that is extremely unlikely to reach alternative any network device would make it much easier for people to realise that they’d done something wrong and start the config process over again, rather than hitting an actual device and being asked for a username and password.

Maybe I’ve just spent too many years trying to provide phone support to people that do the weirdest things :roll_eyes:

Pete.


#7

Yup… bin der, dun dat, have the scars :face_with_head_bandage: Even spent a few years being tech support for the field techs… amazing what they didn’t know at times :stuck_out_tongue:


#8

Hi Pete,
Thank you for taking your time to give a feedback. Honestly, I didn’t think of that situation. I’ll consider to change the IP address in my next commit.

Best,
Barbayar