Blynk myPlant app was built using these Blynk IoT platform components:
- Blynk Mobile App Builder to build the initial user interface
- Blynk ESP8266 Hardware Library that gets the hardware online, connects it to the Blynk cloud, and handles the command processing
- Blynk Cloud that manages the communication between the app and the hardware
- Blynk.R™ – user registration workflow
- Blynk.Inject™ – pre-designed workflow to provide great user experience for first-time users and handle WiFi provisioning for the device
Read about the features here.
Download The app
→ Blynk myPlant for iOS (SOON)
We recommend using these hardware models for the demo (but you can use any ESP8266 board)
SparkFun Blynk Board
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:
Setting up Arduino IDE
Install latest Arduino IDE.
Download latest Blynk release package: Blynk_Release_v0.3.10.zip. It contains 5 libraries, please copy them to Arduino Libraries folder. If you don’t know how to do this, please follow manual installation guide.
Open the Arduino IDE, then select in the menu: File -> Preferences.
Click on Additional Boards Manager URLs button and add this link:
- In the Arduino IDE menu open: Tools -> Board -> Boards Manager.
esp8266, and install it:
Uploading Blynk Demo App example
Open File -> Examples -> Blynk -> Export_Demo -> myPlant_ESP8266
In 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_BOARDin the
Click on Verify button and make sure that example compiled correctly:
Select the port of your board in Tools -> Port menu.
In Tools -> Upload Speed, select 115200 (higher values may also work for you).
If you don't know how to select the port, check this troubleshooting section.
Click the Upload button. (You should see a progress bar in the console, followed by Done uploading message in the status panel. After this process is finished, LED should start blinking blue: which means the board is waiting for configuration).
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.
Running Blynk myPlant Demo
Download Blynk myPlant app from Google Play, and open it.
Follow the steps in WiFi provisioning wizard to connect the hardware to your WiFi network:
- 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 device 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 transfered to the device:
- Device automatically rebooots
- 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".
- Click DONE:
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.
Everything you see in this demo can be applied to your app.
RGB LED status indication
Fast Blinking Blue: WAIT_CONFIG mode - Device acts as an Access Point (broadcasts it's own WiFi network). It's waiting for the app to pass the required information
CONFIGURING mode - device is getting the data from the smartphone
Blinking Blynk Green: CONNECTING_NET mode - device is connecting to the WiFi network
Fast Blinking Blynk Green: CONNECTING_CLOUD - device is trying to connect to Blynk Cloud
Breathing Blynk Green: RUNNING - device successfully connected to Blynk Cloud
Blinking Red: ERROR mode
Breathing White - confirming 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.
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
truefor your board in
No ports appear, when board is plugged in
For Ubuntu / linux, it may happen that the board is detected, but when you try flashing the board,
an error appears:
Error opening serial port...
If you get this error, you need to set serial port permission. Open terminal, and run command:
sudo usermod -a -G dialout $USER
Note: You will need to reboot (or just log out and log in) for this change to take effect.
How to pick the correct port?
- Ensure that your board is disconnected.
- Remember which ports are available in your Tools -> Board menu.
- Connect your board and wait 30 seconds.
- Select the new port that appeared in Tools -> Board menu (the one that was missing before).
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, ho have to reset the board