Introduction: Corona - Beginners Arduino CO2-Measuring and „Ampel“ Display Project

About: Holistically fascinated with the world.... ....so meet me in the labyrinth....

This is a project for absolute Arduino Beginners!

I was an absolute Arduino Beginner a week ago, so believe me, I know!

HOWEVER, if you go through this - Step-by-Step, I might be able to let you build a useful gadget for only about 25, with pretty lights, that could also help you, and someone(s) you care about, stay healthy.

You might also learn a tiny little bit about cool electronics and you might learn a tiny little bit of programming.

At the same time, you might also see that programming is actually really fun and „kids stuff“ and that anybody (even me) can do it and does it every day anyway - like when you tell a friend how to put together the LEGOs for a cool toy or how to cook a great meal!

When you see how easy it is, you might actually go on to bigger projects, like a robot that will put the LEGOs together for you….

I hope you’ll like it ;-)

Supplies

1x CO2-Temperature-Humidity…Sensor (9€):

https://www.banggood.com/CCS811-HDC1080-Carbon-Dio...

1x Arduino NANO (1€):

https://www.az-delivery.de/pages/gratisnanov3

1x LCD 20x4 with i2C connect (8€):

https://www.az-delivery.de/products/hd44780-2004-l...

1x 35 in 1 Arduino Sensorkit Modulkit etc (for Buzzer and „Ampel“ 20€ but you can buy the parts separately for cheap):

https://www.az-delivery.de/products/35-in-1-arduin...

1x Switch to turn the Buzzer On/Off (no idea, but just couple of cent)

1x Bread-Board Kit (6,5€)

https://www.az-delivery.de/products/mb-102-breadbo...

1x USB data cable

A bit of code and a couple of program libraries from the interne (free, later)

Your Notebook/PC/....


Tools:

None

OK, once you want to transform this into a real usable tool, you will need a case, some wires and solder and a soldering iron, but that is beyond this tutorial, because I just want to show you how simple it is to get started.

Step 1: Preliminary Considerations on Keeping Safe in Disease Times

Now to the serious side:

Of course, you can also skip to "Step One", if you just want to see how easy the project it is and want to skip the tedious and depressing part.

I’m keeping this project a bit dire, because far too many people have died and are currently dying every day! Yesterday, as I was writing this, a plane crashed in Indonesia, killing 62 people, while the US had a death-count of over 3000 people due to the corona virus - now calculate how many planes that would be….

That said, a discourse to the background of this project:

Corona is running rampant in many countries and even though vaccines are already being administered, an end to the pandemic is very far off on the horizon.

1st Level Defense - So, the only immediate possible move is to prevent getting infected, or at least to try to reduce the risks as much as possible.

Physical (NOT social) distancing is the most effective measure to prevent the transfer, which is why many countries are currently in, or going into another lock-down. Luckily, our current level of technology permits us to stay in touch.

2nd Level - Since the virus is airborne, the next level of defense is rather simple, i.e. filters in the form of face-masks, that can be quite simple to rather complex. As i’ve already mentioned in my previous Instructable on UVC disinfection, they generally employ simple physical, chemical and biological principles, to filter the tiny virus particles from the air and/or destroy them on contact. Most masks are based on small pores, or thick filters, that cause the particles to get stuck on fibers due to the turbulence in the medium. Others employ lipophilic materials, metal fibers, salts and other materials in various combinations.

3rd Level - The next level is, of course, simple hygiene and common sense: What your grandma told you: Wash Your Hands!….

And she knew, because she lived through a war, where diseases where just one of the big problems.

4th Level - After keeping yourself clean, the next in line is the disinfection of all possibly materials such as the face-masks and other objects that might be contaminated, in order to make them reusable.

Most FFP2/3 masks are single-use in most cases, while self-made masks may be washable. Multiple washings will reduce the filters effectiveness over time, so it’s best to keep the cycles to a minimum. In both cases this can be achieved by treatment with UVC radiation, like it is used in clinics. I’ve described a simple disinfection cabinet to use at home in my previous Instructable.

