Show Posts
Pages: [1] 2 3 ... 5
1  Using Arduino / Project Guidance / Re: Feasibility? Monitor wirelessly CO2 (up to 100%), RH, Temp inside fumigation on: July 12, 2014, 08:52:08 am
I made a similar project where i graphed the environmental variables from a greenhouse using arduino and bluetooth, see post
http://forum.arduino.cc/index.php?PHPSESSID=8lqtm01hphvhaq8ahss77g6f93&topic=91467.0

the arduino sends the data to my computer via bluetooth and a WPF application graphs out the live values, i also used a 1mb eprom chip to store historic values, and when i loaded my application up on the pc it would get all the values stored, clear the eprom and the application would put all the data into an SQL database, the application would graph all data out in the database.

The COZIR range of sensors can do 100% CO2 and have built in Temp/RH sensors so you get 3 for 1.

here is a screen of my application
https://onedrive.live.com/redir?resid=715E635C40B989B8!21735&authkey=!AEFS7Vzl7qxsjYo&v=3&ithint=photo%2c.jpg

if i were to do it again i may use a bigger eprom chip, i did manage to get my windows phone getting data from the device and by using telerik graphing controls was able to graph out and view live data which was pretty cool.

Good luck with your project, its more than feasible, using arduino and some programming skills it would be easy to do.

DirtGambit
2  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: July 07, 2014, 01:06:23 pm
Thanks 34R7 but its Rob Tillaart you need to thank too.

Im glad your having success with the sensor, I tried using the sketch that GSS provided and I couldnt get it to work at all, the library still needs work and Im sure very soon it will happen.

Good luck with your projects.
3  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: July 05, 2014, 04:48:49 pm
Hello and sorry I havent replied to any posts, i havent touched an arduino for a long time, so tonight i took my COZIR sensor and arduino and had a play around, i indeed got some of the problems that many of the users have been having, i was able to reproduce the errors and quickly found out that the sensor need calibrated, i will include the library to this post that i used tonight and also put some functions in and comment them out so in Setup() you can do calibration or change digital filter.

Here is the code i used for my main sketch

Code:
#include <SoftwareSerial.h>
#include "cozir.h"

SoftwareSerial nss(2,3);
COZIR czr(nss);

void setup()
{
  Serial.begin(9600);
  delay(5000);
  //czr.SetOperatingMode(CZR_POLLING);
  //czr.SetOperatingMode(CZR_STREAMING);
  //czr.CalibrateFreshAir();
 // czr.SetDigiFilter(64);
}

void loop()
{
  delay(4000);
  float t = czr.Celsius();
  float f = czr.Fahrenheit();
  float h = czr.Humidity();
  int c = czr.CO2();
  int digi = czr.GetDigiFilter();

  Serial.print("Celcius : ");Serial.println(t);
  Serial.print("Fahrenheit : ");Serial.println(f);
  Serial.print("Humidity : ");Serial.println(h);
  Serial.print("CO2 : ");Serial.println(c);
  Serial.print("Digital Filter : ");Serial.println(digi);
  Serial.println("");
}

Some of the problems people have been having is due to not calibrating the sensor at first use

Here is a step by step
uncomment czr.SetOperatingMode(CZR_POLLING);
Upload Sketch
comment czr.SetOperatingMode(CZR_POLLING);
and uncomment czr.CalibrateFreshAir();
Upload Sketch
comment czr.CalibrateFreshAir();
Upload sketch
and if you want to change digital filter do the same, as the settings are kept on the sensor you never need to do these again unless you want to. I have found if i uncomment them all the sensor plays up and gives bad values until i comment out and upload the sketch again, i dont know why this is, it would have been such a better sensor if it were polling by default.

I have attached the lib i used tonight to this post

Regards
DirtGambit





4  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: January 17, 2013, 05:04:27 am
Just calibrate via fresh air which gives a value of about 380, maybe your in an area of high co2, I have a main road next to my house with a lot of traffic and average values were 420-450, are your values wildly out of range?
5  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: April 03, 2012, 03:22:51 am
I dont know rob, I havent opened the sensor to find out, also i dont know if they have altered the firmware of sensor to stop outputting null values if the sensor has no ldr fitted, the sensors output is always rh,Temp,unfiltered co2, filtered co2.

badwheels thats quite a demand from any all in one sensor, the cozir does most of what you need, if you were to have all those separate you would have quite a breadboard and be in wire/lib hell, your project sounds cool though good luck.

6  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: April 02, 2012, 03:40:51 am
I asked for ldr functionality in my sensor and was told it wasn't being supported anymore, the datasheets haven't been updated to reflect this. The ldr was an optional extra, so at order time you are just told the ldr isn't available. I liked the idea of an ldr, but i think these sensors are being targeted to the commercial sector (handheld devices) where an ldr might not be as useful as opposed to the arduino/electronics community where having one sensor do many things is desirable depending on what you are making. ldrs are 10 a penny so just hook one up along side the cozir, thats what i did.

