Blynk is very popular app founded by Bayborodin Pavlo and Dumanskiy Dmitriy which allows both hobbyists and professionals to build IoT apps connected to popular controllers like Arduino , Raspberry Pi and ESP8266 with other boards. The essence behind the success of this project is you will barely write any code to achieve such connectivity which naturally would be painful journey to survive.
This project is one of upcoming series to highlight how to use Blynk app with Proteus ISIS to create your IoT project without necessity of having real Arduino board at all. Not only this, but also in upcoming series, you will learn how to build a more advanced circuits and connecting it to Blynk via virtual pins.
Note: Before you begin, I should mention that Blynk server sometimes becomes unreachable due to heavy loads from users (it was about to ruin the demo of one of my students during presentation). Therefore, I recommend using Blynk local server on your machine. I recommend watching this YouTube tutorial.
Requirements- An Android (or iPhone) mobile. You can use Emulator like bluestacks although I haven't tested it. Download Blynk app from the store.
- Proteus 8.5 (or later). If you have earlier version, you can still follow the steps although my design file won't run directly on your machine.
- Arduino IDE sketch with Blynk library downloaded from Library Manager.
- Virtual Serial Port Emulator: There are many virtual serial port emulators. I used virtual serial port kit but you can use other free virtual serial port emulator.
Starting from Proteus 8.0, Arduino UNO can now be placed on schematic from project clip. If you have previous version, you can add Arduino library as instructed here. Make sure Arduino oscillator is 16 MHz to match the code generated from Arduino sketch compiler.
Step 2: Add 3 LEDs from Project ClipAdd 3 LEDs, Red, Green and Blue. You can either use project clips or as usual from Proteus library.
Step 3: Create Virtual COM portUsing any virtual com software, create virtual connection like: COM1<--->COM2. One will be used with Proteus and the other with Blynk Script.
Step 4: Add COMPIM from Proteus libraryAdd COMPIM component found in Proteus library. I created project clip for easy re-usability. I chose COM1 to be Proteus side while COM2 will be Blynk script side.
Step 5: Add Arduino sketch compiled hex file to Proteus folderHere is the code (will be added to files of project later).
/**************************************************************************************** * Code is based on Blynk USB-Serial Example
* Make sure you go to C:\Users\Your Username\Documents\Arduino\libraries\Blynk\scripts
* Press CTRL + LMouse Button and select Open Command Windows Here
* Then type in command windws >> blynk-ser.bat -c COM2 and click enter
* Enjoy the Virtual IoT !!!
****************************************************************************************/
#include <BlynkSimpleStream.h>// Pin Assignments
int redPin=8,greenPin=9,bluePin=10;//Your app authentication token (can be fetched from your blynk app
char auth[] = "d76e23d84cee461aa3f6869ff43e0d07";void setup()
{
//Set the three LED pins as output
pinMode(redPin,OUTPUT);
pinMode(greenPin,OUTPUT);
pinMode(bluePin,OUTPUT); // Blynk will work through Serial
Serial.begin(9600);
Blynk.begin(auth, Serial);
}void loop()
{
// All the magic is here
Blynk.run();
}
Step 6: Now use normal Blynk procedureUp to this point, you can run Proteus project.
- Use instructions of how to run Blynk using user-serial example from Blynk website.
- Connect your Blynk app to server (local or cloud). Don't forget to change authentication token.
- In my demo I used local server. You can watch the YouTube demo to create yours.
- It is done. You can now control LEDs on your PC from mobile. Happy Blynking!
Comments