Introduction: CO2 Display
As its name suggests, the CO2 Display project is a small CO2 gas sensor to be plugged into USB to easily track indoor and outdoor pollution.
The CO2 level is displayed live, but it is possible with the small application provided in the documentation to generate capture samples in image (in png format) and in list file (in csv format). To better interpret the data here is a table of the PPM scale (unit of measurement of CO2).
----
Comme son nom l’indique, le projet Afficheur CO2 est un petit capteur
de gaz CO2 à brancher sur USB pour traquer facilement la pollution intérieur comme extérieur.
L’affichage du taux de CO2 se fait en direct, mais il est possible avec la petite application fournit dans la documentation de générer des échantillons de capture en image (au format png) et en fichier liste (au format csv).
Pour mieux interpréter la donnée voici un tableau d’échelle des PPM (unité de mesure du CO2)
Step 1: Equipment List
To make this sensor we opted for the MZ-H19B sensor, relatively inexpensive, compact, reliable in its measurements and with a lifespan of more than 5 years, it seemed to us that this sensor was the most suitable for our use as a portable sensor.
To mount the sensor you will need to purchase the following list of equipment:
- MH-Z19B CO2 sensor
- Arduino Nano microcontroller (with USB cable)
- 7-segment display TM1637
- 10 Prototyping cables female <> female jumpers.
- 40g of PLA for 3D printer
- (Optional) 50x50mm of 3mm plywood.
-------
Pour faire ce capteur nous avons opté pour le capteur MZ-H19B,
relativement peu cher, compact, fiable dans ses mesures et avec une durée de vie supérieure à 5ans il nous semblait que ce capteur était le plus indiqué pour notre usage de capteur portable.
Pour monter le capteur il vous faudra acheter la liste de matériel suivante :
- Capteur de CO2 MH-Z19B
- Microcontrôleur Arduino Nano (avec câble USB)
- Afficheur 7 segments TM1637
- 10 Câbles de prototypage « jumpers » femelle<>femelle.
- 40g de PLA pour imprimante 3D
- (En option) 50x50mm de bois contreplaqué 3mm.
Step 2: Build the Sensor Shell 1/2
To mount the sensor, you will also need to download and print the 2 elements of the housing shell. There are 3 files: 1 for the facade (FacadeBois.pdf / FacadeBois.svg) and 2 for the rear (BoitierFond.stl and BoitierFaceBois.stl). If you do not have a laser cutter you can only download and make BoitierFace.stl.
To print we advise you to use a 0.4mm nozzle for a 0.1mm layer. Depending on your printer, you can expect to print part of the case in 3h15.
If you have printed BoitierFaceBois.stl, do not forget, once the printing is finished, to remove the supports necessary to print the object (see the photo).
---
Pour monter le capteur, il vous faudra également télécharger puis
imprimer les 2 éléments de la coque du boîtier. Il existe 3 fichiers une 1 pour la façade (FacadeBois.pdf / FacadeBois.svg) et 2 pour l’arrière (BoitierFond.stl et BoitierFaceBois.stl). Si vous n’avez pas de découpeuse laser vous ne pourrez que télécharger et réaliser BoitierFace.stl.
Pour imprimer nous vous conseillons d’utiliser une buse 0.4mm pour une couche de 0.1mm. En fonction de votre imprimante vous pouvez espérer imprimer une partie de boîtier en 3h15.
Si vous avez imprimez BoitierFaceBois.stl, n'oubliez pas, une fois l'impression terminée de retirer les supports nécessaire à l'impression de l'objet (voir sur la photo).
Step 3: Build the Sensor Shell 2/2 (option)
As an option, if you have printed BoitierFaceBois.stl you can cut the small front panel of the sensor out of 3mm thick wood and then assemble the two elements (see photo).
---
En option, si vous avez imprimé BoitierFaceBois.stl vous pouvez découper
la petite façade du capteur dans du bois de 3mm d’épaisseur pour ensuite assembler les deux éléments (voir la photo).
Step 4: Assemble the Electronics to the Shell
Now that you have all the elements in hand, you will be able to assemble the box with its sensors. To do so, follow the sketches and explanatory photos.
----
Maintenant que vous avez tout les éléments en main vous allez pouvoir
assembler le boîtier avec ses capteurs. Pour se faire suivez les croquis et photos explicatifs.
Step 5: Manufacturing "Y"
Be careful before you start wiring! Since the arduino only has a + 5v output, you are going to need to make Y cables that will power both components with a single 5v pin. To do this, provide yourself with 3 female-female jumpers to achieve 2 "Y" and follow the photos.
Once the Y's are formed, make a spot weld to secure the wires. Then, to finish, provide yourself with a roll of chatterton to insulate the welds (beware of short circuits, which in such a small space will be inevitable)
---
Attention, avant de commencer à câbler ! Étant donné que la arduino
n’a qu’une sortie +5v, vous allez devoir fabriquer des câbles Y qui vont permettre d’alimenter les deux composants avec une seule pin 5v. Pour cela munissez vous de 3 jumpers femelle-femelle pour réaliser 2 "Y" et suivez les photos.
Une fois les Y formés, faites un point de soudure pour fixer les fils. Puis, pour finir, munissez-vous d'un rouleau de chatterton pour isoler les soudures (attention aux court-circuits, qui dans un espace aussi réduit seront inévitable)
Step 6: Wire the Object
Now that you have your Y (s) and before closing the final box, you will need to connect the whole system with the rest of your female-female jumpers cables. To complete this step, follow the plan.
Pin D10 (arduino)> Pin TX (CO2 sensor)
Pin D11 (arduino)> Pin RX (CO2 sensor)
Pin D4 (arduino)> Pin CLK (7 seg display)
Pin D5 (arduino)> Pin DIO (7 seg display)
Pin 5v (arduino)> Pin V + (CO2 sensor), Pin Vcc (7 seg display)
Pin GND (arduino)> Pin V- (CO2 sensor), Pin Gnd (7 seg display)
----
Maintenant que vous avez votre ou vos Y et avant de refermer le
boîtier finalisé, il vous faudra brancher tout le système avec le reste de vos câbles jumpers femelle-femelle. Pour réaliser cette étape, suiviez le plan.
Pin D10 (arduino) > Pin TX (capteur CO2)
Pin D11 (arduino) > Pin RX (capteur CO2)
Pin D4 (arduino) > Pin CLK (afficheur 7 seg)
Pin D5 (arduino) > Pin DIO (afficheur 7 seg)
Pin 5v (arduino) > Pin V+ (capteur CO2), Pin Vcc (afficheur 7 seg)
Pin GND (arduino) > Pin V- (capteur CO2), Pin Gnd (afficheur 7 seg)
Step 7: Close the Shell
... paying careful attention to the cables.
---
... en faisant bien attention aux câbles.
Step 8: Upload the Arduino Code !
Now that the connection is functional, and that you have closed the box, connect the sensor to your computer.
Copy the code provided in the documentation then, Using the Arduino software, upload it to the Arduino Nano.
Once uploaded, the sensor should function properly and display the CO2 level live on the display.
----
Maintenant que le branchement est fonctionnel, et que vous avez fermé le boitier, branchez le capteur sur votre ordinateur.
Copiez le code mis à disposition dans la documentation puis, Avec le logiciel Arduino, téléversez le dans la Arduino Nano.
Une fois televersé, le capteur devrait fonctionner correctement et afficher le taux de CO2 en direct sur l’afficheur.
Step 9: [Work in Progress] Save the Data!
If you want to go further and store the displayed values live, we suggest you use the small processing application [To finish]. This application will automatically save a capture log (as a csv list file and a graphic in png format).
To make the application work correctly, follow these steps:
1- launch the application on a computer
2- connect the sensor to this computer
3- let the sensor connect for the desired time
4- to end the sampling, unplug the sensor, the application will generate the capture files automatically. These are stored by default in the same folder where the application is located.
---
Si vous voulez allez plus
loin et stocker les valeurs afficher en direct, nous vous proposons d’utiliser la petite application processing [A finir]. Cette application enregistra automatiquement un journal de capture (sous forme de fichier liste csv et de graphique au format png).
Pour faire fonctionner correctement l’application, suiviez ces étapes :
1- lancez l’application sur un ordinateur
2- branchez le capteur sur cet ordinateur
3- laissez le capteur branchez le temps voulu
4- pour mettre fin à l'échantillonnage, débranchez le capteur, l’application générera les fichiers de captures automatiquement. Ces derniers sont stockés par défaut dans le même dossier où est situé l’application.
4 People Made This Project!
- X-Stranger made it!
- JanB118 made it!
- John Smith junior made it!
- SusanaO made it!
21 Comments
10 months ago on Step 9
dzien dobry
Nie mogę otworzyć szkicu w arduino ide. Czy nie miał ktoś podobnego problemu ?
Z góry dziękuje
1 year ago
Bonjour,
Merci pour ce projet que je voudrais bien réaliser mais je me heurte au problème suivant " no matching function for call to 'MHZ19::MHZ19()' "
J'ai téléchargé à plusieurs reprises la bibliothèque concernant le capteur MH-Z19 mais j'ai toujours le même message d'erreur.
Je n'ai malheureusement que quelques notions pour la programmation Arduino.
Je vous remercie beaucoup de votre aide, je pourrais ainsi terminer de petit montage qui me tient à coeur.
Bien cordialement
Jimmy
Question 2 years ago
Hi,
First of all: thank you for your project.
Based on your code, you don't use pin D2 (CO2 sensor PWM) and use RX and TX. So, I connected RX to pin10 and TX to pin 11 of arduino nano and I did not connect the PWM pin. My 7 segment module only has 4 pins and I connected them as you have described in the circuit.
https://www.amazon.es/hiletgo-Digital-visualizaci%C3%B3n-Segmento-pantalla/dp/B00HFQEJCW/ref=asc_df_B00HFQEJCW/?tag=googshopes-21&linkCode=df0&hvadid=309248251586&hvpos=&hvnetw=g&hvrand=2963348111862422536&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=20288&hvtargid=pla-561729638066&psc=1
The animation starts and finally, my 7 segment module shows the numeric value 0. If I open Serial, I see the following error message:
!Error: Timed out waiting for response
!ERROR: Failed to verify connection(1) to sensor.
!ERROR: Initial communication errorCode recieved
!Error: Timed out waiting for response
!Error: Timed out waiting for response
!Error: Timed out waiting for response
0
!Error: Timed out waiting for response
0
!Error: Timed out waiting for response
0
!Error: Timed out waiting for response
0
Regards and thanks for your time!
Answer 2 years ago
Hello SusanaO,
thank you for making this little sensor !
I made a small error in the diagram of connections. First make sure that the TX of the sensor is on the RX of the nano and vice versa. For my part it often happens to me to invert the two ports.
If this doesn't work try to change the Rx and Tx ports in the arduino code. You can for example reuse the initial ports Rx = 1 and Tx = 0.
Have a nice day !
Tell me if that work :)
Reply 2 years ago
Hi,
Thanks for your quick response. My idea was to use it today at New Years Eve dinner.
Rx and Tx are cross-connected. It was not well connected.
Now I connected like this:
MHZ16, Rx> arduino nano, D0 (Tx1)
MHZ16, Tx> arduino nano, D1 (Rx1)
To upload the program to the arduino nano board I disconnected Vcc. Already uploaded, I reconnected Vcc.
On my 7 segment display the animation occurs and then my display only shows the number "0".
So, I reviewed your program and realized that you had written:
// Branchelent capteur MHZ16B
#define RX_PIN 10
#define TX_PIN 11
I understood that I should change it like this:
// Branchelent capteur MHZ16B
#define RX_PIN 0
#define TX_PIN 1
I reloaded the program to the board and I see that it still doesn't work.
I attach two images.
Thanks for your time!!!
Reply 2 years ago
Hi,
Seeing the connections in your photo, it looks good.
I think it's the MHZ16B library that sends this message. I found this discussion in the Github of the creator of the library, which suggests an error either in the connections / wires (perhaps also due to the type of Arduino) or in the hardware:
https://github.com/WifWaf/MH-Z19/issues/16
I hope this will help you,
Reply 2 years ago
Hi,
Thanks!
I have several Arduino nano at home. This afternoon I try another.
Thanks again.
Regards and Merry Christmas!!!!
Reply 2 years ago
Hi,
My CO2 Display works very well. I am so happy!!!!!!!!
Thanks!!!!
Reply 2 years ago
Congratulations ! I'm very glad it ended up working
Thank you for your feedback, it allowed me to update some steps of this tutorial
Happy new year to you !!
Question 2 years ago on Step 9
Are you sure, that your code works with this wiring? You connected PWM of MHZ19 with D2 of the arduino but you didn't define D2 in the code of the sketch...
Answer 2 years ago
Hello,
you are right, there is an error on the wiring part, I finally used the rx and tx ports to capture the data but I did not put the correct version of the wire diagram on instructables.
I will rectify this when I return from Christmas.
thank you for your report.
Merry Christmas !
Question 2 years ago
Hi Tony
Impressive build! I especially like the combination of the wood plate with the 3D printed design... One question: You write that the CO2 sensor has a lifespan of 5 years. Is that a manufacturer info? What do you think will happen at the end of the lifespan? Will the sensor readings become more and more off the the real value (which would be bad, as you can't rely on it any more and probably don't even know about it) or will it it just stop working?
Mike
Reply 2 years ago
Hello Mike, Thank you !
During my readings on the internet, I only found the info that these 5 years was a minimum and that the sensor could last longer. It is very likely that from a moment the data will indeed deteriorate. But we will still have to be patient to be sure ;)
Reply 2 years ago
Hmm, that is about what I expected... well, then, talk to you in 5 years ;-) Will you build another one then to have a comparison?
Reply 2 years ago
to wait for the next 5 years, next January we will give this sensor to a citizen institute which will try to determine the reliability of the data !
I will therefore come back to you to keep you informed of the results ;)
Reply 2 years ago
Will be interesting to see!
2 years ago
Bonjour, je ne connais rien en arduino! existe-t-il un site (fr) pour apprendre à se servir et utiliser ces petites merveilles ! Bien entendu pour un débutant qui n'est nulle part.
Reply 2 years ago
Bonjour ;)
Je pourrais te conseiller le Mooc en ligne "programmer un objet arduino" de mes collègues de l'IMT, c'est une bonne introduction bien que la courbe de difficulté augemente rapidement (si vous voulez mon avis :)
https://www.imt.fr/events/event/fun-mooc-programme...
Sinon il y a la chaine youtube de U=RI, que je trouve très bien pour commencer :
Bonne journée !
Tony
Reply 2 years ago
grand merci
Bernard
2 years ago
Nice job! What program did you use to design the 3D printed parts?