<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[T-Display-S3 with ultrasonic sensor ( water level indicator )]]></title><description><![CDATA[<p dir="auto">I'm trying to figure out if someone out there used the T-Display-S3 combined with any ultrasonic range detector to detect and display the water level in a small 2gal tank. I've picked the T-Display-S3 for its onboard display and looking for some instructions.<br />
if anyone can point me out in the right direction it would be great.<br />
tried to search but couldn't come up with anything.<br />
I have few sensor options :</p>
<ol>
<li>HC-SR04</li>
<li>A02YYUW</li>
</ol>
<p dir="auto">cheers</p>
]]></description><link>https://www.community.lilygo.cc/topic/368/t-display-s3-with-ultrasonic-sensor-water-level-indicator</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 05:25:15 GMT</lastBuildDate><atom:link href="https://www.community.lilygo.cc/topic/368.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 09 May 2023 21:10:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to T-Display-S3 with ultrasonic sensor ( water level indicator ) on Wed, 17 May 2023 09:30:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> Thank you Terry,</p>
<p dir="auto">I'll give the instructions a go and see if I make it to work the way I want.</p>
]]></description><link>https://www.community.lilygo.cc/post/763</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/763</guid><dc:creator><![CDATA[OH23]]></dc:creator><pubDate>Wed, 17 May 2023 09:30:16 GMT</pubDate></item><item><title><![CDATA[Reply to T-Display-S3 with ultrasonic sensor ( water level indicator ) on Wed, 17 May 2023 02:03:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/774">@oh23</a> Here is an “Instructable” set up guide:<br />
<a href="https://www.instructables.com/Simple-Arduino-and-HC-SR04-Example/" rel="nofollow ugc">https://www.instructables.com/Simple-Arduino-and-HC-SR04-Example/</a><br />
You could use GPIOpins 1 and 2 for the trig and echo.<br />
The other, fancier sensor would need need a dedicated library with a suggested example.<br />
Such as here:<br />
<a href="https://www.dfrobot.com/product-1935.html" rel="nofollow ugc">https://www.dfrobot.com/product-1935.html</a><br />
Use pins 17, 18 as per the LilyGO T-Display S3 pinout, strictly observing tx and rx pin assignments.<br />
Hope this helps!<br />
-Terry<br />
P.S. I also have a general, but comprehensive setup guide for the LilyGO T-Display S3 here:<br />
<a href="https://github.com/teastainGit/LilyGO-T-display-S3-setup-and-examples" rel="nofollow ugc">https://github.com/teastainGit/LilyGO-T-display-S3-setup-and-examples</a></p>
]]></description><link>https://www.community.lilygo.cc/post/762</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/762</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Wed, 17 May 2023 02:03:42 GMT</pubDate></item><item><title><![CDATA[Reply to T-Display-S3 with ultrasonic sensor ( water level indicator ) on Tue, 16 May 2023 21:18:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> ATM I have the HC-SR04 connected.<br />
I have to pick up the A02YYUM from the post office tomorrow so if its not much of a hustle for you ill be happy if you can try with the HC-SR04 first.</p>
<p dir="auto">and I want to say again that I really appreciate your prompt replies and help, THANK YOU.</p>
]]></description><link>https://www.community.lilygo.cc/post/761</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/761</guid><dc:creator><![CDATA[OH23]]></dc:creator><pubDate>Tue, 16 May 2023 21:18:54 GMT</pubDate></item><item><title><![CDATA[Reply to T-Display-S3 with ultrasonic sensor ( water level indicator ) on Tue, 16 May 2023 21:00:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/774">@oh23</a> Well, if you don't need any of it except the water sensor...can you tell me which sensor and sensor board product and I'll recommend a hook up?<br />
-Terry</p>
]]></description><link>https://www.community.lilygo.cc/post/760</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/760</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Tue, 16 May 2023 21:00:44 GMT</pubDate></item><item><title><![CDATA[Reply to T-Display-S3 with ultrasonic sensor ( water level indicator ) on Tue, 16 May 2023 19:26:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/612">@teastain2</a> Hey Terry,<br />
Thank you so much for your elaborated reply, I've somehow missed it and didn't even get a notification that someone have replied to my question.</p>
<p dir="auto">I was able to find a very nice YT tut of exactly what I'm looking for.<br />
here is the link<br />
<a href="https://www.youtube.com/watch?v=9geREeE13jc&amp;list=LL&amp;index=14&amp;t=570s" rel="nofollow ugc">link text</a></p>
<p dir="auto">the only thing I'm trying to figure out is what exactly do i have to change in the scheme so it will work on my board and display.<br />
I actually don't even need the blynk app, buzzer, or any other remote options just to be able to see the water level in the tank, on the 1.9" T-Display in %</p>
<p dir="auto">here is the scheme</p>
<pre><code>/**********************************************************************************
 *  TITLE: IoT-based Water Level Indicator using ESP32, Ultrasonic Sensor &amp; Blynk with 0.96" OLED
 *  Click on the following links to learn more. 
 *  YouTube Video: https://youtu.be/9geREeE13jc
 *  Related Blog : https://iotcircuithub.com/esp32-projects/
 *  
 *  This code is provided free for project purpose and fair use only.
 *  Please do mail us to techstudycell@gmail.com if you want to use it commercially.
 *  Copyrighted © by Tech StudyCell
 *  
 *  Preferences--&gt; Aditional boards Manager URLs : 
 *  https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
 *  
 *  Download Board ESP32 (2.0.5) : https://github.com/espressif/arduino-esp32
 *
 *  Download the libraries 
 *  Blynk Library (1.1.0):  https://github.com/blynkkk/blynk-library
 *  Adafruit_SSD1306 Library (2.5.7): https://github.com/adafruit/Adafruit_SSD1306
 *  AceButton Library (1.9.2): https://github.com/bxparks/AceButton
 **********************************************************************************/
 
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN ""

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

