Thanks for your replies jremington and Geek_Emeritus.
I'll add some more detail here.
Yes, I2C can have multiple nodes. I doubt there is an I2C problem. The SDA and SCL pins are as mentioned by Geek_Emeritus shown in the incorrect order on the pin out diagram.
My LilyGo T-Beam was ordered with the OLED pre-soldered (my next orders are on the way now but without OLED soldered as it was painful trying to solder I/O pins with OLED already in position). So, the order of SDA and SCL were clearly marked on the OLED board and the display works well.
Now, the SPL06-007 library was downloaded via IDE Library Manager. I decided to do a test on a spare UNO (Wifi Version from Jaycar XC-4411). It did not work at first then I came across a post stating the SPL06-007 had issues when dealing with 8 bit processors such as the UNO as the author, rv701, developed the library using an ESP32 which is 32 bit. They advised minor code changes in the SPL06-007.cpp file. I did the changes and the UNO worked.
So the UNO worked perfectly. Here is the UNO I used:
I then did a test on the LilyGo T-Beam with the same code. It appears to partially work and it provided the following results (compared against the working UNO):
Barometic Results from Serial Monitor.txt (2.3 KB)
I'll put text here (assuming this is convenient). It's the results copied from the Serial Monitor in the IDE:
Blockquote
NOTE: These results are extracted from the serial monitor in the Arduino IDE.
My comments are noted after '//'
Results from Lilygo
NOTE: The LilyGo T-Beam performed no differently both before and after modifications to the SPL06-007.cpp file
//
(no external pullup resistors)
//
ID: 16 //The ID register is being read ok so I2C must be working.
PRS_CFG: 0 //Does not appear to be reading from the SPL06-007 register for pressure
TMP_CFG: 0 //Does not appear to be reading from the SPL06-007 register for temperatu
MEAS_CFG: 11000000
CFG_REG: 0
INT_STS: 0
FIFO_STS: 0
c0: 206
c1: -256
c00: 77456
c10: -48480
c01: -2948
c11: 999
c20: -7553
c21: -15
c30: -843
traw: 0
traw_sc: 0.000
Temperature: 103.00 C
Temperature: 217.40 F
praw: 0
praw_sc: 0.000
pcomp: 77456.00
Measured Air Pressure: 774.56 mb
Local Airport Sea Level Pressure: 1011.30 mb
altitude: 2193.7 m
altitude: 7197.6 ft
//
(with resistors pulling SCA and SCL up to 3.3V)
//
ID: 16
PRS_CFG: 0 //Still not reading from pressure register
TMP_CFG: 10101010 //Temperature is being read but the value is way out being -25.18 C
MEAS_CFG: 11000000
CFG_REG: 0
INT_STS: 0
FIFO_STS: 0
c0: 206
c1: -256
c00: 77456
c10: -48480
c01: -2948
c11: 999
c20: -7553
c21: -15
c30: -843
traw: 1837580
traw_sc: 0.501
Temperature: -25.18 C
Temperature: -13.32 F
praw: 0
praw_sc: 0.000
pcomp: 75979.93 //Note the difference to value in UNO results
Measured Air Pressure: 759.80 mb
Local Airport Sea Level Pressure: 1011.30 mb
altitude: 2347.7 m
altitude: 7702.9 ft
//
Results from UNO
NOTE: The UNO worked after modifications to the SPL06-007.cpp file
//
ID: 16
PRS_CFG: 11
TMP_CFG: 10000011
MEAS_CFG: 11110111
CFG_REG: 0
INT_STS: 0
FIFO_STS: 0
c0: 206
c1: -256
c00: 77456
c10: -48480
c01: -2948
c11: 999
c20: -7553
c21: -15
c30: -843
traw: 2504306
traw_sc: 0.318
Temperature: 21.48 C
Temperature: 70.66 F
praw: -4247720
praw_sc: -0.540
pcomp: 100458.67 //Note the difference to value read in LilyGo results
Measured Air Pressure: 1004.59 mb //value not confirmed but appears about right
Local Airport Sea Level Pressure: 1011.30 mb
altitude: 56.2 m //valued not confirmed but appear about right.
altitude: 184.2 ft
So, I assumed pullup resistors may be an issue. I tried this without success. I used 2.4kOhm resistors on both the SDA and SCL inputs. In the Serial Monitor results I noted a slightly different result with and without the pullup resistors. To tell you the truth I was up late and I'm pretty sure I saw both results for LilyGo without pullup resistors. Now note the device ID works so I think the I2C is working and the the SPL06-007 is being read...but not all registers.
I have come across an article where a difference barometric pressure sensor was used with the LilyGo T-Beam and OLED. A BME280 sensor:
https://www.thethingsnetwork.org/forum/t/solved-ttgo-t-beam-with-oled-and-bme280/28267
This was a similar issue to my issue but with a different sensor.
The following is my test code (which is exactly the same as rv701's library for SPL06-007:
#include <SPL06-007.h>
#include <Wire.h>
void setup() {
Wire.begin(); // begin Wire(I2C)
Serial.begin(115200); // begin Serial
Serial.println("\nGoertek-SPL06-007 Demo\n");
SPL_init(); // Setup initial SPL chip registers
}
void loop() {
// ---- Register Values ----------------
Serial.print("ID: ");
Serial.println(get_spl_id());
Serial.print("PRS_CFG: ");
Serial.println(get_spl_prs_cfg(),BIN);
Serial.print("TMP_CFG: ");
Serial.println(get_spl_tmp_cfg(),BIN);
Serial.print("MEAS_CFG: ");
Serial.println(get_spl_meas_cfg(),BIN);
Serial.print("CFG_REG: ");
Serial.println(get_spl_cfg_reg(),BIN);
Serial.print("INT_STS: ");
Serial.println(get_spl_int_sts(),BIN);
Serial.print("FIFO_STS: ");
Serial.println(get_spl_fifo_sts(),BIN);
// ---- Coefficients ----------------
Serial.print("c0: ");
Serial.println(get_c0());
Serial.print("c1: ");
Serial.println(get_c1());
Serial.print("c00: ");
Serial.println(get_c00());
Serial.print("c10: ");
Serial.println(get_c10());
Serial.print("c01: ");
Serial.println(get_c01());
Serial.print("c11: ");
Serial.println(get_c11());
Serial.print("c20: ");
Serial.println(get_c20());
Serial.print("c21: ");
Serial.println(get_c21());
Serial.print("c30: ");
Serial.println(get_c30());
// ---- Temperature Values ----------------
Serial.print("traw: ");
Serial.println(get_traw());
Serial.print("traw_sc: ");
Serial.println(get_traw_sc(),3);
Serial.print("Temperature: ");
Serial.print(get_temp_c());
Serial.println(" C");
Serial.print("Temperature: ");
Serial.print(get_temp_f());
Serial.println(" F");
// ---- Pressure Values ----------------
Serial.print("praw: ");
Serial.println(get_praw());
Serial.print("praw_sc: ");
Serial.println(get_praw_sc(),3);
Serial.print("pcomp: ");
Serial.println(get_pcomp(),2);
Serial.print("Measured Air Pressure: ");
Serial.print(get_pressure(),2);
Serial.println(" mb");
// ---- Altitude Values ----------------
double local_pressure = 1011.3; // Look up local sea level pressure on google // Local pressure from airport website 8/22
Serial.print("Local Airport Sea Level Pressure: ");
Serial.print(local_pressure,2);
Serial.println(" mb");
Serial.print("altitude: ");
Serial.print(get_altitude(get_pressure(),local_pressure),1);
Serial.println(" m");
Serial.print("altitude: ");
Serial.print(get_altitude_f(get_pressure(),local_pressure),1); // convert from meters to feet
Serial.println(" ft");
Serial.println("\n");
delay(2000);
}
I'll upload the following files:
Barometric_Pressure_for_Lilygo.ino (2.5 KB)
SPL06-007.cpp (9.0 KB)
SPL06-007.h (1.2 KB)
By the way, I simply held the SDA and SCL wires against the soldered joints of the OLED which did the trick. This is why you cannot see any wires from these points to the SPL06-007 in the photos provided.
Can somebody help with this issue?
Regards,
Brian