BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

New to Blynk - cannot get basic LED to work!

I just started playing with Blynk and have followed all the steps to get the very basic example of lighting up an LED on my Arduino Uno Board. I have played with this for a few days, but cannot figure this out. Feel bad about asking something so basic. So - looking for ideas on how to debug, so I can actually start using Blynk for some complicated IOT projects. Here is what I have done so far:

  • Arduino UNO board using USB
  • Connected LED (+ve to pin D13 and GND)
  • Using the basic code supplied from “Examples” - sketch code attached below
  • Installed Blynk and setup per the instructions (iOS)
  • Using D13 pin as the button in “Switch” mode
  • I have also tested by just executing “blynk-ser” bat file and it seems to work fine

#define BLYNK_PRINT DebugSerial


// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#include <BlynkSimpleStream.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xHeTo3d45fkgl6fglAd7G8G3H1ePnAVH";


void setup()
{
  // Debug console
  DebugSerial.begin(9600);

  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}

void loop()
{
  Blynk.run();
}

What exactly does this mean?
What do you see in the command prompt window?
Is the app showing the device as online?

Pete.

Thanks for the quick reply. This is what I see:
Connecting device at COM6 to blynk-cloud.com:80
OpenC0C("\.\COM6", baud=9600, data=8, parity=no, stop=1) - OK
Connect(“blynk-cloud.com”, “80”) - OK
InOut() START
DSR is OFF

And the answers to my other questions?

Pete.

Command window prompt shows what I pasted above.O

On Blynk app (on Apple iOS), it shows “device” is offline. The Blynk website says that this is ok.

I’m not sure what you mean by this, and I’m still confused by this statement…

Can you explain the steps that you are taking in the testing process?

Pete.

This is what the Blynk site says (see the bottom of the link in Step 4: https://blynk.io/en/getting-started - I have pasted it below for reference):

************ see 2nd bullet point below *******
4. Flash and Play

• Open Blynk App and tap ▷PLAY (in the right top corner)
• You will get a message that hardware is offline. That’s OK.
• Upload your sketch to hardware
• Check the Serial Monitor, you should see that your device is connected


On your 2nd question:

  • On the command prompt (Windows), I went to “scripts” sub-directory to change the COM port:

C:\Users…\OneDrive\Documents\Arduino\libraries\blynk-library-0.6.1\scripts>

  • I edited “blynk-ser” file to reflect the correct COM port
  • I executed this file and results were attached before.

Hope this helps. Thank you again for looking into this.

If you follow the steps in the link provided, in that sequence, then it’s correct that when you first put the project into PLAY mode you will get a “Hardware offline” message,
That’s because the next step in the process is to upload the sketch, with the newly acquired auth code, to the hardware.
When the hardware boots it will connect to the internet (in your case via the USB script) then to the Blynk server. At that point, the hardware will be online and show as online in the app.

The PC running the script needs to be on, and connected to the internet at all times, and the script needs to be running in an active command prompt window at all times, for the device to be connected to the Blynk server.

You’ve made life difficult for yourself by choosing the USB connection method, as this uses the serial port, so you’d need additional hardware in the form of an FTDI adapter to see the serial monitor data which is being sent to the SoftwareSerial pins. This additional data would probably help you to diagnose why your connection isn’t working.

One think you could try is editing the script to use port 8080 instead of port 80, as your ISP may be blocking traffic on port 80.

If you’re going to do some more serious IoT projects then you should use a board that has built-in internet connection capabilities. They are also cheaper than the Uno that you’re currently using…

Pete.

Awesome Pete - thank you. I had to keep the command prompt window running and that made it work/online - I was missing that…

I just ordered Sparkfun Blynk Board ESP8266 for other IOT projects; hopefully I can make this work, when it arrives. Thanks again for the information…