The enclosure is from proto-pic.co.uk, it was lying around so i put it together and the antenna is connected to a bluesmurf module, it has a decent range with the antenna.

7  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: March 27, 2012, 12:43:09 pm
Oh yeah for sure as long as it wasnt really time critical, it stays between 390 - 420ppm (+-10ppm) all day, within 5 minutes of someone coming into the livingroom it will quite happily go up to 550ppm especially if you go near the sensor, I had some friends round one night, 4 people in a smallish living room, I was shocked to see 1500ppm on the graph.

A few years ago there was a study into co2 concentration in old schools, the average co2 during school time was > 2000ppm in some of them, in this case peaks were found at 3500ppm (I read a study once that had peaks of 4500ppm), a few schools had really good results but they were still > 1200ppm and had very good ventilation.

DirtGambit
8  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: March 27, 2012, 02:53:42 am
Hi Gaines, I havent tested the cozir against any other Co2 sensor but it seems accurate enough, I usually calibrate via fresh air and that gives me a ball park figure for what Im using the sensor for, it certainly responds very well if the house has been empty all day and someone comes in it will pick up that very quickly. $183 is not a bad price, and its all in one, so no need for many libs, wires etc.

The only drawback from an arduino point of view is the sensor communicates through serial which makes the process a bit more difficult getting the data you want, it would have been nice to have a digital version, 3 pins and just asks the sensor for the values but this limits its application I suppose because GSS also supply a usb cable that fits directly to the sensor and can run via their software without the need for any dev board.

I do think its something GSS should consider, getting rid of the serial and going digital might lower the cost. Getting rid of streaming mode is another thing Id like to see, its a pain in the @$$. smiley

Regards
9  Using Arduino / Sensors / Re: Temp, Humidity CO2 sensor and library. on: February 18, 2012, 06:25:57 am
Hi Spandy, The images are screen grab/crop of a much larger application I developed to graph environmental variables, The library I use is zedgraph, they do an asp .net version for graphing on the web but I dont have any experience in using that, going by the tutorial it seems syntactically similar to what I have used developing this in c#. Mostly its just configuring how your graphs look, also for the timestamp I store this in unixtime then convert when Im filling up the arrays of data, sorry I cant be of much help, I havent developed anything for the web that uses graphing.

check out http://www.codeproject.com/Articles/5431/A-flexible-charting-library-for-NET

the examples dont look that great but zedgraph is so configurable it doesnt take long to change the look of your graphs.

10  Using Arduino / Sensors / Temp, Humidity CO2 sensor and library. on: February 11, 2012, 01:40:44 pm
Hi, I thought I’d make a post about a sensor I recently purchased and its compatibility with arduino.
I was on the lookout for a sensor that would do temperature, humidity and co2. As I was looking for an all in one solution I settled on the cozir range of sensors http://www.cozir.com. After looking at the datasheet I thought it would interface easily with the arduino. I purchased mine directly from Gas Sensing Solutions. It works on the Arduino 3.3v, GND, and 2 digital pins for software serial TX,RX it took about 2 minutes to attach it and get it working.





As soon as I hooked it up I started the SoftwareSerial example and after a minor modification the sensor was outputting the environment variables in streaming mode, this is the default mode, in this mode it sends out a stream of data at about two per second, as I was wanting to get the data at a time that suits my sketch I put the sensor in polling mode, this allowed me more control over what was happening, once set in polling mode it stays on this mode until you change it which was handy as I could set the sensor up in a separate sketch then I don’t have to worry about including extra code in my project sketch.

I spoke with Rob Tillaart on the forum about it and he suggested a library be made, I had already hacked up my own library but it was a first version to get all the functionality of the sensor like changing digital filter and calibration into my project, Rob provided a blueprint library to start off with plus code which we worked on and tested for the last few weeks.

I have attached the library as a zip file in this post, It is 1.0 compatible. Thanks go out to Rob.

A few things to note, the sensor takes about 2 seconds to warm up, before that expect -100 for temp, putting a 2-3 second delay in setup stops this happening. Streaming mode hasn't been implemented in this version of the library, you can easily choose streaming mode from within the library but if you do you'll have to parse the data yourself, this will be getting worked on over the next few weeks. The digital filtered c02 value by default is set to 32, I found my graphs were moving quite a bit and after testing I have settled on 128, it gives a nice smooth output. Calibration with fresh air, nitrogen and known concentration are also implemented in this version of the lib and when you first power up the sensor you will have to calibrate it.





