Software apps and online services
This article requires no experience with web programming and very basic knowledge about Arduino.
Have you ever thought of making a device send notifications to your phone and didn't know how to start implementing it?
Have you ever thought that you wanted to control anything over the internet and break the boundaries of RF and WiFi ranges?
You came to the right place!
In this article we'll explore how to use Blynk and use it to blink an LED on Arduino.
What is Blynk?
Blynk which was awarded the IoT Software People's Choice 2015/2016 is a Platform with iOS and Android apps to control Arduino, Raspberry Pi, Particle and other devices using the internet. It's based on an Application that lets you drag and drop widgets to make your project grow larger and control more things.
- Arduino Uno
- Smart phone with Android or iOs
- IDE - Visual Studio ( I prefer to use it as it saves lots of time, if you're interested to know how to use Visual Studio to make Arduino sketches check this link, It's completely OK to use Arduino IDE)
Then you register and create a new project.
When you're about to create the project you get the access token keep it in some place because you'll need this to connect to the internet later on. You can also click on Email and get the token send to your mail to easily use it.
Now you'll have your project and its empty work space, swipe to the right to see the available components to use.
We'll use the button so, add one and on the settings window you choose the button's name ,the pin it controls on the Arduino and its type and also its display color. Set the pin to D13 so we don't need to connect a circuit. I picked switch but you're free to choose whatever you want.
So our final project shall be like this :)
Adding the library
After downloading the library from this link, add it to Arduino by copying it to the libraries directory in the Arduino directory it's typically in.
C:\Program Files (x86)\Arduino\libraries
Extract the ZIP file in that directory.
We're almost done, we just need to tell Arduino that it'll connect to our application using Blynk, they made it really so simple to do. (Full sample will be below).
First, We'll setup a software serial so the PC communicates with the Arduino.
Then you modify the sketch with the Token that was generated for your project, you must edit this.
Then, in Setup() you begin the authorization with the Blynk platform.
After uploading the code to Arduino, you need to connect it to the internet. to do so you should run the script blynk-ser.bat that's provided with the Blynk library in.
Make sure that your firewall allows the script to connect to the internet.
A running script will look like this.
To terminate the script hit Ctrl + C then Y then press Enter.Let's Roll
To run everything, do the following steps in order.
- Make sure you have an internet connection.
- Make sure that your application is ready with the correct pin numbers.
- Make sure that the Arduino code is uploaded.
- Make sure that the script is running correctly ( and not reconnecting ).
- Run the application from your phone using this button.
Congratulations !! now you can switch the LED on and off from anywhere in the world!Common Problems
Serial port doesn't show up should show up when you run the script if you see something like this, try to re-connect your Arduino. and make sure that nothing is making the port busy ( e.g: code is uploading ).
Your Arduino is not on network
if you see something like this, make sure that the Authorization Token is correct in your code and matches the one in the application, and make sure the firewall isn't blocking the Arduino from connecting to the internet.
To know more check the documentation of Blynk here, they have a very neat one.
Linux, RPi, Particle and Ethernet shields users should follow the instructions as the documentation here.
If you didn't find a solution you can head to the Blynk community and ask for help.
You can buy electronic components on utsource.net.Thank You
I hope this article was useful, thank you for taking time to read this article, if you find it useful please Share it :)