Help flashing blynk on ESP8266 with tls usb

Sorry for that X)

Well, maybe it is because I need to solder the 2 pins on my tls usb dongle?

I do not have a clue about your issue… all that verbatim dump says is there was lots of things that the compiler was warning about.

You need to provide actual issue details and, if relevant, code.

1 Like

Full wipe on arduino, libraries included, and I’m up and running. Should’ve done that before whining X)

Thank you again!

2 Likes

I have my relay connected to gp0 and the DHT11 on gp2.
I’m facing two problems:
First, sometimes I get crazy readings like 140% humidity and 10 degrees when it’s 24ºC.
Second, I see no network port for OTA on my 1.8.7 IDE,

PS: I followed the sketches I found on the forum for the OTA.

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266mDNS.h>  // For OTA
#include <WiFiUdp.h>  // For OTA
#include <ArduinoOTA.h>  // For OTA

#include <SimpleTimer.h>
SimpleTimer timer;

#include <dht11.h>
dht11 DHT;
#define DHT11_PIN 2

char auth[] = "XXXXXX"; //insert here your token generated by Blynk



void setup()
{
 
  
  Serial.begin(9600); // See the connection status in Serial Monitor
   Blynk.begin(auth, "XXXXX", "XXXXXXX"); //insert here your SSID and password

  ArduinoOTA.setHostname("Ventilator");  // For OTA
  ArduinoOTA.begin();  // For OTA
  
  
  // Setup a function to be called every second
  timer.setInterval(120000L, sendUptime);
}

void sendUptime()
{
  Blynk.virtualWrite(10, DHT.temperature); //virtual pin
  Blynk.virtualWrite(11, DHT.humidity); // virtual pin 
}

void loop()
{
  ArduinoOTA.handle();  // For OTA
  timer.run(); // Initiates SimpleTimer
  int chk; 
  chk = DHT.read(DHT11_PIN);    // READ DATA
  Blynk.run(); // Initiates Blynk
}

You’re currently trying to read the DHT sensor every time your void loop executes, which should be hundreds of times per second. The DHT can’t cope with this, and neither can Blynk. It may also be the cause of your OTA issues.

Move these lines to the start of your void sendUptime function:

  int chk; 
  chk = DHT.read(DHT11_PIN);    // READ DATA

You may then want to reduce the timer interval from the current 120000 (120 seconds) to around 10000 (10 seconds) if you want more frequent readings.

Also, I don’t think this is needed:

but I would include this before your ArduinoOTA.setHostname command:

  ArduinoOTA.onError([](ota_error_t error) { ESP.restart(); });

Pete.

Thank you!

First problem seems to be solved. I will keep that in mind in future projects.

Unfortunatly still no OTA :S

Do you have the correct Python library installed in the correct way on your PC?

Pete.

Also, read this:

Pete.

2 Likes

And solved again master Pete! Thank you!

1 Like

Well, I need help again…

Two and a half years since I played with blynk. Being an absolutely noob, it was so much time, I forgot everything I learned in that time.

I’m back now, trying to automate my new home.

I went back picking what I had from that time, which is 3 stand-alone esp8266, 2 nano, one uno and a couple of Relays. I learned quickly that the uno and the nanos are pretty much useless nowadays.
I’ve been reading as much as I can… everything is new again. I started with esp8266 with one relay and dht11. Problem is, as discussed on many topics, the relay go high on start. I tried every solution I found and none worked.

Believe me, I was not lazy, I tried to solve the problem for hours and hours…

You don’t say what sort of ESP boards you’re using. If they are the ESP-01 boards (8 pins at one end of the small board) then I’d forget them and go for NodeMCU or Wemos D1 Mini boards instead.

The choice of GPIO pin you use is important, see this handy post:

Also, don’t forget that the numbers printed next to the pins on a NodeMCU or Wemos D1 Mini Board aren’t GPIO numbers, you need to refer to a pinout diagram for your board to translated the D numbers to GPIOs.

If you’re trying to manipulate your GPIO pins directly (by selecting Digital rather than Virtual pins in the Blynk app) then you have limited control over what they do.
I always use Virtual pins, and set them to the desired state (HIGH or LOW) immediately after startup with a digitalWrite command in the Void setup (don’t forget to issue a pinMode statement first for that pin, so that the code knows that it’s an input or output pin).