5th Level - If you can’t avoid spending time with others in the same room, like in offices, kinder-gardens and schools it has been shown, that the probability of infections, as well as the severity, can be reduced, if the viral particle load in the air is reduced. This can easily be achieved using active air filters, or, since they cost money, simply by opening the windows from time to time for a while to get fresh air in.

Since it is politically opportune (for some people), there is a high pressure in some countries on opening child-care centers and schools in spite of an official lock-down. The argument is usually that children don’t get sick and therefore can’t spread the disease. This, in spite of several publications that show similar viral loads in children without symptoms and sick adults. But that is another story….

Step 2: ​The Goal of This Project: a CO2-Meter !

In order to avoid the expenditures for aktive air purifiers, The practice of opening the windows has been widely propagated and it has been defined as a sort of standard - in Germany - to do a cycle of 20min closed windows and 5min open windows.

In addition it has been established that, instead of measuring the particle-density across several particle sizes, it is easier to define a Carbon-dioxide scale in correlation instead. There is a rough correlation between the number of particles a person exhales with the CO2, as well as the total Volatile Organic Compounds (VOC).

I could go on about the complex relationships, with correspondence to temperature and humidity, but that could become an Instructable by itself.

In Germany, 0-1000 ppm CO2 is considered good, 1000-2000ppm is still adequate, while anything above 2000ppm is considered „not good“.

Accordingly, there are several Versions of DIY projects on the NET, as well as lots of expensive meters to buy.

Because, my wife and daughter are both teachers and therefore at high risk, there are many things I’ve tried to come up with to reduce their risks of infection to a minimum.

One gadget I found on Banggod, was a particle sensor, so of course, bought it (while it was 10€ cheaper than the link):

https://www.banggood.com/PM1_0-PM2_5-PM10-Detector...

It works great and they will test how well it works in a real-life environment next week.

I’m not providing any links to publications, because I’m lazy, so let me know if you’d like links and I will think long and hard about taking the time….

I deleted the section about "Fake News" and QAnon and what people that believe in these things should go and do, because we have a "Be Nice Policy" here. ;-)

If you are serious about science and helping others, you have read this far and probably have researched as much as I have, so you probably don’t really need links from me anyway.

Anyway, back to the topic….

I found a CO2-Temperature-Humidity-Sensor on Banggood last summer, that I thought about maybe using in an experiment some time - if I ever got the time….

Well, as i recently I was fired - without probable and still unknown cause on Dec 28 2020 - as I might just mention ;-) - I suddenly have a bit of time available to play with all the cool electronics bits that I had collected over the past year.

And guess what? I have all the bits it takes in order to build a CO2-Measuring Device! YEY! :-)

I have an Arduino Uno, a Nano, as well as some ESP32 boards, collecting dust, that I got cheap from AZ-Delivery. There is also a Sensor-Box I got from them, as well as a LCD display and a gas sensor I found on Banggood some time go - perfect!

So now I had to figure out how to use the Arduino, which was a bit scary and really the biggest hurdle, because I don’t know all that much about micro-electronics and directly programming anything lies about 50 yeas back - or more….

Luckily, AZ-Delivery also has e-books with rudimentary instructions on how to use the bits and pieces that you buy there. They also offer an Arduino Compendium, that is an excellent introduction to the whole field with simple, but effective examples to all topics - you notice, that I like them ;-)

They also have a Blog with lots of interesting projects, but so far no CO2-Measuring-Device.

They are buying in China, but you get it in a couple of days instead of weeks and for the same money - A good choice in Europe.

Also, there are lots and lots of examples, of course, on the NET to pick and choose from.

My biggest problem was figuring out how to handle the hardware with respect to which may be the relevant libraries.

GitHub is THE best choice, if you are searching! So it’s best if you look around there, to get used to their structure.

After that, it was actually relatively „easy“, and the little tiny bit of actual programming a „timer“ was really fun too!

I decided on using an Arduino Nano instead of the Uno, because it’s tiny and doesn’t need much energy, so maybe I’ll run it on rechargeable batteries some time.

I also got it for free with my first order at AZ-Delivery! ;-)