//Set Water Level Distance in CM
int emptyTankDistance = 70 ;  //Distance when tank is empty
int fullTankDistance =  30 ;  //Distance when tank is full

//Set trigger value in percentage
int triggerPer =   10 ;  //alarm will start when water level drop below triggerPer

#include &lt;Adafruit_SSD1306.h&gt;
#include &lt;WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;BlynkSimpleEsp32.h&gt;
#include &lt;AceButton.h&gt;
using namespace ace_button; 

// Define connections to sensor
#define TRIGPIN    27  //D27
#define ECHOPIN    26  //D26
#define wifiLed    2   //D2
#define ButtonPin1 12  //D12
#define BuzzerPin  13  //D13
#define GreenLed   14  //D14

//Change the virtual pins according the rooms
#define VPIN_BUTTON_1    V1 
#define VPIN_BUTTON_2    V2

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);


float duration;
float distance;
int   waterLevelPer;
bool  toggleBuzzer = HIGH; //Define to remember the toggle state

char auth[] = BLYNK_AUTH_TOKEN;

ButtonConfig config1;
AceButton button1(&amp;config1);

void handleEvent1(AceButton*, uint8_t, uint8_t);

BlynkTimer timer;

void checkBlynkStatus() { // called every 3 seconds by SimpleTimer

  bool isconnected = Blynk.connected();
  if (isconnected == false) {
    //Serial.println("Blynk Not Connected");
    digitalWrite(wifiLed, LOW);
  }
  if (isconnected == true) {
    digitalWrite(wifiLed, HIGH);
    //Serial.println("Blynk Connected");
  }
}

BLYNK_CONNECTED() {
  Blynk.syncVirtual(VPIN_BUTTON_1);
  Blynk.syncVirtual(VPIN_BUTTON_2);
}

void displayData(int value){
  display.clearDisplay();
  display.setTextSize(4);
  display.setCursor(8,2);
  display.print(value);
  display.print(" ");
  display.print("%");
  display.display();
}

