Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / Re: Mushroom farm - monitoring system on: April 29, 2013, 10:22:12 am
My name is Jason and I work in product development at CO2meter.com. I try to keep up with forums for arduino and other similar products to provide guidance to projects that involve air quality control. We have clients that run large scale mushroom growing operations, and along with Temperature and humidity, it is also important to monitor CO2 levels. This article explains a little about why: http://www.co2meter.com/collections/mushrooms-co2.

It lists a few products that we often provide for our clients, but to incorporate into an automated system I would look into the Cozir RH/T http://www.co2meter.com/collections/co2-sensors/products/cozir-0-2-co2-sensor. This provides real time CO2 level, Temperature, and humidity over UART. I have written some basic libraries to work with MCUs and getting it running on an arduino is very straightfoward.

If you have any questions or would like the code for running these please let me know.

-Jason Berger
JasonB@co2meter.com
CO2meter.com
2  Using Arduino / Project Guidance / Re: Is this Arduino controlled machine possible on: April 29, 2013, 09:58:26 am
I work in product development at CO2meter.com, So I can certainly help you with the sensor part. Co2 meters come in several different ranges. Depending on what range you think you will need, I would recommend our Cozir Rh/T http://www.co2meter.com/collections/co2-sensors/products/cozir-0-2-co2-sensor. It comes in 3 ranges up to 10,000 ppm (For a point of reference, ambient atmosphere is around 400-450ppm), and incorporates humidity and temperature.

This particular unit works over UART and has a very simple interface. I have written a small library for it to work with ARM processors, but I can definitely help you get it running on an arduino. Assuming you still want to use the arduinos ftdi to report back to a host computer, this will take 2 pins to run a software serial connection.

for the stepper motor control you can use 4 control boards like this : http://www.pololu.com/catalog/product/2128 . Each board requires 2 pins from the arduino, but if you are sure you will only need to run one motor at a time, you should be able to use one pin for the DIR signal on all 4 boards. So this would only take 5 pins.

each of the servos, and simple on/off devices will require 1 pin from the arduino, so this is certainly possible with a basic arduino. However it is a good idea to leave some room for re-design and expansion, so I would use a shift register for the simple on/off devices. If you are new to shift registers, it is basically just a way of expanding your i/o pins cheaply. I did a quick tutorial on my personal site a while back: http://girshwin.com/led_shift.php .

If I were doing this project I would probably get a proto-board big enough for all of the sub-assemblies and attach an arduino micro/mini to it. Then I would breadboard each part with the arduino that you already have and make sure its working before attaching it to the protoboard. It can be pretty easy to overheat/damage a stepper controller sometimes, so I would definitely use headers to attach them so you can change them out if needed.

*Note: when working with the stepper motor boards, if you need to adjust wiring make sure to turn off the power first. Disconnecting and reconnecting motor leads while connected to power can damage the stepper board.


-Jason Berger
JasonB@co2meter.com
CO2meter.com
3  Using Arduino / Sensors / Re: Interfacing with TWO k30 CO2 sensors on: April 02, 2013, 12:20:50 pm
Once you have set up one of the sensors to have an alternate address, they can share the same Tx and Rx lines. For instance say you have 2 sensors, Sensor_A is at address 0x68, and Sensor_B is at 0x34. you would connect both sensors to the same 2 pins on the arduino (12 and 13 in the example) and when you send a read request with the address 0x68, only Sensor_A will reply, and when you send a request to 0x34 only Sensor_B will reply.

So you only need to initialize one SoftwareSerial.

If you wanted to run it on two separate Softwareserial ports, you could initialize two and use a total of 4 pins. However when using multiple SoftwareSerials you must switch between them manually using the .listen() function. this page explains how to do this: http://arduino.cc/en/Reference/SoftwareSerialListen

Hope this helps.
4  Using Arduino / Sensors / Re: Interfacing with TWO k30 CO2 sensors on: March 21, 2013, 03:53:40 pm
Also a side note:

There is software available on our website called Gaslab that allows you to change the Address of the sensors http://www.co2meter.com/pages/downloads

It requires you to connect to the sensor via an FTDI cable, however if you don't have one of these you can connect the arduinos RESET pin to GND and use its onboard FTDI chip by connecting the sensor to pins 0 and 1. Just remember that the "Tx" and "Rx" markings on the arduino refer to the atmega pins, so when referring to the host computer they are switched. So the connections are:

Arduino    K-30
5v5v
GNDGND
0Tx
1Rx

I hope this helps anyone who is looking to do a similar project. please feel free to email me at JasonB@co2meter.com

