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

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

Picture of 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 !!

Step 7:

Comments

Lars FredrikS (author)2017-10-24

Hello. Been tearing my hair out for the last 6 hours. I just can't seem to get the device online. The server should be all set up correctly. I used COM3 AND COM 4 as COM1 was busy/overlapping, don't know why what though. When I start the simulation, the green/red don't match with yours, and I've used your clip of the compin, and adjusted is properties. Does what COM I use in the Arduino Ide have anything to say?

Thanks ☺️

tomatoskins (author)2016-08-19

Very nice first instructable! Thanks for sharing and welcome to the community!

wbadry1980 (author)tomatoskins2016-08-24

Thanks

ImranUllah (author)wbadry19802017-08-03

Sir That's a great intro video

But sir I first simulated this circuit and it worked out but now I am trying to simulate it but on the blynk app in my android shows device is offline

Please help me out in this one?

Thanks

wbadry1980 (author)ImranUllah2017-08-04

Two things to do. First delete the serial connection and create it again. And secondly, refresh the token from Android app and send it to your EMail, then update the token in your sketch

ImranUllah (author)wbadry19802017-08-10

Sir thanks for the reply sir I have done that but no progress yet

sir I have noted one difference that is when I start the simulation in proteus mine compim looks different i.e pin 3 neither its blinking nor its turned red mean energized as yours.server am using is blynk server

This pic is when I just start the simulation I haven't started the server yet and the other one when started server

wbadry1980 (author)ImranUllah2017-08-10

From what I see, you may mistakenly connected Request To Send (RTS) and Clear To Send(CTS) with Transmit data line (Tx). The dot implies you did. So, make sure you disconnect Tx from that. TXD should be connected only to TXD.

ImranUllah (author)wbadry19802017-08-11

Ok Sir Waleed I will do that and A bundle of thanks for taking in account my problem and helping me out.

wbadry1980 (author)ImranUllah2017-08-11

Not at all. Just tell me if you need anything else.

ImranUllah (author)wbadry19802017-08-11

Thanks for your time and support Sir

ImranUllah (author)wbadry19802017-08-11

Thank you a lot respected Sir Waleed Its solved and I am running blynk plus arduino on proteus again. Thanks again Sir for giving me your precious time.

wbadry1980 (author)ImranUllah2017-08-11

Awesome !. Glad you made it.

rjamendola (author)2017-02-08

Congratulations, nice instructable! What kind of connection do you setup on android app?

wbadry1980 (author)rjamendola2017-08-04

USB

About This Instructable

2,011views

25favorites

License:

Bio: An Assistant Lecturer in Faculty of Engineering. An MSc. holder in #Mechatronics, Ain Shams University. #MCPD, #CLAD and ISTQB CT. #Kinect #WPF #LabVIEW #wpdev
More by wbadry1980:Virtual IoT With Proteus and Blynk : Servo Motor Speed MonitorControl Simulated Arduino Circuit With Android Blynk App - First Project : LEDs
Add instructable to: