T-Display-S3 and JST Pin 43
-
From @teastain2 an example of DS18B20 Dallas Temperature sensor connected to pin 17 on my LilyGO T-Display S3 and tested good!
#include <OneWire.h> #include <DallasTemperature.h> const int oneWireBus = 17; //WORKS with pin17 but neither 43 or 44. OneWire oneWire(oneWireBus); DallasTemperature sensors(&oneWire); void setup() { Serial.begin(115200); sensors.begin(); } void loop() { sensors.requestTemperatures(); float temperatureC = sensors.getTempCByIndex(0); Serial.print(temperatureC); Serial.println("ºC"); Serial.println(" "); delay(2000); }
-
@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:
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.
-
@patofoto well this is good news. If ESPHome can use a onewire sensor on pin 43 then we need to look at how it assigns the pin.
As you may know, the DS18B20 is a onewire device not i2c. Onewire is somewhat outdated now replaced largely by i2c. The JST is intended for I2c which is a bus topology that will support many sensors and I/O devices at one time due to their internal addressing. SPI is popular for displays and SD cards.
The Volos example uses solely i2c sensors! This is a good example of multiple i2c sensors on an i2c bus.
If you were to use the JST for onewire sensors there would be no way to connect i2c sensors.
Arduino IDE is the way to go. It gives low level control and is the most flexible to customization.
Yes, the libraries take care of the on-chip address.
I made my own GitHub repository for the LilyGO T-Display S3:
https://github.com/teastainGit/LilyGO-T-display-S3-setup-and-examples
Take a look for more info!
-Terry -
@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:
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.
-
@patofoto No worries, I'm a retired engineer with spare time, looking for a challenge.
Well, you did get a value from the Dallas while it was under ESPHome.
I could not see anything in the YAML that configures the I2C port signal SDA to be a bi-directional serial comm link like onewire!
There must be another config file when you select LilyGO T-Display S3 .
I'm still poking around on it, intriguing.
-Terry -
@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.
-
@patofoto well indeed, I did not make progress even after finding some info on page 455 of 1500 in the Espressif S3 guide.
I can’t justify learning Esphome to search for the configuration file that sets 43 as GPIO. I have to ask you to put on your engineer hat and search around in the configuration files.
My net search was frustrated with 100% help on using any pin as I2C, but not the other way around.
So.
I am going to raise an Issue on the LilyGO T-Display S3 GitHub repository to see if they are setting it deep inside the bootloader.
I am a huge supporter of Arduino IDE and I want to get to the bottom of this!
I will renew my efforts!
-Terry -
@patofoto 4:50PM EDT Thursday June 15
I submitted this issue with LilyGO:
https://github.com/Xinyuan-LilyGO/T-Display-S3/issues/161
Please check it and confirm!
-Terry -
@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.
-
@teastain2 Just ordered a new T-Display-S3 for testing. Only have one at the moment and is in use. Will start testing soon.
-
@patofoto Not to be proud, but I have worked on this non-stop for a week!
I too want to know why, for example, pin44 does not work and the pin next to it, on the side of the board, pin 18 does!!!
Here is a somehow relevant, but confusing observation:
When uploading my test sketch on pin 43, I see the sensor led flicker as if displaying the serial data on pin43. -
@patofoto Well, it took months and months but finally some guys over on the GitHub for ESP-Arduino finally found it!
https://github.com/espressif/arduino-esp32/issues/8324#issuecomment-1725784617
The helper util file in the onewire lib had an outdated notion that there could not possibly be pins greater that 33.
I edited mine and now it works!
Wow, what a ride!
-Terry