Uploading Blynk Demo App example to your board
First, follow this guide if you haven't set up Arduino Core for ESP8266 yet.
File -> Examples -> Blynk -> Export_Demo -> myPlant_ESP8266
Tools -> Board menu, select
NodeMCU 1.0 (ESP-12E Module) .
Note: This board selection works for both SparkFun BlynkBoard and NodeMCU.
If you use NodeMCU, uncomment
#define USE_NODE_MCU_BOARD in the
Verify and Upload to the board (as usual for ESP8266 boards).
The firmware was successfully loaded and is ready.
You can switch the board off and then on again. Imagine you just unboxed the new product. LED should be blinking blue.
If you are using Sparkfun Blynk Board, no additional wiring is required.
If you are using NodeMCU , you would need:
- RGB LED;
- 3 x 100 Ohm resistors;
- Protoboard (optionally);
Use this wiring diagram to connect RGB LED:
Running Blynk myPlant Demo
- Make sure your hardware is powered up (with the battery or USB cable);
- Status LED should be blinking blue. It means that at this moment the board acts as an Access Point and broadcasts it's own WiFi network;
In the app click Begin to start device provisioning:
Choose the WiFi SSID you would like your device be connected to and input the password for it. It can be your home WiFi network.
Note: you may be asked for a permission to access GPS. It's a regular Android OS permission to get the hardware identifiers during scanning for WiFi networks.
Choose Blynk myPlant network name in the list of networks. This is the board which will be configured.
Now your smartphone is connected to the Access Point created by the device. You should see that status LED is blinking blue, but slower. Now the provisioning process starts.
During this process:
- smartphone passes WiFi credentials to the device;
- smartphone requests new Auth Token from the server and passes it to the device;
- this data is stored in the device's memory (EEPROM);
When the data was successfully transferred to the device:
- Device automatically reboots;
- Uses the stored WiFi credentials to connects to the WiFi network you specified;
- Uses unique Auth Token to connect to Blynk Cloud;
After device successfully connected to Blynk Cloud status LED will change to "breathing green".
The app is ready to be used:
Note: This is a simulation of a plant watering device. The app is communicating with the hardware, but the data is not real.
RGB LED status indication
WAIT_CONFIG mode (blinking blue fast) - device acts as an Access Point (broadcasts it's own WiFi network). It's waiting for the app to pass the required information.
CONFIGURING (blinking blue) - device is getting the data from the smartphone.
CONNECTING_NET (blinking green) - device is connecting to the WiFi network.
CONNECTING_CLOUD (blinking green fast) - device is trying to connect to Blynk Cloud.
RUNNING (breathing green) - device successfully connected to Blynk Cloud.
ERROR (red heartbeat) - something went wrong.
Breathing White - confirm resetting the board configuration.
Blinking White - board configuration was reset.
Resetting the board
There might be situations when you would need reset the board in case something went wrong, or you would like to connect it to a different WiFi network.
NodeMCU: Press and hold the FLASH button (near USB connector) for 10 seconds.
SparkFun Blynk Board: Press and hold the on board button “0” for 10 seconds.
After a few seconds status LED will change to breathing white color, and then turn to blinking white. Release the button. Device will be reset and you can start the provisioning process again using the myPlant App.
For general EPS8266 troubleshooting, see this article.
If you are using NodeMCU, and your RGB LED shows incorrect colors (or doesn’t light-up at all), there is a chance that your LED is a “common anode” LED as shown on the image below:
In this case, you will have to:
- Connect the longest LED pin to the
BOARD_LED_INVERSEto true for your board in
The board doesn't connect to home network, status LED flashes red and board restarts.
Ensure you have entered valid WiFi configuration (picked correct WiFi name and password). If you make a mistake, you have to reset the board configuration.