So, if you are interested, it is a relatively cheap (ca. 25€) and fun project to build, as well as an easy and simple „Beginners Arduino CO2-Measuring and Display Project“ ….


Yes, since I’m a beginner at Arduino, there are probably loads of people, that can do it far better and quicker and in color, but humor me and let me know what I could have done better in the comments, so that I can learn more, as well as those, who might follow also….

Step 3: Hardware - Wiring Things Up

That is really easy and just a little bit of a puzzle.

It’s the point where I always stopped before this project.

It’s best if you use a breadboard and stick the Nano in the middle towards one end - in this case the left - with the USB-Port to the side, so you always have space for the USB cable. The designers had prototyping in mind, so it fits perfectly.

Just in case you’ve never dealt with a bread-board, the red and blue outer lines are meant for power and run horizontally across the picture and the ABC marked inner ones are connected vertically and don’t cross the middle, so you can connect to each pin on the Nano separately.

I tried to do the setup of the components as structured as possible and hopefully, the pictures are also helpful. Red is + and Black is Ground, is - , as usual.

If you develop something yourself, you’d normally stick one bit after another on the breadboard, then do some tests in the Arduino IDE to see if it works, then stick the next module on, connect and test, and so on.

Since I did it this way until things worked, I’m still going to do it with putting all the hardware together first, because else, this Instructable would become even more tediously long.

Dumb Parts

So, we start with the easy things like the Buzzer and the LED Lights. The Buzzer break-out board has three pins, but only the two outer ones are used.

If you build this with separate LEDs, please don't forget, that they each need a small resistor to limit the current, so they don’t get damaged. With the module I use, you might notice the tiny resistors beneath each LED.

With the Arduino, it is important to note, that for each device, like a buzzer or LED, I need to use a separate Output pin, simply because they are not intelligent, i.e. they have no separate processor to tell them apart.

So that I can later address them correctly with my program, I need to make sure the Arduino that I use can address the correct pin.

In this case I use the D5 pin for the Buzzer, with an orange wire.

The LED gets pins D6 (red wire/LED), D7 (yellow), D8 (green). Why not start with D3? Go ahead, it just turned out the way it is.

You’ve probably noticed the tiny switch I added to the buzzer - that thing quickly gets on your nerves!

Both the break-out boards also have a (GND) Ground pin, which in turn is connected to one of the GND pins on the Nano - here you see why the bread-board is useful in having more than one hole for each pin on the Nano.

Congratulations! With this you’ve connected your first output devices to your Nano.

Smart Parts

As you’ll have noticed, there aren’t really that many pins on the Nano to connect things to, so People that are smarter than me came up with a protocol to connect several different devices, like LCD displays, to just four pins - I2C.

The device you connect needs to at least be smart enough to remember its own ID, so the Nano can address each connected device correctly. Here comes the internet of things….

The LCD display I’m using, has a little translator board on the back, on the sensor break-out, the chip is on the board. The little blue block on the I2C translator on the LCD is a variable resistor, which you will need to adjust the contrast on the display, once you start using it, because the writing will probably not be legible at first.

The LCD display needs just the four leads GND (-), VCC (+5V), SDA (Serial Data), SCL (Serial Clock).

The names tell you already that the data is transferred in a bit by bit fashion across a single line. And, of course, you need a line to keep it all in synch.

This is only I2C in a nutshell, so please do look deeper….

The board with the sensors has the same pins VCC (3,3V in this case), GND (-), SCL, SDA. In this case, however, the board also needs to be „awakened“ which happens via the fittingly named pin „WAK“.

The Nano

On the Nano side, the literature (pin-out diagram) shows that SDA is on pin A4 and SCL is on pin A5. In the description of the sensor board, I also found, that the D13 (leftmost) pin on the Nano can be used for the wake-signal, so to keep all the wires of the sensor board on one side, let’s use it.

So, as you see from the picture, the wiring is quite simple, with VCC in red, GND in black, SDA to A4, in yellow SCL to A4 in green and WAK to D3 in orange.

