A02YYUW and measurements every 30 minutes

userHead dfrobot 2021-05-10 00:32:42 792 Views4 Replies
Dear all
I have bought an A02YYUW that I want to use for regular measurements on an ESP8266. The measured distance is to be measured every 30 minutes and transmitted to ThingSpeak. I got the sensor running on the ESP8266 via SoftwareSerial (thanks to the sample code in the wiki). I am currently using the following code:
Code: Select all
#include <SoftwareSerial.h>

SoftwareSerial mySerial(4,5); // RX, TX
unsigned char data[4]={};
float distance;

void setup()

void loop()
     for(int i=0;i<4;i++)


      int sum;
               Serial.println("Below the lower limit");
      }else Serial.println("ERROR");
Now I wanted to increase the delay for the measurement from 100ms, but already at 200ms the sensor does not work anymore. In the documentation I read the following:
"When "RX" floats or input High level, the module outputs processed value, the data is more steady, response time: 100-300ms; when input Low level, the module outputs real-time value, response time: 100ms."
According to this, I am probably in the "input Low Level" and therefore have real-time values. But how do I adapt the script so that one-time measurements can be made every 30 or 60 minutes?
Thank you very much for your help.
2021-06-21 01:23:02 Hello,

did you find a solution for this topic? I'm a newbie with all those sensor stuff and I'm currently fighting with the same issue and do not really understand how I could do this.
I would just like to somehow trigger the measure every second

Thanks in advance
userHeadPic fredy.erne
2021-05-13 14:51:00 When I say wake-up, I mean to wake up the master with the clock module, because only the master can enter the sleep mode. You can go to the wiki of the clock module to find the specific usage method. userHeadPic 347945801
2021-05-12 17:52:54 Thank you for your support. But how could I realize a "wake up" or a "shut down" of the measurment-module? userHeadPic dfrobot
2021-05-12 15:12:50 I think you may need a clock module to wake up the main control, and then perform measurements. It may not be successful to set the delay with the main control alone. userHeadPic 347945801