😷 Indoor climate kit!
Did you know that poor air quality can cause headaches and spread illness?🤕😷🤒
Let’s make sure the air quality is always good with this project! 🌬️🌿😀
In this project we will use a SCD30 sensor together with a programmable LED strip. The SCD30 sensor is a very advanced sensor, that can measure Co2 level, temperature and humidity at the same time. The goal is to collect air-quality data, but also to show if it’s time to open a window to get some fresh air.
Outdoors we will typically have a Co2 measurement of around 380 PPM, this means 0.0038% per m3.
Indoors the Co2 level is typically higher, but should generally be less than 1000 PPM for a healthy indoor climate that doesn’t cause drowsiness or headaches.
This 📕 Expert project isn’t for the faint of heart, as it will get really complicated with several conditional blocks.
If you find it too hard, you can always return to the projects overview and try another project or go through the basic tutorial 🙂
To get started with this project, you will need the following equipment:
- Wappsto:bit and power supply
- micro:bit and a device you can program it from
- SCD30 sensor with connector cables
- Programmable LED strip with connector cables
Once you are set with all of the above equipment, we will connect it all to the Wappsto:bit, and then program it!
Connecting the equipment:
Connect the SCD30 sensor to the Wappsto:bit:
- Connect the SDA cable (White cable) to P20
- Connect the SCL cable (Yellow cable) to P19
- Connect the GND cable to GND in the P20 row
- Connect the VCC cable to 3.3V in the P20 row
Connect the LED strip to the Wappsto:bit:
- Connect the DIN cable to P0
- Connect the GND cable to GND in the P0 row
- Connect the +5V cable to GND in the P0 row
See how it should look by now, below:
Time for programming!
First, setup the following extensions in a MakeCode project (Unsure how to load extensions? Click here for help!):
- Wappsto:bit extension
- Neopixel extension
- Unofficial SCD30 extension
- Find it by inserting the following link into the MakeCode extensions search bar
https://github.com/calliope-mini/pxt-SCD30
- Find it by inserting the following link into the MakeCode extensions search bar
Program in MakeCode:
Because this is an advanced code, it will be separate into 4 parts:
1) The on start block
2) The forever block
3) On number value received block
4) The full program
1) On start block:
- Give your device a name
- Setup a Wappsto number value for the Co2 level
- Setup a Wappsto number value for the Temperature
- Setup a Wappsto number value for the Humidity
- Setup a Wappsto number value for the Update speed
This will let you remote control how often your Wappsto:bit samples the air quality. - Set neopixel strip at P0 with 7 LEDs
- Set variable Update speed to 60.000 (Sample once a minute)
- Set neopixel strip brightness to 50
In doubt? Check below MakeCode code for help. You can also find the finished code in the end of the project!
Get it on MakeCode
Program in MakeCode, continued:
Warm tip: For conditional else if blocks below, it’s useful to build the first one, then duplicate for the two next and just modify the variables.
2) Forever block:
- Send number, “SCD30: Read Co2”, to Wappsto
- Send number, “SCD30: Read Temperature”, to Wappsto
- Send number, “SCD30: Read Humidity”, to Wappsto
- Conditional else if block for Co2 level:
- If “SCD30: Read Co2” is less than 700, set Neopixel strip, pixel number 6 to Green
- If “SCD30: Read Co2” is higher than 1000, set Neopixel strip, pixel number 6 to Red
- Else set Neopixel strip, pixel number 6 to Yellow
- Conditional else if block for Temperature level:
- If “SCD30: Read Temperature” is less than 17, set Neopixel strip, pixel number 0 to Blue
- If “SCD30: Read Temperature” is higher than 26, set Neopixel strip, pixel number 0 to Red
- Else set Neopixel strip, pixel number 0 to Green
- Conditional else if block for Humidity level:
- If “SCD30: Read Humidity” is less than 30, set Neopixel strip, pixel number 3 to Red
- If “SCD30: Read Humidity” is higher than 50, set Neopixel strip, pixel number 3 to Blue
- Else set Neopixel strip, pixel number 3 to Green
- Neopixel strip Show block
- Pause for “Pause variable” milliseconds
In doubt? Check below MakeCode code for help. You can also find the finished code in the end of the project!
Get it on MakeCode
Program in MakeCode, continued:
3) On Number value received from Wappsto block:
- Set “Update speed” variable to the Received number
- Send the updated “Update speed” variable to Wappsto for easy feedback.
In doubt? Check below MakeCode code for help. You can also find the finished code in the end of the project!
Get it on MakeCode
4) Full program
Great job! Now we are ready to rock and roll and make sure our air quality is good!
The full code is below as promised, what other things can you come up with to improve the program?
When is there most Co2 in a room? Can you count how many people are in a closed room based on how fast Co2 level rises?
There are a lot of fun experiments you can do!
Get it on MakeCode
Don’t Miss Out on Awesome Projects and News
Stay in the Loop and Join our Newsletter!
Learn together with Wappsto:bit
Start experimenting with fun projects
Contact by phone
(0045) 46 922 722
Contact by email
Wappstobit@Seluxit.com