Here you’ll notice also that I’m using the ground pin on the lower side, just to keep it more tidy.

With the LED connections the picture gets a little more confusing, but its still the same pattern.

A4 to SDA (yellow), A5 to SCL (green), then three pins to the right 5V to VCC (red) and two more pins to the right, again GND to GND (black).

That’s it for the wiring! You are all done with the easy part! YEY!

We are powering the Nano via the USB port, so there is no need for any further components.

Step 4: Setting Up the Programming Environment

There are lots of tutorials that show how the Arduino IDE needs to be installed, on whatever system you are typing and clicking on, so I’m leaving it to you to chose the one you like best. There are also alternatives. I’m working on an old 2011 MacBook and went well with the instructions in the Arduino „Kompenium“ from AZ-Delivery:

https://www.az-delivery.de/products/arduino-kompen...

It’s only about 10€ as Kindle edition on Amazon and gives you also an Electronics 101, but so far only in German (I think), but there are lots of alternatives on the web and guides on YouTube, so again you decide what you like best.

The Arduino IDE is free and can be downloaded from:

https://www.arduino.cc/en/software

- The installation of the IDE itself is absolutely simple, with OK/OK/OK/Finish - or so.

- Once finished, connect the NANO with a USB (data) cable to your System. In the picture, you see not the Nano, but a ESP32 board, but you get the ides.

- I in the Arduino IDE, under „Tools/Board“, I selected the Arduino Nano

- Then I selected under „Tools/Processor“ „ATmega328P (Old Bootloader)

- Then, I selected under „Tools/Port“ I selected the serial one - NOT!

Ok, that tripped me up, because there was no COM, or serial port, but I found that on some systems the driver may be missing. In that case you simply need to search for „CH34x driver“ on the Net, download the one matching your system, install it, reboot and start over in the Arduino IDE = 5 min max.

This also happens, if you don’t have your Nano, or other board connected - so no worries!

- Then, I selected under „Tools/Port“ the serial one - in my case „/dev/cu.wchusbserial640“, on Windows it’ll be a COM3/4….

- Well, then you are ready to go and try some of the available samples like the often cited „File/Samples/01.Basics/Blink“, which makes one tiny LED on your Nano blink. YEY! My first success with the Nano! Literally! No joke!

- The next step after playing around a little to get used to things, is finding the right libraries for the bits you want to use.

The next is tying them into the IDE.

After that you have to get them into your Program = your „Sketch“.

The library for the Nano is already included, as are many other boards.

If you buy something exotic, they usually also tell you where to get a matching library.

If you buy it on Alibaba, or Banggood, or such, like my sensor board, you might get less lucky, and will need to search….

The libraries are usually available as a ZIP-file, that you simply download from GitHub or the place the vendor tells you and import into the Arduino IDE via „Sketch/Add File“, which opens a file browser, where you go find your ZIP-file….

After that you’ll find the library in the list of lots of available libraries - the screenshot also shows the „CCS811“ as well as the „ClosedCube HDC1080“ that I’m using below.

If you have unusual Sensors or extensions, you may have to do some searching on GitHub and you may need to tie in a couple of different libraries, because there is no single one that includes all the sensors on your board, which is the case here.

The LCD with I2C I use is relatively simple, because of the I2C adapter, is already connected.

The preferred Library for the display is the LiquidCrystal_I2C:

https://github.com/fdebrabander/Arduino-LiquidCrys...

For the CO2-Sensor board its similar, because of an on-board controller but you need two libraries to read the sensors data:

https://github.com/maarten-pennings/CCS811/

https://github.com/closedcube/ClosedCube_HDC1080_A...

Giving Output to the LED „Street-Light“ and the buzzer is also really simple, because you only need to tell the Nano, which of its pins to use.

One more thing that is not needed here, but that helped me along with figuring out on how to use my sensor board, was the project by NEOE GmbH, NEOE Kit 6, which you can check out on GitHub to further your studies:

https://github.com/NEOE-IO

Step 5: Program!

OK, now you are ready to put it all together in your program, i.e. your sketch!

Roll up your sleeves, let’s get dirty! ;-)

