Introduction: Control Simulated Arduino Circuit With Android Blynk App - First Project : LEDs

About: An Assistant Lecturer in Faculty of Engineering. An MSc. holder in #Mechatronics, Ain Shams University. #MCPD, #CLAD and ISTQB CT. #Kinect #WPF #LabVIEW #wpdev

Introduction

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 become 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.



Step 1: Create Proteus File With Arduino UNO

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 Clip

Add 3 LEDs, Red, Green and Blue. You can either use project clips or as usual from proteus library.

Step 3: Create Virtual COM Port

Using 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 Library

Add 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 Folder

Here 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 Procedure

Up 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 !!

Attachments

Step 7:

Maker Olympics Contest 2016

Participated in the
Maker Olympics Contest 2016