Navigation

    LILYGO

    • Register
    • Login
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    1. Home
    2. patofoto
    P
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 6
    • Best 0
    • Groups 0

    patofoto

    @patofoto

    0
    Reputation
    2
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    patofoto Unfollow Follow

    Latest posts made by patofoto

    • RE: T-Display-S3 and JST Pin 43

      @teastain2 Just ordered a new T-Display-S3 for testing. Only have one at the moment and is in use. Will start testing soon.

      posted in Technical Discussion
      P
      patofoto
    • RE: T-Display-S3 and JST Pin 43

      @teastain2 Thank you!. Just checked your post and saw an answer. Unsure what they mean. Will follow the link they provide and see what I can discover. This is already way over my head to know what to look for but have the patience for trial and error. Will report back if I have any success with something.

      posted in Technical Discussion
      P
      patofoto
    • RE: T-Display-S3 and JST Pin 43

      @teastain2 Hey there. Hoping I don't sound like I am pushing you. Just curious if you had made any progress with pin assignments and the JST connector. I reverted to using ESPHome for programing my board so I am good for using it now but would love to move to using VSCode and getting to learn Arduino better.

      posted in Technical Discussion
      P
      patofoto
    • RE: T-Display-S3 and JST Pin 43

      @teastain2 I see. Thank you so much for your explanation. I now understand that onewire is a protocol like i2c. So the onewire library in Arduino is too old to be used in the T-Display-S3 and enable

      Where can I start looking to see how ESPHome implements this?. This is the ESPHome page for the Dallas sensor:

      Dallas Sensor

      This is the YAML code that ESPHome uses to flash my T-Display_S3:

      esphome:
        name: developer-temp
        friendly_name: Developer Temp
      
      external_components:
        - source: github://landonr/lilygo-tdisplays3-esphome
          components: [tdisplays3]
      
      esp32:
        board: esp32-s3-devkitc-1
        framework:
          type: arduino
      
      # Enable logging
      logger:
      
      # Enable Home Assistant API
      api:
        encryption:
          key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      
      ota:
        password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      
      wifi:
        ssid: !secret wifi_ssid
        password: !secret wifi_password
      
        # Enable fallback hotspot (captive portal) in case wifi connection fails
        ap:
          ssid: "Developer-Temp Fallback Hotspot"
          password: "xxxxxxxxxxxxxxxxx"
      
      captive_portal:
        
      # bluetooth_proxy:
      #   active: true  
      
      time:
        - platform: homeassistant
          id: ha_time
      
      switch:
        - platform: gpio
          pin: GPIO38
          name: "Backlight"
          id: backlight
          internal: true
          restore_mode: RESTORE_DEFAULT_ON
      
        - platform: gpio
          pin: GPIO15
          name: "Battery"
          id: battery
          internal: true
          restore_mode: RESTORE_DEFAULT_ON  
      
      dallas:
       - pin: GPIO43
         update_interval: 5s
        
      
      sensor:
        - platform: dallas
          address: 0xd901211238e13128
          name: "Developer Temperature"
          resolution: 12
          id: devTemp  
      
        - platform: adc
          pin: 4
          raw: True
          filters:
            - multiply: 0.00095238 # 3.9/4095, for attenuation 11db
          attenuation: 11db
          name: VBatt
          id: vcc
          update_interval: 5s
         
      font:
        - file:
            type: gfonts
            family: Roboto
            weight: 300 
          id: font1
          size: 14  
      
        - file: 'Tahoma.ttf'  
          id: font2
          size: 14
          
        - file: 'Tahoma-Bold.ttf'
          id: font3
          size: 14   
      
      
      #Web Server
      web_server:
        port: 80
      
      mqtt:
        broker: !secret mqtt_ip
        port: !secret mqtt_port
        username: !secret mqtt_user
        password: !secret mqtt_pass
      
      
      #Display Resolution 320x170
      display:
        - platform: tdisplays3
          id: disp
          update_interval: 1s
          rotation: 270
          lambda: |-
      
            auto headerBckgrd = Color(210, 0, 0);
            auto entityNames = Color(0, 255, 0);
            auto dataBckgrnd = Color(101, 101, 101);
            auto entityBckgrnd = Color(50, 50, 50);
            auto data = Color(255, 255, 255);
            auto orange = Color(255, 165, 0);
            auto black = Color(0, 0, 0);
      
            auto col1 = 60;
            auto col2 = 70;
            auto col3 = 225;
            auto col4 = 235;
            auto fontSize = 14;
            auto spacing = 2;
            auto line1 = 0;
      
            it.filled_rectangle(0, 0, 320, 170, dataBckgrnd);
            it.filled_rectangle(0, 18, 65, 170, entityBckgrnd);
            it.filled_rectangle(160, 18, 70, 170, entityBckgrnd);
            it.filled_rectangle(0, 0, 320, 19, headerBckgrd);
            it.line(160, 19, 160, 170, headerBckgrd);
      
            it.printf(160, line1, id(font3), data, TextAlign::TOP_CENTER, "Developer Temperature");
      
            it.print((col1), 21, id(font2), entityNames, TextAlign::TOP_RIGHT, "Date");
            it.printf(col2, 21, id(font2), data, TextAlign::TOP_LEFT, id(ha_time).now().strftime("%m-%d-%Y").c_str());
            it.print(col1, 37, id(font2), entityNames, TextAlign::TOP_RIGHT, "Time");
            it.printf(col2, 37, id(font2), data, TextAlign::TOP_LEFT, id(ha_time).now().strftime("%I:%M:%S %p").c_str());
      
            
            it.print(col1, 101, id(font2), entityNames, TextAlign::TOP_RIGHT, "DEV");
            it.printf(col2, 101, id(font2), data, TextAlign::TOP_LEFT, "%.1f° C", id(devTemp).state);
            it.print(col1, 117, id(font2), entityNames, TextAlign::TOP_RIGHT, "Battery");
            it.printf(col2, 117, id(font2), data, TextAlign::TOP_LEFT, "%.1f (%.2f %%)", id(vcc).state);
      
      

      I super appreciate all you time spent on this. Please let me know when you don't have any more interest/time.

      posted in Technical Discussion
      P
      patofoto
    • RE: T-Display-S3 and JST Pin 43

      @teastain2 Thank you so much for your time and answers. I know that, somehow, the T-Display-S3 and the Dallas sensor works with PIN43 as I can make it work flashing it with ESPHome. Don't know why. I want to learn how to develop with the Arduino IDE and is why I am trying to get this to work now. I know also of other projects by the YouTuber Volos Projects where he uses devices connected through the JST connectors:

      Volos Projects

      Code in GitHub for his project

      I see that he uses libraries specific to these small sensors so I am assuming that the pins get assigned there.

      Unfortunately my project needs to use the JST connector as I have it in a case for a particular use. If need be, I will go back to flashing it with ESPHome but would love to figure out how to use the JST connector as it looks like the best quick solution to connecting many sensors in a clean, universal way.

      posted in Technical Discussion
      P
      patofoto
    • T-Display-S3 and JST Pin 43

      Apologies if this has been resolved in the past. I assume it has but could not find a post to address it. No search in this forum?.

      I am new to using the T-Display-S3 and programing it via VSCode. In the past I have used it and programmed it via Home Assistant and ESPHome successfully.

      I am trying to use a DS18B20 Dallas Temperature sensor connected to pin 43 of the JST connector. I am flashing the board successfully but are getting a -127.00 message on the console.

      Screenshot 2023-05-31 at 7.46.42 AM.jpg

      Have been patching code from a few places to try to get it to work. Obviously I don't know what I am doing. This is what I got so far:

      #include <OneWire.h> 
      #include <DallasTemperature.h>
      #include <TFT_eSPI.h> // Graphics and font library for ST7735 driver chip
      #include <SPI.h>
      #include <WiFi.h>
      #include <pin_config.h>
      #include <Wire.h>
      
      // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
      OneWire oneWire(ONE_WIRE_BUS);
      
      // Pass our oneWire reference to Dallas Temperature.
      DallasTemperature sensors(&oneWire);
      
      TFT_eSPI tft = TFT_eSPI();  // Invoke library, pins defined in User_Setup.h
      TFT_eSprite sprite = TFT_eSprite(&tft);
      
      float val = 1.23; //my default value for sanity check
      float scaling = 0.0017; // to read voltage on USB as 5.00
      
      void setup(void) 
      { 
      
        Wire.begin(43, 44); //SDA, SCL
        pinMode(PIN_POWER_ON, OUTPUT); // to boot with battery...
        digitalWrite(PIN_POWER_ON, HIGH); // and/or power from 5v rail instead of USB
      
        tft.init();
        tft.setRotation(3);
        Serial.begin(9600); 
        sensors.begin(); 
       
      } 
      
      
      void loop(void) 
      { 
        val = analogRead(PIN_BAT_VOLT);  // read the input pin for battery voltage
      
        Serial.print(" Requesting temperatures..."); 
        sensors.requestTemperatures(); // Send the command to get temperature readings
        Serial.println("DONE");
        Serial.println(sensors.getTempCByIndex(0));
        
        tft.fillScreen(TFT_BLACK);
        tft.setCursor(0, 10, 1);
        tft.setTextColor(TFT_WHITE);  
        tft.setTextSize(2);
        tft.println("Developer Temp is: "); 
        
        tft.setCursor(0, 30, 2);
        tft.setTextColor(TFT_WHITE);  
        tft.setTextSize(2);
        tft.println(sensors.getTempCByIndex(0));
      
        tft.setCursor(0, 80, 2);
        tft.setTextColor(TFT_BLUE);
        tft.setTextSize(2);
        tft.println("D-76");
      
        tft.setCursor(0, 120, 2);
        tft.setTextColor(TFT_RED);
        tft.setTextSize(2);
        tft.println(val*scaling);
      
        tft.setCursor(70, 120, 2);
        tft.setTextColor(TFT_RED);
        tft.setTextSize(2);
        tft.println("vDC");
      
        delay(2000); 
      }
      

      and the pin_config.h file is this:

      #pragma once
      
      #define WIFI_SSID                    "xxxxxxxx"
      #define WIFI_PASSWORD               "xxxxxxxx"
      
      #define WIFI_CONNECT_WAIT_MAX        (30 * 1000)
      
      #define NTP_SERVER1                  "pool.ntp.org"
      #define NTP_SERVER2                  "time.nist.gov"
      #define GMT_OFFSET_SEC               (3600 * 8)
      #define DAY_LIGHT_OFFSET_SEC         0
      
      /* LCD CONFIG */
      #define EXAMPLE_LCD_PIXEL_CLOCK_HZ   (6528000) //(10 * 1000 * 1000)
      // The pixel number in horizontal and vertical
      #define EXAMPLE_LCD_H_RES            320
      #define EXAMPLE_LCD_V_RES            170
      #define LVGL_LCD_BUF_SIZE            (EXAMPLE_LCD_H_RES * EXAMPLE_LCD_V_RES)
      #define EXAMPLE_PSRAM_DATA_ALIGNMENT 64
      
      /*ESP32S3*/
      #define PIN_LCD_BL                   38
      
      #define PIN_LCD_D0                   39
      #define PIN_LCD_D1                   40
      #define PIN_LCD_D2                   41
      #define PIN_LCD_D3                   42
      #define PIN_LCD_D4                   45
      #define PIN_LCD_D5                   46
      #define PIN_LCD_D6                   47
      #define PIN_LCD_D7                   48
      
      #define PIN_POWER_ON                 15
      
      #define PIN_LCD_RES                  5
      #define PIN_LCD_CS                   6
      #define PIN_LCD_DC                   7
      #define PIN_LCD_WR                   8
      #define PIN_LCD_RD                   9
      
      #define PIN_BUTTON_1                 0 
      #define PIN_BUTTON_2                 14
      #define PIN_BAT_VOLT                 4
      
      #define PIN_IIC_SCL                  17
      #define PIN_IIC_SDA                  18
      
      #define PIN_TOUCH_INT                16
      #define PIN_TOUCH_RES                21
      
      /* External expansion */
      #define PIN_SD_CMD                   13
      #define PIN_SD_CLK                   11
      #define PIN_SD_D0                    12
      
      
      /*Personal Setup*/
      #define ONE_WIRE_BUS                 43
      

      I have tried the temp sensor code from the following link but cannot get it to work either:

      HotHead Temp Sensor

      Any help would be greatly appreciated!!!

      posted in Technical Discussion
      P
      patofoto