So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By RichardS
#81144 Do not know for sure, but using GPIO0 is always tricky, it probably already has its own pullup on the module, also using the pins that may or may not be used for the flash is also tricky...

You really need a oscope to see what is going on.

RichardS
User avatar
By poteroa
#81158 If anyone could maybe edit my code for adding the DHT11?
I know, should have posted it in the first place, so no guess work needed.. :)

So this is working fine at the moment..

Any help, please? :)

Code: Select all#define BLYNK_PRINT Serial
#include <Wire.h>
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
int tmp275Address = 0x48;  // TMP275 address

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "AUTH TOKEN";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "SSID";
char pass[] = "PASS";

BlynkTimer timer;
float temperature = 0;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
{
  temperature = getTemperature();// You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, temperature);
 
}

void setup()
{
  //Debug console
  Serial.begin(115200);
  Wire.begin(0, 2);

  Blynk.begin(auth, ssid, pass);

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

void loop(){

  float celsius = getTemperature();
  Serial.println(celsius);
}

float getTemperature(){
  Wire.requestFrom(tmp275Address,2);

  byte MSB = Wire.read();
  byte LSB = Wire.read();

  int TemperatureSum = ((MSB << 8) | LSB) >> 4;

  float celsius = TemperatureSum*0.0625;

  if (celsius > 128)
  {
  celsius = celsius - 256; // for negative temperatures
  }
  else
    celsius;
{
  Blynk.run();
  timer.run();
  return celsius;
}
}
User avatar
By poteroa
#81229
eriksl wrote:Ditch the DHT11's and use I2C sensors only.


Hi,

Well, that would be the ideal choice, but as I am stuck with bunch of these sensors, would be nice to implement them to the project.

I actually got the sensors running, but there are some timing issues.
In random times the DHT sensor readings go to zero or are 50% less than actual, i2c is rock solid.

I think the problem is the delay I am using, so will try to use timer and millis.

I think anyway will place china order for i2c ones, but thats 2 months in worst case scenario to actually have them in hand.

Well, will have time to redo the code a few times. :lol: