Perl program to read PPM from telaire CO2 monitor.

Discussion in 'Grow Room Design/Setup' started by Gunthar, Jun 16, 2011.

  1. I have been playing around with a re-branded telaire 8001 co2 monitor and have managed to figure out enough of the communications to read the PPM from the serial port.

    I think I paid $35 for this thing on ebay a few years back..

    If you need a serial cable to interface it with your computer check out this link.. Making a serial cable for a Telaire CO2 sensor .: Cannaversity

    Here are a bunch of runs of the program reading the values from the monitor. Tword the end you can see where I exhaled into the sensor.

    Code:
    delphi tmp # ./ppm.pl
    406
    delphi tmp # ./ppm.pl
    409
    delphi tmp # ./ppm.pl
    408
    delphi tmp # ./ppm.pl
    416
    delphi tmp # ./ppm.pl
    476
    delphi tmp # ./ppm.pl
    685
    delphi tmp # ./ppm.pl
    685
    delphi tmp # ./ppm.pl
    1137
    delphi tmp # ./ppm.pl
    1773
    delphi tmp # ./ppm.pl
    2120
    
    
    Here's the program. It's incredibly crude, but it works.
    I'm running this under linux, through a Prolific brand USB to Serial adapter. If you are using a native com port, or on windows you will have to edit the definition of $PORT to match your serial port. Note this program requires the Device::Serial module to function..


    Code:
    #!/usr/bin/perl -w
    #
    #
    
    use Device::SerialPort ;
    
    $PORT      = "/dev/ttyUSB1";          # port to watch
    $REQUEST   = pack'H*','FFFFFE0202037605';
    
    #
    # Serial Settings
    #
    
    $ob = Device::SerialPort->new ($PORT) || die "Can't Open $PORT: $!";
    $ob->baudrate(9600)   || die "failed setting baudrate";
    $ob->parity("none")    || die "failed setting parity";
    $ob->databits(8)       || die "failed setting databits";
    $ob->handshake("none") || die "failed setting handshake";
    $ob->stopbits(1)       || die "failed setting stopbits";
    $ob->handshake("none") || die "failed setting handshake";
    
    $ob->write_settings    || die "no settings";
    
    $ob->write($REQUEST);
    
    sleep 2;
    
    $result= unpack('H*', $ob->input);
    $hexr = substr( $result, 10, 2) . substr( $result, 8, 2);
    
    print hex $hexr , "\n";
    
    
    $ob->close;
    
    undef $ob;
    
    
     
  2. This is fucking awesome.


    I just got a Hanna gro pH monitor, I'm thinking about seeing if I can figure out a crude driver for it.


    It would be really cool to extract the data and chart/analyze it.


    Congratulations on figuring that out! It must have been a fun time fsho.
     
  3. Thanks. It took most of a evening dorking with a serial port analyzer. At least nothing was encrypted.
     
  4. I liked it so much I blogged it, great post man.
     

Share This Page