Sensor wiring question

Hi !

I'm building a Co2-concentration based automatic ventilation system. I have all necessary electronics, beside the sensor itself.
Here's an image of the screen output:

For now, it's using just a random-function to create the sensor value, so that's why the ppm-chart is so jumpy. The basic idea is that a sensor is connected to arduino, which will calculate the proper action, and send a voltage between 0 to 5 to the digital tyristortransformer, which controls the two ventilation motors. The screen will show current ppm and rpm, a chart of ppm values, and the current mode. The chart function works so, that every four minutes a line gets drawn on the right side of the screen, and previous lines are moved to the left. That way I can see the ppm-values of past 8 hours, so I know what has happened during a work day or at night.

This is the sensor that I'm considering for the project:

And luckily, there are instructions how to connect it to arduino:
http://cdn.shopify.com/s/files/1/0019/5952/files/Senseair-Arduino.pdf

What I don't know is, do I need to power the sensor, or does it get the power from those 3-wires shown on the PDF?
What kind of cable would be most suitable for this kind of connection?
Can it be 5-meters long?
Does the encosure need holes, or do I need to get sensor head out of the enclosure?

I have not yet ordered the sensor, since I want to finish the controller first, so if you know a better Co2-sensor, or have experience of some other sensor, please share your thoughts.

ekto:
What I don't know is, do I need to power the sensor, or does it get the power from those 3-wires shown on the PDF?

Yes, it gets 5V power from the Arduino via the red wire in the photo (in the PDF).

ekto:
What kind of cable would be most suitable for this kind of connection?
Can it be 5-meters long?

The I2C bus that the Arduino application note uses is designed for short length connections between ICs and specifies a limit of 400pF total bus capacitance. Unfortunately, multicore cable tends to have capacitance of order 100pF core to core and 200pF core to screen per metre. So 5m would be pushing it. For long cable lengths, you might be better off using the Modbus interface supported by the sensor, or the analogue output.

Just toke some measurements and 3,5 meters would be the accurate distance. What kind of cable should I use? I just tried to wire my screen with 50cm long ethernet cable, and it didn't seem to work... Or it might be just bad soldering :blush:

Should I use thicker gable or is there some specific type I should use?
I have no expirience of signal cables etc...

Often cat5 cable is used for different sensors, it has enough wires for power and signals.

Is it possible to have a sneak preview of the code? Especially how you inplemented the moving graph? what lcd is used?

It's very simple. I don't have the code here now, but this the idea...

This is in the setup:

for (int i=0; i <= 127; i++){lines[i] = 600;}

It sets all the array-values to the same, so the draw function has something to do and I get a nice flat line at start.

This is in the loop:

for (int i = 0; i <= 126; i++){lines[i] = lines[i + 1]}

This moves the values in the array one step down.
lines0 = lines 1, lines 1 = lines 2, ........ lines 126 = lines 127
The array has 128 values, like the screen has 128 pixels in X-direction.

lines[127] = random(600,1200);

This will be replaced with the actual sensor value.

for (int i = 0; i <= 127; i++){drawline = map(lines[i], 600, 1200, 31, 1); 
   LCDA.DrawBrLine(xpos,drawline,xpos,32);
   delay (10);
   xpos++;
 }

This will draw every array value to buffer as a line, from left to right. In the actual code, I have also a function that keeps the drawline-value between 1 and 31, wich are the Y-values of the screen.

LCDA.RenderScreenBuffer(2);
delay(10);
LCDA.DumpScreenBuffer();

This renders all the lines and dumps the buffer...
After this starts the functions to make the numbers and text.

In the actual code, a line function is called every four minutes (using the IF newmillis - oldmillis > interval) and the numbers are updated constantly.

The screen is this:

DONT BY IT. It's very dificult to get working with arduino. I'm using two seperate libraries just to do the lines and text. By a screen that is more compatible with the glcd-library...

OK, you just redraw the whole image, the screen has no means to "move" an area one pixel to the left in hardware (bitblitting ?)

The reason I asked, is that quite recently I helped someone on the forum to speed up the redraw of the screen of a Wifi spectrum analyzer (screenshot looked quite similar) . We ended with a version in which only the pixels that changed were set ON/OFF, factor 10 less calls to setpixel(). See - http://arduino.cc/forum/index.php/topic,67218 -

Ok. I think it has that kind of function, but I had no idea how to use it... In a faster program, that would be a good thing to use, but this screen is WERY slow, so it could not perform as a analyzer...

About the ethernet cable. The wires are twisted in pairs and again the pairs are twisted. Could this have a negative efect, since all the wires has diferent data moving? With ethernet, the twisting is used to correct errors, but here it could make them?

Is it so, that a thikcer gable is better than a thinner one, in general?

I'd used screened multicore cable for this sort of application, with the screen connected to ground to to protect against interference. Unfortunately this will exceed the I2C capacitance specification; but that may not matter unless a high signalling rate is used. You need 4 cores for that sensor, or 3 cores if you carry the ground connection tnrough the screen.