Add details :
• Hardware model + communication type. For example: Arduino UNO with Ethernet Shield
• Smartphone OS (iOS or Android) + version
• Blynk server or local server
• Blynk Library version
• Add your sketch code. Code should be formatted as example below.
Simply paste your code between ``` If you don’t format your code, your topic can be deleted by moderators.
Hi @Pavel i now workout on nodeMcu with ultrasonic sensor, i still fail to connect to blynk cloud. as in my blynk app always said my project was’t not online. Can you help me ? i need to get data from ultrasonic sensor to blynk app.Im Beginner. I really need u guys help. tq .
/*************************************************************
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.
*************************************************************
This example runs directly on NodeMCU.
Note: This requires ESP8266 support package:
https://github.com/esp8266/Arduino
Please be sure to select the right NodeMCU module
in the Tools -> Board menu!
For advanced settings please follow ESP examples :
- ESP8266_Standalone_Manual_IP.ino
- ESP8266_Standalone_SmartConfig.ino
- ESP8266_Standalone_SSL.ino
Change WiFi ssid, pass, and Blynk auth token to run :)
Feel free to apply it to any other example. It's simple!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(172,20,10,10), 80);
}
BLYNK_WRITE(V5)// V5 is the number of Virtual Pin
{
int pinValue = param.asInt();
Serial.println(pinValue);
}
void loop()
{
Blynk.run();
}
Hi @Pavel i now workout on nodeMcu with ultrasonic sensor, i still fail to connect to blynk cloud. as in my blynk app always said my project was’t not online. Can you help me ? i need to get data from ultrasonic sensor to blynk app. tq .
Have you read through the Documentation, Help Files and looked at the example files?
You left in your AUTH code, that others here CAN use to mess with your project, but removed your WiFi and SSID, that we CANNOT use… unless we live next door … so I am unsure if you had actually entered them or not in the sketch that you uploaded to your NodeMCU?
I would also recommend searching this forum for keywords like ultrasonic? I know I made a basic example for one.
Please don’t create new topics for same issue, I moved your post back here… follow the suggestions already supplied and show us what you have tried and the results.
I tried this code to display ultrasonic sensor distance into LCD widget in blynk. but i it failed to to connect with my wifi (i use hotspot). I get this
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
//#include <Ultrasonic.h> //HC-SR04
#define TRIGGERPIN D1
#define ECHOPIN D2
long duration;
int distance;
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon).
char auth[] = "";
// Your WiFi credentials. // Set password to "" for open networks.
const char ssid[] = "";
const char pass[] = "";
WidgetLCD lcd(V1);
void setup() {
// Debug console
Serial.begin(9600);
pinMode(TRIGGERPIN, OUTPUT);
pinMode(ECHOPIN, INPUT);
Blynk.begin(auth, ssid, pass);
// You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,43,88), 8443);
lcd.clear(); //Use it to clear the LCD Widget
lcd.print(0, 0, "Distance in cm"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print") // Please use timed events when LCD printing in void loop to avoid sending too many commands // It will cause a FLOOD Error, and connection will be dropped
}
void loop() {
lcd.clear();
lcd.print(0, 0, "Distance in cm"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print") long duration, distance;
digitalWrite(TRIGGERPIN, LOW);
delayMicroseconds(3);
digitalWrite(TRIGGERPIN, HIGH);
delayMicroseconds(12);
digitalWrite(TRIGGERPIN, LOW);
duration = pulseIn(ECHOPIN, HIGH);
distance = (duration/2) / 29.1;
Serial.print(distance);
Serial.println("Cm");
lcd.print(7, 1, distance);
Blynk.run();
delay(3500);
}
Then look at the link I already provided above (the green word ultrasonic) that shows how others learned to use an ultrasonic sensor with Blynk effectively.
@Fatina_Aisya If you haven’t already found it with the recommended search… I also have a ultrasonic example you can try. It will work just fine without a physical servo attached.
@Gunner,
I think my ultimate problem is do i need to change any of the details from folder " Blynk > Script > blynk-ser" ?
As i watch a tutorial to connect blynk app i need to change the ip address ?
Is this the main problem why i cannot connect to blynk-cloud?
Another confusion is i check my ip address sometime it change from 192.168.48.88 to 172.20.10.4
Please help me. i really a beginner with this apps… i need to finish my final year project… Tq sir…
Based on the sketch you showed, you are using an ESP8266 with WiFi… so why are you trying to use the blynk-ser script for the USB link? That is for when using a basic Arduino like an UNO that has no WiFi abilities.
@Gunner Based on the sketch you showed, you are using an ESP8266 with WiFi… so why are you trying to use the blynk-ser script for the USB link? That is for when using a basic Arduino like an UNO that has no WiFi abilities.
So, thats means i dun have to make any changes in that scripts? Tq sir for help me…
@Gunner,
Basically, i want to get distance of the ultrasonic sensor data to be displayed in LCD widget of Blynk App.
I managed to display the distance in the serial monitor but i do not know how to display in LCD blynk app…
Sir,
What is the different between blynk-cloud and local server?
as far as i understand, local server is different from blynk-cloud so is that means i cannot connect my blynk app with wifi ? and if i connect my app to blynk- cloud i cannot get 100000 energy ?
The cloud server is easily accessible around the world… the “cost” of Blynk energy helps toward the cost of the servers. The benefit of the cloud is simplicity… nothing for you or I to setup aside from creating an account.
Do not worry so much about the energy… trust me, I do a lot of stuff with Blynk… but even if I used the cloud server, I highly doubt that I have used more than a total of $50 of energy over the last two years (I have spent more on coffee)… Most of that “energy” is sitting around in unused experiment projects that a normal cloud user would simply recycle for more active projects. Blynk Cloud is very cost effective.
A local Server is essentially the same concept, but can be installed on your own hardware… It is considered an advanced process, so yes, you can control the energy but you also have to regularly update, maintain and configure the Local Server, as well as setup your own network in order to do more than just use it on your own WiFi.
Something to consider… a server is an independent entity from all other servers… so for example even though one can have both a Cloud and Local Server account with same login info, they are not cross compatible. Each server controls the creation and usage of AUTH tokens for it’s own accounts and projects.
EDIT - you can clone projects from one to the other… you just have to generate new AUTHs and update the sketch with such, and connect to the correct server.
HI @shah5109 ,
Im currently working on checking the dustbin using ultrasonic sensor to sent data thru nodemcu and notify the cleaner if the dustbin is full…
How about you ? what kind of project are u working right now?