Arduino + USB Offline (OSx MacBook Pro)

Hi there,

I’m facing a problem that many people has had it too. But after hours reading and making changes my Arduino is still not connecting to the Blynk app.

To be honest I have done all required steps needed to connect my Arduino to the Blynk App via USB. Not sure what I can do next.

The steps I have taken are:

  1. Downloaded the Blynk App
  2. Created a new project and inserted a button D13
  3. Downloaded the Blynk Library and installed it
  4. Opened the example Arduino/Serial/USB
  5. Copy and paste the AuthToken, and changed the Pin number to D13
  6. Save the example and uploaded it.
  7. Installed Homebrew and Socat
  8. I have performed and ran the ./blynk-ser.sh successfully

It should be working but the app is still offline. I have ordered one ESP8266, and I’m scared it will happen the same thing.

Any advice on what to do next? Is it me that I’m doing something wrong or is the App that is having issues?

BELOW IS THE CODE USED

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  =>
  =>          USB HOWTO: http://tiny.cc/BlynkUSB
  =>

  You can send/receive any data using WidgetTerminal object.

  App project setup:
    Terminal widget attached to Virtual Pin V1
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT SwSerial
#include <Ethernet.h>


#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
    
#include <BlynkSimpleStream.h>

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

// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(13);

// You can send commands from Terminal to your hardware. Just use
// the same Virtual Pin as your Terminal Widget
BLYNK_WRITE(13)
{

  // if you type "Marco" into Terminal Widget - it will respond: "Polo:"
  if (String("Marco") == param.asStr()) {
    terminal.println("You said: 'Marco'") ;
    terminal.println("I said: 'Polo'") ;
  } else {

    // Send it back
    terminal.print("You said:");
    terminal.write(param.getBuffer(), param.getLength());
    terminal.println();
  }

  // Ensure everything is sent
  terminal.flush();
}

void setup()
{
  // Debug console
  SwSerial.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);

  // This will print Blynk Software version to the Terminal Widget when
  // your hardware gets connected to Blynk Server
  terminal.println(F("Blynk v" BLYNK_VERSION ": Device started"));
  terminal.println(F("-------------"));
  terminal.println(F("Type 'Marco' and get a reply, or type"));
  terminal.println(F("anything else and get it printed back."));
  terminal.flush();
}

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

BELOW IS WHAT IT SAYS IN TERMINAL:

Last login: Sun Mar  4 11:25:42 on ttys000
192:~ boss$ cd Documents/
192:Documents boss$ ls
$RECYCLE.BIN
Adobe
AdobeStockPhotos
Airlander 10 CAD can be shared under NDA - Not 100% accurate design..7z
Arduino
Audio Music Apps
Autodesk
Downloaded by MediaHuman
Entourage Script Menu Items
Excel Script Menu Items
GarageBand
HSPA Modem User Data
Inventor
MacKeeper Backups
Microsoft Messenger Data
Microsoft User Data
Mixxx
My Books
Native Instruments
Office 2008 AutoRecovery
Office 2008 Identities
Parallels
PowerPoint Script Menu Items
Promised Files
Saved Attachments
Version Cue
Virtual Machines.localized
Word Script Menu Items
desktop.ini
eagle
iChat Icons
iPod
log.txt
192:Documents boss$ cd Arduino/
192:Arduino boss$ ls
Project_04_Arduino_Kit	sketch_dec12a		tools
Project_05_Arduino_Kit	sketch_mar03a
libraries		sketch_mar04a
192:Arduino boss$ cd libraries/
192:libraries boss$ ls
Blynk			Time
BlynkESP8266_Lib	TinyGSM
192:libraries boss$ cd Blynk/
192:Blynk boss$ ls
LICENSE			keywords.txt		scripts
Makefile		library.json		src
README.md		library.properties	tests
examples		linux
192:Blynk boss$ cd scripts/
192:scripts boss$ ls
README.md	blynk-ser.sh	certs
blynk-ser.bat	blynk_ctrl.py	com2tcp.bin
192:scripts boss$ ./blynk-ser.sh
       1 ports found. You can specify port manually using -c option
Select serial port [ /dev/tty.usbmodem1411 ]: /dev/tty.usbmodem1411
Resetting device /dev/tty.usbmodem1411...
[ Press Ctrl+C to exit ]
Connecting: GOPEN:/dev/tty.usbmodem1411,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> openssl-connect:blynk-cloud.com:8441,cafile=/Users/boss/Documents/Arduino/libraries/Blynk/scripts/certs/server.crt,nodelay
2018/03/04 12:26:10 socat[62581] N opening character device "/dev/tty.usbmodem1411" for reading and writing
2018/03/04 12:26:11 socat[62581] N opening connection to LEN=16 AF=2 139.59.206.133:8441
2018/03/04 12:26:11 socat[62581] N successfully connected from local address LEN=16 AF=2 192.168.1.103:57758
2018/03/04 12:26:11 socat[62581] N trusting certificate, commonName matches
2018/03/04 12:26:11 socat[62581] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2018/03/04 12:26:11 socat[62581] N SSL connection compression "none"
2018/03/04 12:26:11 socat[62581] N SSL connection expansion "none"
2018/03/04 12:26:11 socat[62581] N starting data transfer loop with FDs [5,5] and [8,8]
^C2018/03/04 12:26:19 socat[62581] N socat_signal(): handling signal 2
2018/03/04 12:26:19 socat[62581] N exiting on signal 2
2018/03/04 12:26:19 socat[62581] N socat_signal(): finishing signal 2
2018/03/04 12:26:19 socat[62581] N exit(130)
Exited!
192:scripts boss$ 

BELOW IS WHAT I SEE WHEN I EDIT blynk-ser.ch:

Welcome to the wonderful world of Blynk.

When you paste code, it should be formatted and in a code window. Please type cpp <paste code>

I use ESP8266 as a newbie and so do many on this forum. Wifi is a lot easier to use than serial/ethernet etc. I was apprehensive when I got my board. I’m not a coder or a hardware guy. I got by soon. So, no need to worry.

When you do get started with your ESP8266, I may be able to help you.

Terminal widget will only operate in virtual pins. Change this to V13 in the app+code and see what happens.

Shouldn’t it work with any type of pin? I have changed to V13 and is still not connecting.

The project is still Offline on the Blynk App, how can I make it online? I have done everything and not sure why the app is it not connecting to the Arduino. Is there any problem with the app?

Thank you Mohan, I really appreciate your help and support. I will definitely contact you if I have any problems with the ESP8266.

But if anyone can help with the USB situation. It will be nice to solve the situation.

The widgets in your app still aren’t set-up correctly.
When I look at the project on the server using this link:
http://blynk-cloud.com/f497be401e0e4e03952e72f83b038790/project
it shows that you have a button widget set-up on V13, a slider on D9 and a step widget on D10. Your code is supposed to be writing data to a Terminal widget on V13.

I don’t think that this is what’s causing your connection problem, but I’m not a Mac user so can’t help there I’m afraid.

You should really go back and edit your initial post and pic three back-ticks and CPP at the start of your code and three back-ticks at the end so that it’s formatted correctly so that it’s more legible.

Pete.

@Gonzalo_Rumeu_Claret I edited your post for you

Blynk - FTFC

I don’t use Mac, but in the PC you MUST keep the connection window open in-order to keep the link functioning.

Why is this here? You are not also connecting via an Ethernet adapter are you?

You may want to take a look at this thread, as someone was also having USB connection problems:

It seems that the port settings may need to be changed in your script file.

Pete.

Thank you