AHTX0 sensor

Who has already tested the AHT10 or 20 temperature sensor?
I have a hardware reset with blynk.
It seems that the library code has a blocking loop.
I will investigate more.
Tell me if you have any information.

Which AHTX0 library are you using, and which AHTX0 hardware?

Pete.

AHT10 but it’s the same than AHT20
I try Adafruit AHTX0 library and SparkFun
Same issue with blynk, works fine with the basic example provided.

Exception (28):
epc1=0x402054c2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x0000000c depc=0x00000000
>>>stack>>>
ctx: cont
sp: 3ffffcf0 end: 3fffffc0 offset: 0190

You don’t have the new beta version of the Blynk library installed do you?

Pete…

1 Like

I have the new Blynk library since yesterday , but it was the same issue before
I will try without writing to Nextion serial port , I have a doubt.

I had lots of problems when I installed the new library alongside 0.6.1, so I now have the new library on a machine of its own.

You could also try swapping around the order of the #include commands to see if that helps.

Pete.

1 Like

thank you Peter,

I think my mistake was to copy and paste the example code, I rewrote my code from scratch, everything works now !
I must have been asleep :sleeping: :sleeping: :sleeping:

1 Like
#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;

#define TEMPERATURE_PRECISION 10 // Lower resolution

void setup() {

  timer.setInterval(10010L, TempUpdate);

}

  void TempUpdate() {
  sensors_event_t humidity, temp;
  aht.getEvent(&humidity, &temp);// populate temp and humidity objects with fresh data
  temperature = temp.temperature + Calibration;
  temperature = rounded(temperature);
  Humidity = humidity.relative_humidity;

  ///////////////////////////////////// temp /////////////////////////////////////
  String T_Int = String(temperature).substring(0, 2);
  WriteStr( "home.T_Int.txt", T_Int);
  Blynk.virtualWrite(V3, temperature);
  Bridge1.virtualWrite(V19, temperature);//MCU55
  String D_Int = String(temperature).substring(2, 4); //décimal
  WriteStr( "home.D_Int.txt", D_Int);//Send to Nextion

  int gauge = map(temperature, 0, 40, 0, 100);
  WriteNum( "home.j1.val", gauge);//Send to Nextion

  ///////////////////////////////////// Hum /////////////////////////////////////
  String H_Int = String(humidity.relative_humidity).substring(0, 2);;
  WriteStr( "home.H_Int.txt", H_Int);//Send to Nextion
  Blynk.virtualWrite(V8, H_Int);

}

I have the same

You have to learn blynk structure before, because your sketch will never works as is :scream:

I am using nodeMCU too, so you can use my sketch

don’t use wire.h , and replace my virtual pins as you want

replace

#include <Thinary_AHT10.h>
AHT10Class AHT10;

by

#include <Adafruit_AHTX0.h>
Adafruit_AHTX0 aht;
1 Like

You have no timer in your code, nor in your loop :stuck_out_tongue_winking_eye:

As I said , you have to learn blynk before trying to get data from sensor :stuck_out_tongue_winking_eye:

We are here to help, but we have no time to write code for users . :stuck_out_tongue_winking_eye:
Try to learn Blynk before :wink:

Good idea , tell us if you need help :stuck_out_tongue_winking_eye: