From 0a592fe80debe64ee1ccfa26d087ba9a28bc4714 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Fri, 11 Mar 2022 09:35:53 -0500 Subject: [PATCH] added SGP30 sensor to Serial1 to the Pi --- stempayload/Payload_OK_SGP30.ino | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/stempayload/Payload_OK_SGP30.ino b/stempayload/Payload_OK_SGP30.ino index cc267f72..31c8da95 100644 --- a/stempayload/Payload_OK_SGP30.ino +++ b/stempayload/Payload_OK_SGP30.ino @@ -162,12 +162,12 @@ void loop() { // Serial.println(sensorValue); Temp = T1 + (sensorValue - R1) *((T2 - T1)/(R2 - R1)); - +/* Serial1.print(" XS "); Serial1.print(Temp); Serial1.print(" "); Serial1.println(Sensor2); - +*/ float rotation = sqrt(mpu6050.getGyroX()*mpu6050.getGyroX() + mpu6050.getGyroY()*mpu6050.getGyroY() + mpu6050.getGyroZ()*mpu6050.getGyroZ()); float acceleration = sqrt(mpu6050.getAccX()*mpu6050.getAccX() + mpu6050.getAccY()*mpu6050.getAccY() + mpu6050.getAccZ()*mpu6050.getAccZ()); // Serial.print(rotation); @@ -188,6 +188,30 @@ void loop() { led_set(blueLED, HIGH); else led_set(blueLED, LOW); + + //SGP SENSOR DATA + if (! sgp.IAQmeasure()) { + Serial.println("SGP 30 Measurement failed"); +// return; + } + Serial1.print(" SGP30 "); + Serial1.print(sgp.TVOC); + Serial1.print(" "); + //Serial.print("eCO2 "); + Serial1.print(sgp.eCO2); + Serial1.print(" "); + + if (! sgp.IAQmeasureRaw()) { + Serial1.println("SGP 30 Raw Measurement failed"); +// return; + } + + //Serial.print("Raw H2 "); + Serial1.print(sgp.rawH2); + Serial1.print(" "); + //Serial.print("Raw Ethanol "); + Serial1.print(sgp.rawEthanol); + Serial1.println("-"); } }