Please read the datasheet and software user guide before using this library.

Datasheet : http://www.co2meters.com/Documentation/Datasheets/COZIR-Data-Sheet-RevC.pdf
Software User Guide : http://www.co2meters.com/Documentation/Manuals/COZIR-Software-User-Guide-AL12-RevA.pdf

Here is a basic sketch to get it all outputting on the serial.



Code:
#include <SoftwareSerial.h>
#include "cozir.h"

SoftwareSerial nss(3,2);
COZIR czr(nss);

void setup()
{
  Serial.begin(9600);
  delay(3000);
  //czr.SetOperatingMode(CZR_POLLING);
  //czr.SetOperatingMode(CZR_STREAMING);
}

void loop()
{
  float t = czr.Celsius();
  float f = czr.Fahrenheit();
  float h = czr.Humidity();
  int c = czr.CO2();
  int digi = czr.GetDigiFilter();
  
  Serial.print("Celcius : ");Serial.println(t);
  Serial.print("Fahrenheit : ");Serial.println(f);
  Serial.print("Humidity : ");Serial.println(h);
  Serial.print("CO2 : ");Serial.println(c);
  Serial.print("Digital Filter : ");Serial.println(digi);    
}

Enjoy!!!!
11  Using Arduino / Interfacing w/ Software on the Computer / Re: c# receive problem. on: January 25, 2012, 08:05:01 am
Thats solution worked, although I ended up just sending a struct at a time between * *, that cut down the parsing code in c# and now only have one if statement if parse function, the sendhistoricdata function is down to a few lines of code, it looked very nice streaming in because I was updating the graphs every packet, now ill redirect them into the database then refresh.
12  Using Arduino / Interfacing w/ Software on the Computer / Re: c# receive problem. on: January 25, 2012, 07:04:37 am
Ok that sounds right, I thought there was something wrong in the way I was implementing it plus not thinking about how much ram the system actually had.

Thanks
13  Using Arduino / Interfacing w/ Software on the Computer / Re: c# receive problem. on: January 25, 2012, 06:06:55 am
That exactly right, it does start sending but fails through the process. Why had it been ok when I was just allocating 2016 addresses of eprom and sending the whole lot through the serial?  since yesterday I have only stored 288 records so im sending 288 temp values *26,26,27 etc ,* then 288 rh values etc. is it because Im creating my arrays to put the values into? then iterating through the arrays to send the data from RAM.
14  Using Arduino / Interfacing w/ Software on the Computer / Re: c# receive problem. on: January 25, 2012, 05:44:10 am
Sorry I forgot to mention Im using a 512kb eprom. I was testing yesterday and all day the historic data was being sent when I asked for it, when left over night and I ask for data in the morning it sends but doesnt get as far as parsing, then the arduino stops functioning and I have to pull plug out and reset.
15  Using Arduino / Interfacing w/ Software on the Computer / c# receive problem. on: January 25, 2012, 05:05:36 am
Hi, I have been trying to figure out my problem with sending serial data from arduino to c#.
My arduino sends out readings for Temp, RH, CO2, Light, HighTemp, LowTemp, HighRH, LowRH, HiCo2, LowCo2 every 10seconds, every 5 minutes it takes the average of these values and stores them in eprom.
I pass the values to
Code:
void addPacketData(uint32_t S, uint16_t T, uint16_t H, uint16_t C, uint32_t L, uint16_t fil)
{
      savePacket.Sec = S;
      savePacket.Temp = T;
      savePacket.RH = H;
      savePacket.CO2 = C;
      savePacket.Lights = L;
      savePacket.filler = fil;
      eeWrite(getAddress(),savePacket);
      delay(5);
}


getAddress() gets the address Im storing in address 0x0 again this address is stored using a struct, the starting address is 0x40, once the data is stored I increment the address by 16 and store that so the next reading goes into the new address, savepacket is the struct. All that seems to be working fine and in short runs the readings come through fine but when I leave the device for long periods and the data being sent is large it seems to fail and it doesnt even get to the parsing point in c# as I have lots of console.writelines so I can see whats happening.

