Blynk with ESP07 and ARDUINO UNO

Hi all,

in my project I use ESP07 to receive sensors reading from Arduino UNO and send them to internet by Blynk. All works very fine, but now I would like to command a valve (irrigation) using ESP07 digitals pin. I’ve introduced a Button on my Blynk project to command pin 13 or 12 but I’ve observed that this doesn’t work. Following the scketchs (for Arduino UNO and for ESP07). My someone help me to understand where il my fault?
thank you in advance

//Arduino UNO
include “Wire.h”
include “Adafruit_BMP085.h”
include “TSL2561.h”
include “DHT.h”
include “U8glib.h”

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);

// Pin for DHT11
define DHTPIN 10
DHT dht(DHTPIN, DHT11);

Adafruit_BMP085 bmp;
TSL2561 tsl(TSL2561_ADDR_FLOAT);

int Altitude;
float Pressure;
int Temperature;
int ir, full;
float Humidity;
float DHT_Temp;

String String_OUT ;

void setup() {
// OLED inizialization & first page
u8g.setFont(u8g_font_unifont);
u8g.firstPage();
do {
u8g.setPrintPos(0, 20);
u8g.print(“- Arduino -”);
u8g.setPrintPos(0, 40);
u8g.print(“Weather & Alarm”);
u8g.setPrintPos(0, 60);
u8g.print(“Station - 2016”);
} while( u8g.nextPage() );
// ********************************

Serial.begin(115200);

// Sensor
dht.begin();
bmp.begin();
tsl.begin();
tsl.setGain(TSL2561_GAIN_16X);
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS);
}

void loop() {

Humidity = dht.readHumidity();
DHT_Temp = dht.readTemperature();
Altitude = bmp.readAltitude(101500);
Pressure = bmp.readPressure();
Temperature = bmp.readTemperature();

uint16_t x = tsl.getLuminosity(TSL2561_VISIBLE);
uint32_t lum = tsl.getFullLuminosity();
ir = lum >> 16;
full = lum & 0xFFFF;
// picture loop
u8g.firstPage();
do {

u8g.setPrintPos(0, 20);
u8g.print("Temp = ");
u8g.print(Temperature);

u8g.setPrintPos(0, 40);
u8g.print("Hmdty = ");
u8g.print(Humidity);

u8g.setPrintPos(0, 60);
u8g.print("Lux = ");
u8g.print(full);

} while( u8g.nextPage() );
delay(50);
// end picture loop

String_OUT = String(Humidity)+“,”+String(DHT_Temp)+“,”+String(full)+“,”+“1789”+“,”+“1789”;

Serial.println(String_OUT);
delay(5000);

}

SCKETCH FOR ESP07

define BLYNK_PRINT Serial
include ESP8266WiFi.h
include BlynkSimpleEsp8266.h
include SimpleTimer.h

ADC_MODE(ADC_VCC);

char auth = “xxxxxxxxxxxxxxxxxxxx”;

String SensorsReading =“0”;
String Sensor1=“0”;
String Sensor2=“0”;
String Sensor3=“0”;
String Sensor4=“0”;
String Sensor5=“0”;

int LString = 0;
int PosComma1 =0;
int PosComma2 =0;
int PosComma3 =0;
int PosComma4 =0;

SimpleTimer timer;

void setup() {

Serial.begin(115200);
delay(1000);

Blynk.begin(auth, “xxxxxx”, “xxxxxxx”);

// Setup a function to be called every second
timer.setInterval(1000L, ReadSensor);

}

void loop() {
Blynk.run();
timer.run(); // Initiates SimpleTimer
}

void ReadSensor() {

while (Blynk.connect() == false) {
// Wait until connected
}

LString = 0;
SensorsReading = “00.00,00.00,00.00,00.00,00.00”;

if (Serial.available()) {
delay(100);
SensorsReading = Serial.readString();
}
int LString = SensorsReading.length();

int PosComma1 = SensorsReading.indexOf(‘,’);
int PosComma2 = SensorsReading.indexOf(‘,’,PosComma1+1 );
int PosComma3 = SensorsReading.indexOf(‘,’,PosComma2+1 );
int PosComma4 = SensorsReading.indexOf(‘,’,PosComma3+1 );

String Sensor1 = SensorsReading.substring(0,PosComma1);
String Sensor2 = SensorsReading.substring(PosComma1+1,PosComma2);
String Sensor3 = SensorsReading.substring(PosComma2+1,PosComma3);
String Sensor4 = SensorsReading.substring(PosComma3+1,PosComma4);
String Sensor5 = SensorsReading.substring(PosComma4+1,LString-2);

Blynk.virtualWrite(V1, ESP.getVcc());
Blynk.virtualWrite(V2, Sensor1.toFloat());
Blynk.virtualWrite(V3, Sensor2.toFloat());
Blynk.virtualWrite(V4, Sensor3.toFloat());
Blynk.virtualWrite(V5, Sensor4.toFloat());
Blynk.virtualWrite(V6, Sensor5.toFloat());

delay(100);
}

Pin do not match 1 to 1 so please check which pin in blynk relates to which pin in esp 07

1 Like