Skip to content

Commit

Permalink
Adds support for SPL06_007 Temperature & Pressure I2C (+10k2 code) (#…
Browse files Browse the repository at this point in the history
…21185)

* Adds support for SPL06_007 (+10k2 code)

* removes not so used methods.

Removes -2kb

* change doubles to floats

* fixes a name

* change sns idx to 25
  • Loading branch information
rai68 authored Apr 18, 2024
1 parent f01e74f commit 13cbf26
Show file tree
Hide file tree
Showing 13 changed files with 742 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CODE_OWNERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ In addition to @arendst the following code is mainly owned by:
| xsns_22_sr04 | Nuno Ferreira, @arendst
| xsns_23_me007 | Mathias Buder
| xsns_24_si1145 |
| xsns_25 |
| xsns_25_spl06-007_sensor | @rai68
| xsns_26_lm75ad | Andre Thomas
| xsns_27_apds9960 | Shawn Hymel
| xsns_28 |
Expand Down
2 changes: 1 addition & 1 deletion I2CDEVICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ Index | Define | Driver | Device | Address(es) | Bus2 | Descrip
85 | USE_ENS210 | xsns_112 | ENS210 | 0x43 - 0x44 | | Temperature and humidity sensor
86 | USE_AMSX915 | xsns_114 | AMS5915 | 0x28 | | Pressure (absolute/differential) and temperature sensor
86 | USE_AMSX915 | xsns_114 | AMS6915 | 0x28 | | Pressure (absolute/differential) and temperature sensor

95 | USE_SPL06_007 | xsns_126 | SPL06-007 | 0x76 | | Pressure and temperature sensor
NOTE: Bus2 supported on ESP32 only.
7 changes: 7 additions & 0 deletions lib/lib_i2c/SPL06_007/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPL06-007
Ardino SPL06-007 Library

This is a work in progress to create a working Arduino library for the SPL06-007 pressure sensor. I am able to get the coefficents, pressure, and temperature readings from the sensor. Need to convert to a standard Arduino library format. Code was developed and tested on an ESP32 microcontroller.

Link to datasheet
https://datasheet.lcsc.com/szlcsc/1912111437_Goertek-SPL06-007_C233787.pdf
Binary file not shown.
119 changes: 119 additions & 0 deletions lib/lib_i2c/SPL06_007/examples/Pressure_Info/Pressure_Info.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
#include <SPL06-007.h>
#include <Wire.h>

//#define Serial SerialUSB

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 - default i2c address 0x76
// SPL_init(0x77); // Uncomment for alternate I2C address 0x77
}

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);
}
57 changes: 57 additions & 0 deletions lib/lib_i2c/SPL06_007/keywords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#######################################
# Syntax Coloring Map For SHT21
#######################################

#######################################
# Datatypes (KEYWORD1)
#######################################

SPL06-007 KEYWORD1

#######################################
# Methods and Functions (KEYWORD2)
#######################################

SPL_init KEYWORD2
get_spl_id KEYWORD2
get_spl_prs_cfg KEYWORD2
get_spl_tmp_cfg KEYWORD2
get_spl_meas_cfg KEYWORD2
get_spl_cfg_reg KEYWORD2
get_spl_int_sts KEYWORD2
get_spl_fifo_sts KEYWORD2

get_traw KEYWORD2
get_traw_sc KEYWORD2
get_temp_c KEYWORD2
get_temperature_scale_factor KEYWORD2


get_pressure_scale_factor KEYWORD2
get_pcomp KEYWORD2
get_praw_sc KEYWORD2
get_praw KEYWORD2
get_pressure KEYWORD2

get_c0 KEYWORD2
get_c1 KEYWORD2
get_c00 KEYWORD2
get_c10 KEYWORD2
get_c01 KEYWORD2
get_c11 KEYWORD2
get_c20 KEYWORD2
get_c21 KEYWORD2
get_c30 KEYWORD2
i2c_eeprom_write_uint8_t KEYWORD2
i2c_eeprom_read_uint8_t KEYWORD2

#######################################
# Instances (KEYWORD2)
#######################################




#######################################
# Constants (LITERAL1)
#######################################
11 changes: 11 additions & 0 deletions lib/lib_i2c/SPL06_007/library.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name=SPL06-007
version=0.1.0
author=rv701
maintainer=rv701
sentence=SPL06-007 library for Arduino processors
paragraph=Supports SPL06-007 I2C pressure sensor.
category=Sensors
url=https://github.com/rv701/SPL06-007
architectures=*
includes=SPL06-007.h

Loading

0 comments on commit 13cbf26

Please sign in to comment.