Thanks,
-Jason B
5  Using Arduino / Sensors / Re: Interfacing with TWO k30 CO2 sensors on: March 21, 2013, 03:43:31 pm
James,
I just sent you an email regarding this, but I figured I would post here in case anyone else runs into this problem. The library was written which a single sensor in mind. it opens up a software serial port so to use multiple instances of it would require you to switch between them. However these sensors use a modbus protocol so they can be addressed, so you can talk to several of them on a single Serialport . The default address is 104 (0x68), so change one of the sensors adresses and then you can read from them independently. The following code has a function that will change the address of the attached sensor to 0x34. connect ONLY ONE sensor to the arduino and uncomment the line "//changeAddress();", then run the program. then comment out or delete that line and upload it again. now you can attach both sensors to the same Tx/Rx (12,13) and it will read from both of them.

Code:
/*
  Basic Arduino example for K-Series sensor
  Created by Jason Berger
 
  *edited to use 2 sensors on the same line*
  Co2meter.com 
*/


#include "SoftwareSerial.h"


byte addressA = 0x68;
byte addressB = 0x34; //change to address


SoftwareSerial K_30_Serial(12,13);  //Sets up a virtual serial port
                                    //Using pin 12 for Rx and pin 13 for Tx


byte readCO2_a[] = {addressA, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25};  //Command packet to read Co2 (see app note)
byte readCO2_b[] = {addressB, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25};
byte response[] = {0,0,0,0,0,0,0};  //create an array to store the response

unsigned long valCO2_A;
unsigned long valCO2_B;

//multiplier for value. default is 1. set to 3 for K-30 3% and 10 for K-33 ICB
int valMultiplier = 1;

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);         //Opens the main serial port to communicate with the computer
  K_30_Serial.begin(9600);    //Opens the virtual serial port with a baud of 9600
 
 
 
  //Uncomment the following line to and run to change address of connected sensor to 0x34;
  //This should only be done with one sensor attached
  //changeAddress();
}

void loop()
{
  sendRequest(readCO2_a); //send request to A and store response
  valCO2_A = getValue(response); //parse response and store as valCO2_A
 
  sendRequest(readCO2_b); //send request to B and store response
  valCO2_B = getValue(response); //parse response and store as valCO2_A
 
  Serial.print("Co2[A] ppm = ");
  Serial.println(valCO2_A);
   Serial.print("Co2[B] ppm = ");
  Serial.println(valCO2_B);
  delay(2000);
 
}

void sendRequest(byte packet[])
{
  while(!K_30_Serial.available())  //keep sending request until we start to get a response
  {
    K_30_Serial.write(readCO2,7);
    delay(50);
  }
 
  int timeout=0;  //set a timeoute counter
  while(K_30_Serial.available() < 7 ) //Wait to get a 7 byte response
  {
    timeout++; 
    if(timeout > 10)    //if it takes to long there was probably an error
      {
        while(K_30_Serial.available())  //flush whatever we have
          K_30_Serial.read();
         
          break;                        //exit and try again
      }
      delay(50);
  }
 
  for (int i=0; i < 7; i++)
  {
    response[i] = K_30_Serial.read();
  } 
}

unsigned long getValue(byte packet[])
{
    int high = packet[3];                        //high byte for value is 4th byte in packet in the packet
    int low = packet[4];                         //low byte for value is 5th byte in the packet

 
    unsigned long val = high*256 + low;                //Combine high byte and low byte with this formula to get value
    return val* valMultiplier;
}

void changeAddress()
{

//The adress is stored in the eeprom at address 0x00 and RAM address 0x20
//if it is changed in eeprom it will automatically be loaded into ram after a power cycle
//but we will write it manually so we dont have to powercycle
//
//if desired adress is changed then the CRC (last 2 bytes) must be recalculated also
//
byte changeEEPROM[] = {0xFE,0x43,0x00,0x00,0x1,0x34,0x50,0x4d};
byte changeRAM[] =  {0xFE,0x41,0x00,0x20,0x1,0x34,0x28,0x47};

K_30_Serial.write(changeEEPROM,8); //Send each one 3 times just to ensure it goes through
delay(100);
K_30_Serial.write(changeEEPROM,8);
delay(100);
K_30_Serial.write(changeEEPROM,8);
delay(100);
K_30_Serial.write(changeRAM,8);
delay(100);
K_30_Serial.write(changeRAM,8);
delay(100);
K_30_Serial.write(changeRAM,8);
delay(100)
}




-Jason B
Co2meter.com
Pages: [1]