interactive film installation

robtillaart:
nice measurement!
done with that - http://www.co2meter.com/products/k-30-co2-sensor-module - sensor?

Thanks weighing in Rob, ... a K30? ... I wish!

The K30 sensor is the gold standard of CO2 sensors. (But they're 90 bucks so I'll work the device I have for now, but I will buy a K30 eventually.)

I used a "CK Sensors 0113 v5" sensor for this demo. If I had a link, I'd post it, but CK's website is amazingly content free, but has a beautiful picture of the seashore! The sensor is a polished linear chamber, 8.5 cm long with an IR LED at one end, and a photo detector (sensitive in the NIR) with an interference filter at the other end. It's from a Vernier device that had been used in biology experiments to monitor plant respiration. The sensor module's output was amplified with an NTE928 op-amp to get the range of interest (0.05% to 0.1%CO2) into 0 to 5 volts. I know that a multi-op-amp "instrument" amplifier would have been better, but I just wanted to know if this would work, and had a 928 on hand.

The amplified voltage went into a Tiny85 that converted it to an approximate CO2 concentration on the output, using Vernier's conversion formula. The 0.31% (3100ppm) shown is impossibly high for room air (and outside the linear range), because I blew directly on the sensor. The graph I posted was made by attaching the output of the littleBits voltmeter to a labpro datalogger, and adding the labels with Photoshop. The values are all reasonable, room air is considered to be "stuffy" if the CO2 level exceeds 1000ppm, while "fresh" air is about 400ppm CO2.

My circuit:


and here's the Tiny's code:

/*
 * Purple People Counter
 * 04072015 clh - convert CK113v5 CO2 sensor to count & percent
 * 
 * Thanks to sean_littleBits on the littleBits forum
 * for the voltmeter code:
 * (http://discuss.littlebits.cc/t/number-module-arduino/540/4)
 *
 * Uses a Vernier CO2 sensor connected to a0
 * count output to pin 1
 * percent/100 output on pin 0
 *
 *rewrite for tiny85 - 050615 clh
 *
 */

void setup()
{
 pinMode(0, OUTPUT);
  digitalWrite(0, LOW);
  pinMode(1, OUTPUT);
  digitalWrite(1, LOW);
  pinMode(2, OUTPUT);
  digitalWrite(2, LOW);
  pinMode(3, OUTPUT);
  digitalWrite(3, LOW);
  pinMode(4, INPUT);      // digital pin 4 is analog pin A2
}

void loop()
{
  // get the sensor value on pin a0 (val is 0 to 1023)
  int sensorValue = analogRead(A2);

  // output to the number bits on pins 5 (the number of people) and pin 9 (percent)
  analogWrite(1, percentTo255(peopleCount(sensorValue)));
  analogWrite(0, percentTo255(percentCO2(sensorValue)));

  delay(300); // dawdle for .3 seconds
}


//----------------------- subroutines ------------------------

// convert percent (0-99) into 256ths (0-255) for output to number Bit
int percentTo255(int n)
{
  int clockValues[] = {0, 3, 5, 7, 9, 11, 15, 17, 19, 22, 25, 28, 29, 32, 35, 38, 39, 42, 44, 47, 51, 53, 57, 59, 60, 62, 65, 69, 70, 72, 75, 78, 82, 84, 85, 87, 91, 93, 96, 97, 101, 103, 106, 109, 111, 112, 115, 117, 121, 124, 126, 128, 132, 134, 135, 137, 141, 143, 145, 147, 150, 154, 156, 158, 160, 163, 165, 168, 171, 174, 177, 179, 181, 184, 186, 188, 190, 192, 195, 197, 202, 204, 206, 210, 212, 214, 217, 219, 221, 224, 227, 230, 233, 235, 237, 240, 242, 244, 246, 250};
  return clockValues[n];
}


int percentCO2(int value)
{
  return (map (value, 0, 1023, 0, 99));
}


int peopleCount(int value)
{
  int result = 0;

  if (value >= 50 && value < 70) {
    result = 21;
  }

  if (value >= 70 && value < 85) {
    result = 41;
  }

  if (value >= 85 && value < 95) {
    result = 61;
  }

  if (value >= 95 && value < 102) {
    result = 81;
  }

  if (value >=  102) {
    result = 99;
  }

  return (result);
}

I'm encouraged to make a people counter device with this concept, but look at the variability of the data!

I need to learn more about dealing with this, chaotic, imprecise-yet-patterned kind of ... fuzzy ... data. Do you have any thoughts about where I could look for information about this kind of data handling?