One custom board is needed for the project on which the I2C multiplexer, the connectors for the LiPo battery, the gas sensors, the IC2 bus, and the on/off switch are located. The PCB will be mounted in the AR glasses housing.
PCB and stencil for the top layer:
Populated PCB:
To check the function, I wrote a small test program for the Arduino Nano 33 BLE:
#include <Adafruit_SGP30.h>
#include <Wire.h>
Adafruit_SGP30 sgp1; // Define two classes
Adafruit_SGP30 sgp2;
// Function to select I2C BUS
void TCA9548A(uint8_t bus){
Wire.beginTransmission(0x70); // TCA9548A address
Wire.write(1 << bus); // Send byte to select bus number
Wire.endTransmission();
}
// Function to print the sensor values
void printValues(Adafruit_SGP30 sgp, int bus) {
TCA9548A (bus);
Serial.print("Sensor number on bus");
Serial.println(bus);
sgp.IAQmeasure();
Serial.print("TVOC "); Serial.print(sgp.TVOC); Serial.print(" ppb\t");
Serial.print("eCO2 "); Serial.print(sgp.eCO2); Serial.println(" ppm");
Serial.println();
}
void setup() {
Serial.begin(115200);
// Start I2C communication with the Multiplexer
Wire.begin();
// Init sensor on bus number 0
TCA9548A(0);
sgp1.begin();
// Init sensor on bus number 7
TCA9548A(7);
sgp2.begin();
}
void loop() {
// Print values for sensor 1
Serial.println("Sensor 1:");
printValues(sgp1, 0);
delay(1000);
// Print values for sensor 2
Serial.println("Sensor 2:");
printValues(sgp2, 7);
delay(1000);
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.