This is also, where there is even more Text and less pretty pictures.

Well then, let’s connect the board to your system and open the Arduino IDEcheck if the correct Board, Processor and Port are still selected, as described earlier and open a new sketch under „File/New“.

As you can see from the screenshot, it doesn’t look like much.

Ok finished!

Bye!

Just kidding! it’s just to show you how Arduino programs are structured, and how friendly the system is.

The sketch generally is automatically named after the date you create it - you can rename it later.

The sketch you see consists simply of two sections „void setup()“ and „void loop()“.

In the „setup()“ section, you tell the processor all the little things, that it needs to know when it „wakes up“. Whatever is written there only happens once, every time you turn on your device.

The actual code with what your gadget is supposed to do is placed in the „loop()“ section. Here you break down your ideas into the most basic tasks, so that the „idiot“ processor can simply use them as a step by step recipe to cook your meal. The „loop“ means also, that once the processor has finished preparing your meal, it will start right back at the beginning of the code and cook the next, exact same meal again. So if you want to check the temperature in your bathroom every 10 min, it’d be a very short bit of code, that simply repeats over and over and over, until the battery runs out.

Ok, there’s a little bit more to it, of course, like tying in the libraries for the break-out boards you might use, there are lots of variable types, procedures and much, much more, but that’s for another 10 Instructables…..

- In this instructable, you will simply download/take the sketch I wrote up, put it in your favorite folder and open it in the Arduino IDE - on my MacBook, a double-click is enough to start the IDE and prompt the question, if a corresponding folder should be created - OK, sure, why not - and you are ready to go - if you downloaded the libraries before, etc - see above….

The programming is based on C++, so could be really tedious, but the Arduino guys in Italy wanted to make it easier on their users, so some things are „hidden“.

- If you haven’t connected your Nano before, do so now and check the settings again under „Tools….“ as in the previous section.

- The five icons on the left top side of the sketch window (the only screenshot) let you do exactly what the context tells you.

- If your connections fit, you can simply compile the sketch again, to see if everything is ok, if you push the left-most „Check“.

- The upload to your Nano is just as simple, if you push the second button with the „arrow to the right“. It will take a few seconds and the tiny LEDs on the Nano will blink energetically, then the Nano will reboot and start displaying the data it receives from the sensors….

- If it doesn’t, you get to start troubleshooting………….but it’ll probably be the wiring to a wrong pin, or the variable resistor (blue cube) on the LCD display I2C connector that needs adjusting. There is really not much you can do wrong here,

OK, some component could actually be broken.

Well, that’s it! You now have a working CO2 sensor on the cheap and have finished your first Arduino project. Pretty easy!

You can go on now and solder everything together and buy a 3D printer and design a really cool case in Fusion360 to put your project in and start selling these things on ebay.

Good luck! :-)

If you want to learn a tiny little bit more, you can go on and read the next part though….

Step 6: How It Works

Ok, if you want the tedious and cool things, read on (and I really do hope I got everything right).

Please open the Arduino IDE and open the Sketch you downloaded.

If you look at the code, you will notice that there are many lines with „//„.

These tell the compiler of the Arduino IDE that everything after them is just comments, so that the programmer will be able to remember what he/she/…. was trying to do, or planning to do….

I did a whole lot of these comments in the code, starting with „0“ to tell you what I was about there.

So,….. don’t fall asleep.

#, (),{} and other symbols are really important to programming, but I will not get into detail here….

// 0 This is where you tell the compiler which libraries are needed

This is the section I did not elaborate on before. It’s where you tell the compiler all the things that need to be included - like additional libraries, some objects - welcome to C++ - and variables you can define ahead of time.

In this part you’ll see the „#include xxxxx“ for all the libraries we need.

//1-3 The librariesfor the sensors and the LCD display.

I’m not going into Object Oriented Processing, because you can buy thick books on the topic, but suffice to say, it opens realms.

In this code I define three objects:

//4 - LiquidCrystal_I2C LCD(39, 20, 4); - 4 Defines "LCD" as an object with I3C address "39", 20 characters per line and 4 lines on the display. The connection without the I2C Module would be far more tedious.

