Arduino UNO is offline via USB

• Arduion UNO with USB
• Android
• Blynk server
• Blynk Library 0.5.1

First, I used my Arduino Yun to connect Blynk and all things was ok. Since a MFRC522 module was used and I found Arduino Yun cannot dirve this RFID module, which goes well with Arduino UNO. Then I chose UNO instead of Yun. However, I don’t have other shield and USB is the only choice.

I just use the example program for test as the example video shows, but the device is showed “offline” in the app.

Here is my code


#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleStream.h>

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


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


  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}

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


maybe it’s a common problem… and I try many solution that others success…
I really need help…thx…

image

Since recent changes, you need to use port 8080 in this script now… you will need to edit it manually

image

thx, but still offline…
22222

shall I change sth. in the script?

Looks like you got it changed OK.

Remember that script needs to stay running the whole time you want to be connected

And you can NOT use any Serial Print commands… including #define BLYNK_PRINT Serial So comment them out or remove them. EDIT - your code looks OK. Of course you will need a USB-TTL adapter to use the DebugSerial

there are two problems:

  1. you mean I should common out or remove

#define BLYNK_PRINT DebugSerial

will it influence others or shall I remove other code?

  1. If there is no USB-TTL adapter, can I remove the code about debugserial and will it work?

thx

DebugSerial is fine as it is using SoftwareSerial on pins 2 & 3… but yes, it is useless without a USB-TTL adapter anyhow :wink: so while it is no harm to keep, there is no need for any Softserial reference in the code.

#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX
#define BLYNK_PRINT DebugSerial

// Debug console
DebugSerial.begin(9600);

here is the updated code…

#include <BlynkSimpleStream.h>

char auth[] = "802b7f2d1cc84f25ba85c474c4fe61ff";

void setup()
{
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}

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

but it is still offline… the blynk-ser. bat keeps running and the IDE is closed

it the setting right?

Looks fine… besides, nothing there would affect connection… aside from incorrect AUTH code.

Double check the AUTH code - in fact, refresh it to a new one in the App, replace it in your UNO code and don’t publish it on this forum :stuck_out_tongue:

Confirm correct COM port

Make sure your firewall is not blocking the script.

thx. and do you know how to check the firewall…since both the COM and auth code are right I think…

Show your script screenshot again when running… you can leave the IDE open, but make sure the Serial Monitor is NOT running.

Did you change the AUTH code yet… since you openly published your old one here :wink:

Not a clue on your PC :slight_smile:

I have changed the Auth code and the device is still offline

the serial monitor is not open.

Change your code to this (with new AUTH)… if the device connects to the server the onboard LED will flash rapidly (4 times a second), if disconnected, it will go OFF (in about 10+ seconds).

#include <BlynkSimpleStream.h>

char auth[] = "xxxxxxxxxx";

void setup()
{
  pinMode(13, OUTPUT);
  Serial.begin(9600);
  Blynk.begin(Serial, auth);
}


void loop() {
  Blynk.run();
  if (Blynk.connected()) {
    digitalWrite(13, !digitalRead(13));
    delay(250);
  } else {
    digitalWrite(13, LOW);
  }
}

If not connecting, but trying… you should see the TX LED on the UNO slow flash ON/OFF every few seconds.

NOTE: I had the BAUD rate set high (19200) for on my setup… I just corrected it back to 9600 in the sketch above.

I choose 9600.

the LED connected pin13 doesn’t light. the on-board LED, TX and RX, flash rapidly discontinuously, sometimes for 1seconds and sometimes for about 3 seconds…I don’t know the reason…

That means it is trying to send the AUTH code to the server and awaiting a reply… this is where having the SoftSerial DEBUG w/ USB-TTL and a terminal program option is handy :wink:

So, now it is either your AV or firewall that is blocking communication or bad AUTH or bad internet?? I would suspect the AV/Firewall. Determine what you are using and GOGGLE it to see how to either temporarily disable it, and allow the script to have access.

thx a lot…

it’s quite difficult if there is a firewall problem… however, I use my Arduino Yun before, it can communicate with the server via the same WI-FI…

Your PC firewall would have no effect on your router and WiFi :wink:

that’s right, so let me search and check…though I have no idea…

thx very much…

BTW, if/when you get the firewall figured out… take this part OUT of the void loop… it is only there for this testing and can cause issues in future uses.