Controlling solenoid and motor with a CO2 sensor

This is a repost from another forum but I believe this forum may be better for what I want to know.

Hi all,

I am developing a CO2 sensor and regulator for an incubator. I am linking a schematic of my design and hoping if I can get some feedback if there are any potential dangers.

Basically, the LED represents the sensor which can only handle between 6v to 12v. The two motors represents my regulator (solenoid) and a pump which share the same voltage source.

I want to know if this design is safe enough for my sensor where the voltage source for my two motors won't damage my sensor.

One last thing, when the arduino starts up it seems to put power into all of its pins which will send a start signal to all 3 transistors. Will this cause any damage? Right now only one motor is on at any time. Would sending a signal to close all three transistors at the same time cause damage?

Thanks,
Danh

You must use current limiting resistors on the bases of each transistor or you'll burn something
out.

The Arduino pins all go high impedance on reset, you should post your code so we can see what the start-up issue it.

Your motor supply is not two 9V batteries in series???

Thanks for the reply! Yes I will add resistors since I just made this schematic pretty quickly. The motor supply is a 12v but I wanted to see if the schematic software would give me any errors if I 18v.

#include <LiquidCrystal.h>
#include "kSeries.h"

//include kSeries Library
kSeries K_30(12,13); //Initialize a kSeries Sensor with pin 12 as Rx and 13 as Tx
LiquidCrystal lcd( 8, 9, 4, 5, 6, 7 );
 
const int sensorPin = 11;    // connected to the base of the transistor
const int solenoidPin = 10;    // connected to the base of the transistor
const int motorPin = 3;    // connected to the base of the transistor

void setup()
{
  Serial.begin(9600); //start a serial port to communicate with the computer
  pinMode(sensorPin, OUTPUT);
  pinMode(solenoidPin, OUTPUT);
  pinMode(motorPin, OUTPUT);
  lcd.begin(16, 2);
  lcd.print("Starting");
  sensor(sensorPin); //turn sensor on
}
 
void loop()
{
  double co2 = K_30.getCO2('%'); //returns co2 value in ppm ('p') or percent ('%')
  double temp = K_30.getTemp('c'); //return temp value
  double rh = K_30.getRH(); //return humidity value
  printData(co2, temp, rh);
  if (co2 < 5)
  {
    solenoid(solenoidPin); //starts CO2 injection
    motor(motorPin); //input flow from incubator
  }
}

void sensor(int pin)
{
  digitalWrite(pin, HIGH);
}

void solenoid(int pin)
{
  digitalWrite(pin, HIGH); //turn on solenoid
  delay(30000);
  digitalWrite(pin, LOW); //turn off
}

void motor(int pin)
{
  digitalWrite(pin, HIGH); //turn on pump
  delay(10000);
  digitalWrite(pin, LOW); /turn off pump
  delay(20000);
}

void printData(double co2, double temp, double rh)
{
  lcd.setCursor(0,0);
  printCO2(co2);
  lcd.setCursor(0,1);
  printT(temp);
  lcd.setCursor(8,1);
  printRH(rh);
}

void printCO2(double co2)
{
  lcd.print("Co2=");
  lcd.println(co2); //print value
  lcd.setCursor(8,0);
  lcd.println("%         ");
}

void printT(double temp)
{
  lcd.print("T=");
  lcd.println(temp); //print value
  lcd.setCursor(6,1);
  lcd.println("C ");
}

void printRH(double rh)
{
  lcd.print("RH=");
  lcd.println(rh);
  lcd.setCursor(15,1);
  lcd.println("% ");
}

Schematic software won't notice a bad circuit, just unconnected wires!

I note the control loop immediate operates the solenoid and then motor if the CO2
concentration is less than 5% from startup - could that be the startup issue, or is it
something else?

Are your transistors good enough for the motor loads they drive? Are the gate current
reuiqrements at saturation OK for an Arduino pin?

I am using TIP120 which I followed from this website.

http://www.instructables.com/file/FUXZ1LRI4CMQFA3

My solenoid is 12dvc and requires 300ma. My motor is also 12dvc and requires 1A.

At start up, I didn't test it with my motor. But, I had leds in place with resistors. What I noticed was that all the LEDs lit up for like .5s or something and then the normal program ran.

Also, for the normal operation, the solenoid operates for 30s and then followed by the motor. So the LED that corresponded to the solenoid turned off for 30s while the other one turned on.

Can I ask, which CO2 sensor will you use?
I'm having trouble finding one that is sensitive enough...

I specifically bought the K33 BLG 30%.

CO2 Range: 0 – 30% CO2
CO2 Accuracy: ± 0.2% vol CO2 ± 3% of measured value

Thanks!

i tried the MG811, but it does not seem to be accurate enough to do climate control...
I'll order one at CO@meter.com...
See what they are like...

danhdtruong:
I am using TIP120 which I followed from this website.

http://www.instructables.com/file/FUXZ1LRI4CMQFA3

My solenoid is 12dvc and requires 300ma. My motor is also 12dvc and requires 1A.

At start up, I didn't test it with my motor. But, I had leds in place with resistors. What I noticed was that all the LEDs lit up for like .5s or something and then the normal program ran.

Also, for the normal operation, the solenoid operates for 30s and then followed by the motor. So the LED that corresponded to the solenoid turned off for 30s while the other one turned on.

Ah, your circuit didn't show darlingtons. Darlingtons have significant leakage with open base
terminals which might account for LEDs lighting before the bases are driven low. Motors shouldn't be sensitive to such small currents though.

Okay. The LEDs were barely lit for a second so your answer makes sense.