I tried to redo the tutorial man times following every step and code, as well as the blynk settings.
When i login to blynk using my laptop, it says that its online but in my phone, it says status offline. Right bellow the online status says disconnected from server.
Another thing im worried about is that the LED of the ESP8266 is not conistently on, it blinks a few times when i connect it to a micro usb then it disappears. Also the vibration sensor, only 1 led is working but if i remove 1 pin, both LEDs turn on.
i connected vcc to 3v, Do to Do and GND to G of the ESP8266.
When i upload the code to the ESP, it says done uploading but it also says
A fatal esptool.py error occurred: could not open port 'COM5': OSError(22, 'The semaphore timeout period has expired.', None, 121)
Please help,
Mod edit
Blynk credentials removed.
#define BLYNK_TEMPLATE_ID "xxxx"
#define BLYNK_TEMPLATE_NAME "xxxx"
#define BLYNK_AUTH_TOKEN "xxxx"
#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
// Blynk settings
char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "WiFi Username";
char pass[] = "WiFi Password";
// Vibration sensor settings
const int vibrationPin = A0; // Use the appropriate analog pin on your ESP8266
const int threshold = 500; // Adjust this threshold based on your sensor and environment
// Blynk Virtual Pins
#define VIRTUAL_PIN_VIBRATION V1
// Timer settings
BlynkTimer timer;
// Function prototypes
void checkVibration();
void setup() {
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000, checkVibration);
}
void loop() {
Blynk.run();
timer.run();
}
void checkVibration() {
int vibrationValue = analogRead(vibrationPin);
Blynk.virtualWrite(VIRTUAL_PIN_VIBRATION, vibrationValue);
if (vibrationValue > threshold) {
Serial.println("Vibration detected!");
Blynk.logEvent("earthquake_alert","Earthquake Detected!");
}
}
Disconnect all the sensor wiring from Esp.
Does IDE find your Esp when you connect it through USB?
Do you use usb-cable that is working properly (for data).
I wonder why you use analogRead for digital output sensor.
DO of the sensor means digital out.
D0 on Esp is wrong pin, and if connected to low, prevents Esp to boot.
If you want to use analogRead, you need to connect to A0.
I turned on the verbose output options like you've said. I tried uploading it and it says uploading successful and it doesn't have the "copy error message option" but it still seems like it doesn't work. I made sure to turn on notifications and follow the tutorial. Also, in the last line of message after it finished uploading, some of the texts turned orange while most at the top is white
Variables and constants in RAM (global, static), used 30896 / 80192 bytes (38%)
β SEGMENT BYTES DESCRIPTION
β ββ DATA 1560 initialized variables
β ββ RODATA 2568 constants
βββ BSS 26768 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 61247 / 65536 bytes (93%)
β SEGMENT BYTES DESCRIPTION
β ββ ICACHE 32768 reserved space for flash instruction cache
βββ IRAM 28479 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 252916 / 1048576 bytes (24%)
β SEGMENT BYTES DESCRIPTION
βββ IROM 252916 code in flash
Using library Blynk at version 1.3.2 in folder: C:\Users\emman\Documents\Arduino\libraries\Blynk
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\emman\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\ESP8266WiFi
C:\Users\emman\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3 -I C:\Users\emman\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2/tools/upload.py --chip esp8266 --port COM6 --baud 115200 --before default_reset --after hard_reset write_flash 0x0 C:\Users\emman\AppData\Local\Temp\arduino_build_149906/earthquake-alert-using-esp8266-and-blynk-iot.ino.bin
esptool.py v3.0
Serial port COM6
Connecting...
A fatal esptool.py error occurred: Write timeout
Also, i still can't figure out what's wrong with the Arduino and sim900a. I connected them using this: sim900a to Arduino Uno: 5VR - 10, 5VT - 11, VCC - 5V, GND - GND.
water level sensor to arduino uno: S - A2, + - 5V, - - GND
I did the code
//Tech Trends Shameer
//Flood Alert Call and SMS
#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"
#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4
int resval = 0; // holds the value
int respin = A3; // Water Level Sensor Pin
#define FONA_RI_INTERRUPT 0
SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
char PHONE_1[21] = "+639944572977"; // Enter your Mobile Number
char tempalert[141]= "Flood Alert" ;
void setup()
{
// pinMode(gas_sensor_pin,INPUT);
Serial.begin(115200);
// dht.begin();
Serial.println(F("Initializing....(May take 3 seconds)"));
delay(5000);
fonaSS.begin(9600); // if you're using software serial
if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1)
Serial.println(F("Couldn't find FONA"));
while (1);
}
fona.print ("AT+CSMP=17,167,0,0\r");
Serial.println(F("FONA is OK"));
//fona.sendSMS(PHONE_1, welcomemessage);
// pinMode(gas_sensor_pin, INPUT);
}
void loop(){
resval = analogRead(respin);
Serial.print("Water Level:");
Serial.println(resval);
if(resval>200 )
{
Serial.println("Flood Alert");
make_multi_call();
send_multi_sms();
}
}
void send_multi_sms()
{
if(PHONE_1 != ""){
Serial.print("Phone 1: ");
fona.sendSMS(PHONE_1,tempalert);
delay(20000);
}
}
void make_multi_call()
{
if(PHONE_1 != ""){
Serial.print("Phone 1: ");
make_call(PHONE_1);
delay(20000);
}
}
void make_call(String phone)
{
Serial.println("calling....");
fona.println("ATD"+phone+";");
delay(20000); //20 sec delay
fona.println("ATH");
delay(1000); //1 sec delay
}
after uploading, an error came up saying
Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\emman\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\emman\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\emman\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10819 -build-path C:\Users\emman\AppData\Local\Temp\arduino_build_839112 -warnings=all -build-cache C:\Users\emman\AppData\Local\Temp\arduino_cache_788251 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\emman\Downloads\flood-alert-system\flood-alert-system.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\emman\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\emman\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\emman\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10819 -build-path C:\Users\emman\AppData\Local\Temp\arduino_build_839112 -warnings=all -build-cache C:\Users\emman\AppData\Local\Temp\arduino_cache_788251 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\emman\Downloads\flood-alert-system\flood-alert-system.ino
Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp" -o nul
Alternatives for SoftwareSerial.h: [SoftwareSerial@1.0]
ResolveLibrary(SoftwareSerial.h)
-> candidates: [SoftwareSerial@1.0]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp" -o nul
Alternatives for Adafruit_FONA.h: [Adafruit_FONA_Library@1.3.13]
ResolveLibrary(Adafruit_FONA.h)
-> candidates: [Adafruit_FONA_Library@1.3.13]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "-IC:\\Users\\emman\\Documents\\Arduino\\libraries\\Adafruit_FONA_Library" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp" -o nul
Using cached library dependencies for file: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial\src\SoftwareSerial.cpp
Using cached library dependencies for file: C:\Users\emman\Documents\Arduino\libraries\Adafruit_FONA_Library\Adafruit_FONA.cpp
Generating function prototypes...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "-IC:\\Users\\emman\\Documents\\Arduino\\libraries\\Adafruit_FONA_Library" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp" -o "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Program Files (x86)\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10819 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\libraries\\SoftwareSerial\\src" "-IC:\\Users\\emman\\Documents\\Arduino\\libraries\\Adafruit_FONA_Library" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp" -o "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp.o"
C:\Users\emman\Downloads\flood-alert-system\flood-alert-system.ino: In function 'void send_multi_sms()':
C:\Users\emman\Downloads\flood-alert-system\flood-alert-system.ino:68:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
if(PHONE_1 != ""){
^~
C:\Users\emman\Downloads\flood-alert-system\flood-alert-system.ino: In function 'void make_multi_call()':
C:\Users\emman\Downloads\flood-alert-system\flood-alert-system.ino:78:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
if(PHONE_1 != ""){
^~
Compiling libraries...
Compiling library "SoftwareSerial"
Using previously compiled file: C:\Users\emman\AppData\Local\Temp\arduino_build_839112\libraries\SoftwareSerial\SoftwareSerial.cpp.o
Compiling library "Adafruit_FONA_Library"
Using previously compiled file: C:\Users\emman\AppData\Local\Temp\arduino_build_839112\libraries\Adafruit_FONA_Library\Adafruit_FONA.cpp.o
Compiling core...
Using precompiled core: C:\Users\emman\AppData\Local\Temp\arduino_cache_788251\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a
Linking everything together...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/flood-alert-system.ino.elf" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\sketch\\flood-alert-system.ino.cpp.o" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\libraries\\SoftwareSerial\\SoftwareSerial.cpp.o" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112\\libraries\\Adafruit_FONA_Library\\Adafruit_FONA.cpp.o" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/..\\arduino_cache_788251\\core\\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112" -lm
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/flood-alert-system.ino.elf" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/flood-alert-system.ino.eep"
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/flood-alert-system.ino.elf" "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/flood-alert-system.ino.hex"
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
Using library Adafruit_FONA_Library at version 1.3.13 in folder: C:\Users\emman\Documents\Arduino\libraries\Adafruit_FONA_Library
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\emman\\AppData\\Local\\Temp\\arduino_build_839112/flood-alert-system.ino.elf"
Sketch uses 8162 bytes (25%) of program storage space. Maximum is 32256 bytes.
Global variables use 909 bytes (44%) of dynamic memory, leaving 1139 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM7 -b115200 -D -Uflash:w:C:\Users\emman\AppData\Local\Temp\arduino_build_839112/flood-alert-system.ino.hex:i
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"
Using Port : COM7
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: ser_open(): can't open device "\\.\COM7": The system cannot find the file specified.
avrdude done. Thank you.
Problem uploading to board. See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.
You are writing that uploading was successfull
but why do you then post this error-message that clearly indicates
that there was NO upload?!
If your upload would have been successfull then you would see someting like this
esptool.py v3.0
Serial port COM10
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 48:55:19:e4:3f:76
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0340
Compressed 397712 bytes to 293063...
Writing at 0x00000000... (5 %)
Writing at 0x00004000... (11 %)
Writing at 0x00008000... (16 %)
Writing at 0x0000c000... (22 %)
Writing at 0x00010000... (27 %)
Writing at 0x00014000... (33 %)
Writing at 0x00018000... (38 %)
Writing at 0x0001c000... (44 %)
Writing at 0x00020000... (50 %)
Writing at 0x00024000... (55 %)
Writing at 0x00028000... (61 %)
Writing at 0x0002c000... (66 %)
Writing at 0x00030000... (72 %)
Writing at 0x00034000... (77 %)
Writing at 0x00038000... (83 %)
Writing at 0x0003c000... (88 %)
Writing at 0x00040000... (94 %)
Writing at 0x00044000... (100 %)
Wrote 397712 bytes (293063 compressed) at 0x00000000 in 25.9 seconds (effective 122.9 kbit/s)...
Hash of data verified.
additionally what you have posted as compile-log
Is maybe 1% of what the real verbose compile-log would print
I suspect what you call "upload" was the compile-process.
Anyway @ptillisch I do not use Arduino IDE 2.X (I still use version 1.8.19)
the serial monitor of IDE 2.X has a problem to copy all text (and probably will have until version 3.X coming in 2030)
Does the compile-log window have the same problem, that in case the compiling was successfull that then if there is a problem with uploading the "copy error-message-button is not there?
then draw a handdraw schematic like shown in the tutorial and post a picture of it.
by the way trying to supply a Sim-Module from the arduino is a really bad idea.
The Arduinos onboard-voltage regulator can not provide enough power for such a module.
You really need an external power-supply for the sim-module.