This is my getHistoricData() which is called when i press a button on the application, Im a little unsure if this is the best way to send all that data, I was going to just send everything as a packet eg *25,85,1600,1,198762537* but if you have  5000 records it may take a while as your reading from eprom / put onto serial port / etc etc.
Code:
void getHistoricData()
{
  int numofrecords = (epromaddress.SA - 0x40) / 16;
  //Serial.println(numofrecords, DEC);
  int TempArray[numofrecords];
  int RHArray[numofrecords];
  int COArray[numofrecords];
  int LightArray[numofrecords];
  long int TimeS[numofrecords];
 
  for(unsigned int i = 0x40, p = 0; i < epromaddress.SA; p++, i = i + 16)
  {
    Eprom.eeRead(i,histPacket);
    delay(10);
    TempArray[p] = histPacket.Temp;
    RHArray[p] = histPacket.RH;
    COArray[p] = histPacket.CO2;
    LightArray[p] = histPacket.Lights;
    TimeS[p] = histPacket.Sec;
  }
  Serial.print("*");
  for(int i = 0; i < numofrecords; i++)
  {
    Serial.print(TempArray[i], DEC);
    Serial.print(",");
  }
  Serial.println("*");
  delay(500);
  Serial.print("{");
  for(int i = 0; i < numofrecords; i++)
  {
    Serial.print(RHArray[i], DEC);
    Serial.print(",");
  }
  Serial.println("{");
  delay(500);
  Serial.print("+");
  for(int i = 0; i < numofrecords; i++)
  {
    Serial.print(COArray[i], DEC);
    Serial.print(",");
  }
  Serial.println("+");
  delay(500);
  Serial.print("-");
  for(int i = 0; i < numofrecords; i++)
  {
    Serial.print(LightArray[i], DEC);
    Serial.print(",");
  }
  Serial.println("-");
  delay(500);
  Serial.print(":");
  for(int i = 0; i < numofrecords; i++)
  {
    Serial.print(TimeS[i], DEC);
    Serial.print(",");
  }
  Serial.println(":");
}

Once sent to the c# application and it goes through the readserial function I seperate using this
Code:
if (text[0] == '[')
                {
                    ParseCurrentData(text);
                }
                if (text[0] == '*')
                {

                    t_globalstring = text.Substring(1, text.Length - 3);
                    System.Console.WriteLine(t_globalstring);
                }
                if (text[0] == '{')
                {
                    h_globalstring = text.Substring(1, text.Length - 3);
                    System.Console.WriteLine(h_globalstring);
                }
                if (text[0] == '+')
                {
                    c_globalstring = text.Substring(1, text.Length - 3);
                    System.Console.WriteLine(c_globalstring);
                }
                if (text[0] == '-')
                {
                    l_globalstring = text.Substring(1, text.Length - 3);
                    System.Console.WriteLine(l_globalstring);

                }
                if (text[0] == ':')
                {
                    ti_globalstring = text.Substring(1, text.Length - 3);
                    addData(t_globalstring, h_globalstring, c_globalstring, l_globalstring, ti_globalstring);
                    t_globalstring = "";
                    h_globalstring = "";
                    c_globalstring = "";
                    l_globalstring = "";
                    ti_globalstring = "";
                }
      
               

And then it goes into this function
Code:
private void addData(string a, string b, string c, string d, string e)
        {
            System.Console.WriteLine(a);
            System.Console.WriteLine(b);
            System.Console.WriteLine(c);
            System.Console.WriteLine(d);
            System.Console.WriteLine(e);
            System.Console.WriteLine("Add data to database here!!");
            string[] datT = a.Split(',');
            string[] datH = b.Split(',');
            string[] datC = c.Split(',');
            string[] datL = d.Split(',');
            string[] datTi = e.Split(',');
            histlistt.Clear();
            histlisth.Clear();
            histlistc.Clear();
            histlistl.Clear();
            if (datT.Length > 2)
            {
                for (int i = 0; i < datT.Length - 1; i++)
                {
                    this.histlistt.Add(histlistt.Count, int.Parse(datT[i]));
                    this.histlisth.Add(histlisth.Count, int.Parse(datH[i]));
                    this.histlistc.Add(histlistc.Count, int.Parse(datC[i]));

                    //DataRow dRow = ds1.Tables["THCdata"].NewRow();
                    //dRow[1] = datT[i];
                    //dRow[2] = datH[i];
                    //dRow[3] = datC[i];
                    //dRow[5] = datTi[i];
                    if (int.Parse(datL[i]) > 4)
                    {
                        this.histlistl.Add(histlistc.Count, 1);
                        //dRow[4] = 1;
                    }
                    else
                    {
                        this.histlistl.Add(histlistc.Count, 0);
                        //dRow[4] = 0;
                    }
                    //ds1.Tables["THCdata"].Rows.Add(dRow);

                }
                UpdateHistGraphs();
                //da.Update(ds1, "THCdata");
                //port.Write("3");
                //GetDataFromDatabase();
            }

        }

I dont think its a problem with c#, before switching to structing everything up I was just allocating long lines of eprom address for each variable and iterating through them, worked no problem for weeks on end. Ive tried changing the port timeout on c# but they have no effect on my problem, i was getting timeout exceptions though this problem because i need to reset the arduino after asking for historic data and it fails.

Regards
Pages: [1] 2 3 ... 5