Pete.

Yes, they are all esp01.

I read that article before and I understood my 4 available gpio will start on high. Anyway, I was trying to get them low after they auto go high on ‘boot’ and I can’t manage to achieve it.

It would be really nice to use, at least this old esps, since the uno and nanos are useless anyway.

To be honest, the NodeMCUs and Wemos D1 Mini’s are so cheap, and so much easier to use, that it’s a false economy to waste time messing around with the ESP-01s.
I prefer the Wemos D1 Minis, as they’re a bit more breadboard friendly, and they have various ‘shields’ that can be stacked or used side-by-side on doubler or tripler bases. I find the modular nature of this setup very easy to work with and it makes troubleshooting and debugging very easy. I’ve used the relay modules, OLED display board and prototyping boards in a few of my home automation projects. You can get a D1 Mini for less than USD 3 on AliExpress.

Post the code where you’ve tried to get the pins to go Low after boot and we’ll take a look at it.

Pete.

Actually, the ESP-01 still is best used to make those old UNO, Nano and Mega Arduinos fully usable with wireless IoT. Just use the ESP, with AT firmware, as a Serial to WiFi adapter and write your programs on the Arduino. Full control of lots of GPIO, without fighting the GPIO boot state quirks of the ESP’s GPIOs.

That said, when using fuller capacity ESP8266 boards like the NodeMCU and Wemos D1 Mini… working around those ESP boot state quirks is just like @PeteKnight said… it may not prevent the initial minuscule pulse on the pins, between boot state and code start, but even that can be mitigated with capacitors or other pin juggling to preferred boot-up state.

Thank you all for your answers.

After hours and hours I understand the false economy thing and already bought one sonoff basic to hack and a wemos on aliexpress.

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#include <SimpleTimer.h>
#include <DHT.h>
#define DHTPIN 0
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

char auth[] = "";
char ssid[] = "";
char pass[] = "";


BLYNK_WRITE(V3)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V3 to a variable
  Serial.println(pinValue);
  if (pinValue == 1) {
        digitalWrite(3, LOW);
    }else {
        digitalWrite(3, HIGH);    
    }

}

void setup()
{
  Serial.begin(9600);  // BLYNK_PRINT data

  WiFi.begin(ssid, pass);
  Blynk.config(auth);
  Blynk.connect();

  timer.setInterval(60000L, sendSensor);
}


void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V11, h);
  Blynk.virtualWrite(V10, t);
}

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

Problem is it’s always desconnecting for no reason.

I also tried to add digitalWrite(3, LOW); in void setup Instead of blynk write before but with the same results.

About using esp01 as a shield with my old uno, tried that also, following blynk instructions but I get stuck on sending AT commands to ESP01 to put in 9600 rate.

Because you have been programming the ESP-01 directly you overwrote the AT firmware. In-order to use it as a Serial-WiFi adapter, you need to re-flash it back to it’s “original” firmware… AKA AT firmware… then you can use AT commands to set the BAUD and never need to touch it again :wink:

https://www.google.com/search?&q=flashing+AT+firmware+to+ESP-01

I’m not that noob! :stuck_out_tongue:
Already done that. But as per instructions I need to send

AT+CIOBAUD=9600

After flashing the original firmware but I get nothing 0 caput. I even tried sending at commands via uno.

See the last post…

https://www.esp8266.com/viewtopic.php?f=13&t=718

and in the Blynk Help docs…

http://help.blynk.cc/how-to-connect-different-hardware-with-blynk/arduino/esp8266-with-at-firmware

image

Adding commands to set the pins low within the BLYNK_WRITE (V3) function will have no effect on the startup state, as this function isn’t triggered until the V3 button is pressed, or you do a BlynkSyncVirtual(V3) command.

Also, you’ve stated that you want the relay to be off (LOW) on startup, not to synchronise with the current state of the button on V3.

You need a PinMode command, followed by a digitalWrite command in your void setup, to set the relay LOW on startup.
You also need to do a Blynk.VirtualWrite(V3, 0) after Blynk Connect to also set the switch widget to off, so that it’s in sync with the relay.

Pete.