void measureDistance(){
  // Set the trigger pin LOW for 2uS
  digitalWrite(TRIGPIN, LOW);
  delayMicroseconds(2);
 
  // Set the trigger pin HIGH for 20us to send pulse
  digitalWrite(TRIGPIN, HIGH);
  delayMicroseconds(20);
 
  // Return the trigger pin to LOW
  digitalWrite(TRIGPIN, LOW);
 
  // Measure the width of the incoming pulse
  duration = pulseIn(ECHOPIN, HIGH);
 
  // Determine distance from duration
  // Use 343 metres per second as speed of sound
  // Divide by 1000 as we want millimeters
 
  distance = ((duration / 2) * 0.343)/10;

  if (distance &gt; (fullTankDistance - 10)  &amp;&amp; distance &lt; emptyTankDistance ){
    waterLevelPer = map((int)distance ,emptyTankDistance, fullTankDistance, 0, 100);
    displayData(waterLevelPer);
    Blynk.virtualWrite(VPIN_BUTTON_1, waterLevelPer);
    Blynk.virtualWrite(VPIN_BUTTON_2, (String(distance) + " cm"));

    // Print result to serial monitor
    Serial.print("Distance: ");
    Serial.print(distance);
    Serial.println(" cm");

    if (waterLevelPer &lt; triggerPer){
      digitalWrite(GreenLed, HIGH);
      if (toggleBuzzer == HIGH){
        digitalWrite(BuzzerPin, HIGH);
      }      
    }
    if (distance &lt; fullTankDistance){
      digitalWrite(GreenLed, LOW);
      if (toggleBuzzer == HIGH){
        digitalWrite(BuzzerPin, HIGH);
      } 
    }

    if (distance &gt; (fullTankDistance + 5) &amp;&amp; waterLevelPer &gt; (triggerPer + 5)){
      toggleBuzzer = HIGH;
      digitalWrite(BuzzerPin, LOW);
    }        
  }
  
  // Delay before repeating measurement
  delay(100);
}

 
void setup() {
  // Set up serial monitor
  Serial.begin(115200);
 
  // Set pinmodes for sensor connections
  pinMode(ECHOPIN, INPUT);
  pinMode(TRIGPIN, OUTPUT);
  pinMode(wifiLed, OUTPUT);
  pinMode(GreenLed, OUTPUT);
  pinMode(BuzzerPin, OUTPUT);

  pinMode(ButtonPin1, INPUT_PULLUP);

  digitalWrite(wifiLed, LOW);
  digitalWrite(GreenLed, LOW);
  digitalWrite(BuzzerPin, LOW);

  config1.setEventHandler(button1Handler);
  
  button1.init(ButtonPin1);

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  delay(1000);  
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.clearDisplay();

  WiFi.begin(ssid, pass);
  timer.setInterval(2000L, checkBlynkStatus); // check if Blynk server is connected every 2 seconds
  Blynk.config(auth);
  delay(1000);
 
}
 void loop() {

  measureDistance();

  Blynk.run();
  timer.run(); // Initiates SimpleTimer

  button1.check();
   
}

void button1Handler(AceButton* button, uint8_t eventType, uint8_t buttonState) {
  Serial.println("EVENT1");
  switch (eventType) {
    case AceButton::kEventReleased:
      //Serial.println("kEventReleased");
      digitalWrite(BuzzerPin, LOW);
      toggleBuzzer = LOW;
      break;
  }
}

</code></pre>
]]></description><link>https://www.community.lilygo.cc/post/759</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/759</guid><dc:creator><![CDATA[OH23]]></dc:creator><pubDate>Tue, 16 May 2023 19:26:15 GMT</pubDate></item><item><title><![CDATA[Reply to T-Display-S3 with ultrasonic sensor ( water level indicator ) on Tue, 09 May 2023 22:55:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://www.community.lilygo.cc/uid/774">@oh23</a> Do you have experience with Arduino IDE?<br />
The LilyGO T-Display S3 is a beautiful state of the art dev board, and is really an Arduino on steroids.<br />
99% of all Arduino sensors will work on LilyGO T-Display S3 !<br />
It is specifically an ESP32 S3.<br />
With sensors I prefer i2c connected ones!<br />
The A02YYUW you recommended works very well and is UART comm and water proof.<br />
The other HC-SR04 is more for dry environments and I am not familiar with the trig/echo scheme, but it probably is supported by libraries.<br />
My first choice would be a VL53L TOF sensor with i2c comms, but in a waterproof package.<br />
-Terry</p>
]]></description><link>https://www.community.lilygo.cc/post/681</link><guid isPermaLink="true">https://www.community.lilygo.cc/post/681</guid><dc:creator><![CDATA[teastain2]]></dc:creator><pubDate>Tue, 09 May 2023 22:55:36 GMT</pubDate></item></channel></rss>