//5 - CCS811 ccs811(13); - Defines "css811" as an object, that gets a wake-up signal (WAK) from the Nano Pin D13

//6 - ClosedCube_HDC1080 hdc1080; - 6 Defines the hdc sensor as an object „hdc1080"

Congratulations, once again, you have just started to program in an object oriented manner, by telling the program, that the sensors are objects, and should be treated as such. And as a real life object has certain properties, they do so in programming, where they are defined in the associated libraries! If you are on a Mac, you will find the possible attributes somewhere in the library folder like on the screenshot in the „keywords.txt“.

So, if you look into things, you’ll see that I’m just scratching the surface here - as I warned you….

Next in the code, I define some variables, that I know will be needed and set from the beginning.

You can always go on and define new variables as you go along, but you are serious about things, you should look into memory management some time, because processors like the Nano are really tiny.

Please also look into the different types of variables there are available, because they can have a profound impact on performance.

//7 - int timer = 0; - defines a variable as „Integer“, needed to count seconds for my so called "timer" routine.

//8 - bool air = 0; - defines a variable, „Boolean“, that can only be „Yes/No, True/False, 1/0“ to let me check when to open/close the window.

//9 - int Buzzer = 5; int RED = 6; int YELLOW = 7; int GREEN = 8; - All define Integer variables, needed to tell the Nano which pins the Buzzer and LEDs are on.

//10 - uint16_t temperaturecorrection = 6.5; - The temperature sensor on my sensor board is a bit off, so I had to put in a correcting factor. It was supposed to be pretty small, but the other components also produce heat, so, ohh well. If you decide to try this project, you’ll need to do your own calibrations and set the correction accordingly.

//11 - void setup() { - This is where you tell the processor what it’s all about, when it „wakes up“ and everything between the „ { } “ is part of it.

//12 - Serial.begin(115200); Serial.println();…. - I only put this in, so that you see that it is really easy to print information out on your own screen on the „Serial Monitor“, to be found (unsurprisingly under „Tools/Serial Monitor“. It can show you what is going on on your device in realtime and is invaluable when you write code and want to check how things are coming along, or when trouble-shooting………..

In „real life“ you don’t need this any more.

//13 - Wire.begin(); - tells the processor to use the I2C protocol, so that you can use your LCD, sensors, and lots of other cool stuff like an OLED in the future.…

//14 - LCD.init(); LCD.clear();…. - This is where you wake up your LCD display and display a few nonsense messages, or even a couple of useful ones to tell the user that the system is starting up.

//15 - ccs811.set_i2cdelay(50);…. - Tell the CO2 sensor to wake up and check if it did and tell the user, in case it’s broken.

//16 - hdc1080.begin(0x40); - Wake up the humidity sensor.

// 17 - pinMode(Buzzer, OUTPUT);…. - Tell the processor, that the integer variables that you defined earlier and set are actually its pins and that, if they are called in the program, that it should put power on them.

// 18 - ok= ccs811.start(CCS811_MODE_1SEC);…. - let’s check the sensor again….

// 19 - void loop() { - This is where we finally get going with the actual program! Again, everything between the „ { } “ is part of the loop = the program!

// 20 - You start reading some data from your sensors and correct them, if needed.

// 21 - uint16_t eco2, tvoc, errstat, raw; - You define a couple of variables as you will shortly need them for your data from the sensor.

// 22 - float temperatureread = hdc1080.readTemperature(); - Defines a variable and reads the temperature from the object you defined earlier, with the property defined in its library.

// 23 - float temperature = temperatureread - temperaturecorrection; - Again, if your sensor is „off“, or influenced by the other bits on the break-out, you need to correct the temperature with the correction you measured yourself.

// 24 - float humidity = hdc1080.readHumidity(); - This defines a variable and reads the humidity value from the sensor.

// 25 - ccs811.set_envdata(temperature, humidity); - This is so far unusual, because here you tell the sensor two values, the temperature and humidity, instead of just reading.

