Hi all
Im making an environmental air monitor using a lolin wemos d1 mini pro and the SCD30 to take a reading every 20 minutes and upload it to Cayenne.
Im using an emitter-follower circuit to turn the sensor on, take the readings and upload them and then I want the sensor to turn off again, by setting the transistor base pin low.
The problem is the transistor isnt turning off and the sensor is staying active. Im using a BC547 NPN transistor.
In the setup i set pin 0 high which i have the transistor on, the the loop code is below.
Do i need a large resistor between the pin output/transistor base and ground?
Thanks you
void loop() {
Cayenne.loop();
ESP.deepSleep(900 * 1000000);
}
// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
sensorCO2 = airSensor.getCO2();
sensorTemp = airSensor.getTemperature();
sensorHum = airSensor.getHumidity();
// Send CO2 data to Virtua1 1
Cayenne.virtualWrite(1, sensorCO2, "co2", "ppm");
// Send Temperature data to Virtua1 2
Cayenne.celsiusWrite(2, sensorTemp);
// Send Humidity data to Virtua1 3
Cayenne.virtualWrite(3, sensorHum);
// Turn SCD transistor off
digitalWrite(0, LOW);
}