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

Project does not run on local server


#1

Hello All,

I just finish building a local server on Raspberry Pi 3 B+, from Blynk app, I can register new account, connect to the local server and send out the email for authorization code.

I do have a project that was working fine when using Blynk hosted server. The same project will not work when I switch to local server.
Here is what I did when switch from cloud to local:

add the below to current project (my local server IP)

char server[] = "192.168.1.20";

Add the “server” to the end like

  Blynk.begin(auth, ssid, pass, server);

when running the compile, nothing output on the serial monitor

By remove the word “server” then serial monitor can display the output result as it is now using Blynk cloud server

  Blynk.begin(auth, ssid, pass);

What did I do wrong? please help.


#2

look example on examples.blynk.cc
Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);


#3

Your Local server and the Cloud server will also use totally different AUTH codes, so switching a project between them requires more than just the different IP.


#4

Hi 777,

Still NOTHING come up on Serial Monitor even after I changed it to

Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,20), 9443);

or

Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,20), 8080

when the “IPAddress(192,168,1,20), 9443)” is removed then the data come up on the Serial Monitor.

Please help and let me know what did I missed or what did I do wrong?


#5

Hi Gunner,
Yes, I do have my AUTH codes generated from Blynk apps that was connected to my local server.

The problems that I had now is as soon as I input the local server IP address into my project then NOTHING come up on serial monitor :frowning:


#6

Can you send full sketch?
9443 port is for ssl connection, use 8080 if you dont use ssl library. And tell us what board you are using.


#7

I don’t know what you are expecting on the serial monitor… and you might want to show us the full code as just a bunch of differering commands doesn’t tell us much…

And have you followed all the RPi directions for internal the 80-8080 port forwarding? However i have no idea if this is actually necessary for basic Local Server use :thinking:

PS, generally I use this format for my Local Server sketches… using Blynk.config() instead of Blynk.begin()

char auth[] = "xxxxxxxxxx";
char ssid[] = "xxxxxxxxxx";
char pass[] = "xxxxxxxxxx";
char server[] = "xxx.xxx.xxx.xxx";  // IP for your Local Server
int port = 8080;


void setup() {
  Serial.begin(9600);  // BLYNK_PRINT data
  WiFi.begin(ssid, pass); 
  Blynk.config(auth, server, port);  // non-blocking, even if no server connection
  Blynk.connect();
}

Or with Blynk.begin()

char auth[] = "xxxxxxxxxx";
char ssid[] = "xxxxxxxxxx";
char pass[] = "xxxxxxxxxx";
char server[] = "xxx.xxx.xxx.xxx";  // IP for your Local Server
int port = 8080;


void setup() {
  Serial.begin(9600);  // BLYNK_PRINT data
  Blynk.begin(auth, ssid, pass, server, port);  // Blocking until server connected
}

#8

Thank you Gunner, it’s working.