// 26 - ccs811.read(&eco2, &tvoc, &errstat, &raw); - This is where you read the values for the variables you defined above from the sensor, after previously sending it the temperature and humidity values - i.e., the sensor is not really stupid.

// 27 - LCD.clear(); - Time to show the user that the thing is actually worth its money by displaying the data you collected on the LCD display.

// 28 - In this case, I show you two ways of displaying things on the display. You basically have to tell the display exactly on which space and on which line you want to display something. Note, that it’s (position, line) and not the other way round - strange - and that, if you have too many characters sent to your line, they will end up on the next line with the library I use in this example.

A - LCD.setCursor(0, 0); LCD.print("Temperature: "); LCD.setCursor(12, 0); LCD.print(temperature); LCD.setCursor(18, 0); LCD.print(„C“); - This shows how you put multiple output on the same line by setting a different cursor position each time before „printing“ the data. It’s cool, because you always have the data at the same position. BUT, if the length of your data digits change, like „17 mm“ to „2 mm“, the display is persistent and will display „27 mm“, which may seem a bit confusing to the user. Of course, you can always clear the display before displaying the new data….

B - LCD.setCursor(0, 0); LCD.print(String("Temperatur: ") + String(temperature) + String(" C“)); - Here, you „print“ the information, that you combine beforehand into one block out of „Strings“ of text and data as it fits your temper. I personally favor this approach, because it is more flexible and because I have to type less and therefore make less mistakes.

// 29 - if (eco2 <= 1000){

digitalWrite(RED, LOW);

digitalWrite(YELLOW, LOW);

digitalWrite(GREEN, HIGH);

} ……….. - this is finally a bit of real programming logic, where you don’t just display what your sensors read, but have to tell the program what is Good/OK/Bad for the user. These if/then/else, do/until, do/while and so on procedures give you lots of ways to wring your mind around - have fun with it!

Since we are all lazy, we like to see pretty lights instead of having to decipher cryptic little symbols, so here we also finally turn on the pretty lights.

// 30 - Well, this is a really simple "timer", and I’m not proud of it, and it can be accomplished in many other „better“ ways, I know, and a real programmer would probably write it in a single cryptic command.

BUT, it was fun to try to come up with the logic and write it!!!!

And that is the end of the Loop, so after 2 seconds it starts the next round....

And, this is basically the point, where I try to „push“ you into the cold water and motivate you to do it yourself, and better….

// 31 - Because this is the end of the line/project!

Step 7: Fin

So, Now it is up to you, to go and play with the Arduino boards and all the derivatives and all the sensors and all the bits and pieces you may have lying around….

Go and automatically water your plants, or make your house talk back at you without Alexa….

The last picture also shows the particle counter I got from Banggod in the back.

My next project might be building a case, or extending this project with an OLED display and a WIFI board and other bits and pieces, I have in the box beneath my desk in the basement.

Or maybe a little daemon, packed into a tightly bound box, so it can’t get out and cause havoc, but can only react by knocking and rumbling if awakened - a „Klopfgeist“.

Or maybe my own personal portable Cloud/Web-Server………………………….

I have this old cardboard box beneath my desk, in the basement, where all kinds of things that no longer find space on my desk fall into. It’s amazing what you sometimes find in it. Since I’m out of work at the moment, my desk is no longer clean, but has once again started to collected many things. It happened almost instantly, when I removed the company hardware. Sometimes, it seems to collect things without my knowing, because I often notice things, I certainly didn’t put there myself. Maybe some of the things from the box are also migrating to the desk again.

So it’s sometimes good to visit my desk to get new ideas, or nightmares.

As i wrote before, somewhere, my wife has decided to no longer venture near my desk, in fear of injury due to spiky things and sharp edges, or things that might actually crawl away or attack - even our cat stays politely away….

We keep „the other child“ down there too….

But, that is another story….

Anyway, please let me know if I did anything wrong in this project, or if you have any comments and suggestions, and stay healthy and Greetings from Heidelberg, Germany,

Nils :-)

And ALWAYS stay fascinated!

Anything Goes Contest

Participated in the
Anything Goes Contest