Show Posts
Pages: [1] 2 3 ... 5
1  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?
2  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.

3  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, 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.

4  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.

5  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

6  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

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

7  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 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 :
Software User Guide :

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

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

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

void setup()

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);    

8  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.
9  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.

10  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.
11  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.
12  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
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;

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.
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)
    TempArray[p] = histPacket.Temp;
    RHArray[p] = histPacket.RH;
    COArray[p] = histPacket.CO2;
    LightArray[p] = histPacket.Lights;
    TimeS[p] = histPacket.Sec;
  for(int i = 0; i < numofrecords; i++)
    Serial.print(TempArray[i], DEC);
  for(int i = 0; i < numofrecords; i++)
    Serial.print(RHArray[i], DEC);
  for(int i = 0; i < numofrecords; i++)
    Serial.print(COArray[i], DEC);
  for(int i = 0; i < numofrecords; i++)
    Serial.print(LightArray[i], DEC);
  for(int i = 0; i < numofrecords; i++)
    Serial.print(TimeS[i], DEC);

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

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

                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
private void addData(string a, string b, string c, string d, string 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(',');
            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;
                        this.histlistl.Add(histlistc.Count, 0);
                        //dRow[4] = 0;

                //da.Update(ds1, "THCdata");


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.

13  Using Arduino / Storage / Re: efficient eeprom storage on: January 10, 2012, 05:38:03 am
@Grumpy_Mike, ive used linked lists in c++ and java before and it seems logical to do it this way but Ive never used linked lists in arduino and Im wondering if using linked lists will take up much more space on eeprom.

@Rob, That seems the best way to go about it, struct everything up plus like you have identified the filler makes everything fit nicely, Im unsure about the date and how it fits into things, will I have to write alot of code to format the data when packing/unpacking, the clock goes from 1,1,2000 so to get todays date in seconds Id have to find out how many seconds have passed since then which is 379296000 i think but thats basing everything on 365 days a year which some are not.

14  Using Arduino / Storage / efficient eeprom storage on: January 09, 2012, 09:14:52 am
Hi, Just now im reading and writing to serial very well but id like to add a time stamp to the data im storing. I store Temp, RH, CO2, and a boolean var for lights on or off, just now im going from 0x50 + 0x850 for temp and 0x851 - 0x1010 for rh and so on so forth for the rest of the vars, that gives me about 2016 points of data or there abouts, now i need to timestamp everything id like to store the whole lot as some sort of a string with time and date eg: 21,75,1500,1,9,1,2011,15,37

what the best way to efficiently store a string like this in an indexable sort of fashion using eeprom.

Ive used structs to store hex addresses in eprom using a library but you need to know the starting address, if the string changes length by any digits then it wont take up the same space on eprom as the previous reading stored, or maybe allow more than i need to store my string and count every reading from there. Just want to know how people have done this.

15  Using Arduino / Interfacing w/ Software on the Computer / Re: bluetooth rssi with fireplug RN-USBX on: December 31, 2011, 04:31:56 am
Just now the device sits in my greenhouse outside and gathers environment data, when i load the software it gets all the historical data it has been storing in eeprom, saves it into an sql database, then clears the eeprom, i then graph everything out using zedgraph. It also sends out a live stream of data every 10 seconds for live graphing and max min values and time. Your right though its probably not worth having some sort of a meter, I have set everything up as cable replacement so I dont even need to connect to the device because as soon as i put my BT dongle into the computer it just connects automatically. if it wasnt in range it wouldnt connect.

Pages: [1] 2 3 ... 5