Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By schufti
#33909 Hi kas,
how do you measure the battery with ESP-01? Cant see a connection to ADC pin. Are you measuring Vdd? So are you operating the ESP-01 direct from the LiIon? What about the 4.2V freshly charged?
User avatar
By GengusKahn
#34256 This is a sketch using BMP180 DHT11 and LCD, with Google Gauges and line graphs, with the pressure separated to its own graph to preserve scale......Feel free to ask any questions.......

https://github.com/EnvironmentMonitor/ESP8266-DHT11-WiFi_Sensor/blob/master/DDTMonitor.ino
User avatar
By Marco65
#37554
kas wrote:
kkozyrev wrote:Hello. I'm looking for working sketch with bmp085. Can somebody post a esp arduinoide sketch?

This is a very compact code for BMP085/BMP180 sensor
Temperature and pressure are displayed on the Serial Monitor every 2000ms:

Code: Select all// BMP180 basic sketch

#include <SFE_BMP180.h>
#include <Wire.h>

#define ALTITUDE 750.0        // Local altitude (meters)

SFE_BMP180 bmp180;

float temperature;
int pressure;

void setup(){
  Wire.begin(0, 2);            // for ESP-01, else pins 4(SDA) and 5(SCL)
  Wire.setClock(400000);
  Serial.begin(57600);
  if (bmp180.begin()) {
    delay(200);
    Serial.println("BMP180 init success");
   }  else  {
    Serial.println("BMP180 init fail\n\n");  // check your setup with an I2C scanner
    while(1)  delay(1000);
  }
}

void loop() {
  getBMPdata(&temperature, &pressure);
  Serial.print("\nBMP temperature: "); Serial.print(temperature,1);  Serial.println(" C");
  Serial.print("sea-level pressure: "); Serial.print(pressure);  Serial.println(" mB");
  delay(2000); 
}


int getBMPdata(float* temp, int* pres) {
  double T,P,p0;
  char status;
  status = bmp180.startTemperature();
  if (status != 0)  {
    delay(status *2);
    status = bmp180.getTemperature(T);
    if (status != 0)  {
      status = bmp180.startPressure(1);
      if (status != 0)  {
        delay(status *2);
        status = bmp180.getPressure(P,T);
        if (status != 0)  {
          p0 = bmp180.sealevel(P,ALTITUDE);
          *temp = T;
          *pres = int(p0+0.5);
           return 1;
        }   else return 0;
      }   else return 0;
    }   else return 0;
  }   else return 0;
}
 



I use this code for my new Data Logger (T, P and battery level are sent to ThingSpeak)
Image
** Full code available on request **
.

Hi Ivan, kudos for you hard work ;)


Can i get the code please?
User avatar
By Mario Mikočević
#37629
kas wrote:This is a very compact code for BMP085/BMP180 sensor
Temperature and pressure are displayed on the Serial Monitor every 2000ms:

I use this code for my new Data Logger (T, P and battery level are sent to ThingSpeak)
Image
** Full code available on request **
.

Hi Ivan, kudos for you hard work ;)


Heya kas,

how are you satisfied with those LiFePO4 ?
I do think that number 1500mAh is way way off. I cannot get more than 700mAh on mine.

--
Mozz