MonkMakes CO2 MINI KIT Instructions Manual

For micro:bit

Advertisement

Quick Links

Adventures
with the
CO
M
K
INI
IT
2
F
:
OR MICRO
BIT
H
1
ARDWARE V
A
Instructions Document v1f

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the CO2 MINI KIT and is the answer not in the manual?

Questions and answers

Summary of Contents for MonkMakes CO2 MINI KIT

  • Page 1 Adventures with the OR MICRO ARDWARE V Instructions Document v1f...
  • Page 2: Table Of Contents

    Python Module......................21 Calibration.......................22 Troubleshooting.......................23 Learning........................25 MonkMakes......................26 NTRODUCTION The CO2 Mini is a true CO2 sensor, combined with temperature and relative humidity sensors designed for use with the BBC micro:bit. The board will work with micro:bit version 1 and 2 boards, although some of the projects included in these instructions will only work with micro:bit version 2 boards.
  • Page 3: Parts

    ARTS Please note that a BBC micro:bit is NOT included in this kit. Before you do anything else, check that your kit includes the following items: CO2 Mini for micro:bit Set of alligator clip leads (5 leads) Page 3...
  • Page 4: Co2 And Health

    EALTH The level of CO2 in the air we breathe has a direct influence on our well-being. CO2 levels are of particular interest from a public health point of view as, to put it simply, they are a measure of how much we are breathing other people's air. We humans breathe out CO2 and so, if several people are in a poorly ventilated room, the level of CO2 will gradually increase.
  • Page 5: Operation

    The readings are likely to be quite erratic for the first 5 minutes that the board is powered up - just ignore these readings. If there is a problem during the self test, the orange LED in the MonkMakes logo will blink an error message. The number of blinks indicates the problem with the board.
  • Page 6 Connect the micro:bit to the CO2 Mini Use the alligator clip leads to connect your micro:bit to the CO2 Mini. It's a good idea to use the red lead for 3V, black for GND, for the other two leads chose whatever colors you like. Note that there is no connection between pin 2 of the micro:bit and the CO2 Mini board.
  • Page 7: Experiment 1. Displaying Co2 Readings

    1. D CO2 R XPERIMENT ISPLAYING EADINGS MakeCode Link: https://makecode.microbit.org/_8i6PXKVfDJkL This program displays the CO2 reading in parts per million, refreshing every 5 seconds. When you click on the code link at the top of the page, the MakeCode system will open a preview window that looks like this: You can preview the program, but you can't change it or, more importantly, put it on you micro:bit, until you click on the Edit button indicated.
  • Page 8 Python If you'd rather use Python for these projects, then Python versions of the programs are available for download, along with a Python module for the CO2 Mini. To download them open your browser on this URL: https://github.com/monkmakes/co2_mini_micropython_module Page 8...
  • Page 9 Click on the green Code button and then select Download ZIP. Save the ZIP file somewhere convenient, and then extract it. This will create a folder called co2_mini_micropython_module-main. Now open a new browser tab and open the micro:bit Python editor here: https://python.microbit.org/ and press the Start Coding button.
  • Page 10 root of the folder you downloaded earlier. This time, when the editor prompts you to confirm, click on the tiny cog settings icon above the confirm button and then select Add file co2_mini.py before clicking the Confirm button. Now you can click on the Send to micro:bit button to install the program onto your micro:bit.
  • Page 11: Experiment 2. Co2 Meter

    2. CO2 M XPERIMENT ETER MakeCode Link: https://makecode.microbit.org/_WM8381DvVVxx This program builds on the first experiment so that, when button A is pressed, the temperature in degrees Celsius is displayed and, when button B is pressed the relative humidity is displayed as a percentage. Install this program onto your micro:bit in the same way as you did in experiment 1, by using the code link at the top of this page.
  • Page 12 while True: now = ticks_ms() if ticks_diff(now, last_time) > 5000: display.scroll(str(co2_mini.co2())) last_time = now if button_a.was_pressed(): display.scroll(str(co2_mini.temp())) if button_b.was_pressed(): display.scroll(str(co2_mini.humidity())) The micro:bit will scroll out the message every 5 seconds, but the rest of the time, it needs to monitor the buttons to detect presses. This means that, unlike Experiment 1, we can't just sleep for 5 seconds.
  • Page 13: Experiment 3. Co2 Alarm

    3. CO2 A XPERIMENT LARM MakeCode Link: https://makecode.microbit.org/_J4d1xpUhzUmK This program displays the CO2 level as a bar graph on the micro:bit's display rather than as a number. Also, when the CO2 level exceeds a preset value, the display shows a warning symbol. Python Using the same procedure as Programs 1 and 2, you can find the Python version of this program in the file 03_co2_alarm.py.
  • Page 14 co2_mini = CO2Mini() co2_mini.start() # redirects serial, so no console co2_mini.set_altitude(0) # in meters change # if you live high up def bargraph(reading): # 0..max_co2 a = int(reading / (max_co2 / 5)) # 0..4 if a > 4: a = 4 display.clear() display.set_pixel(2, 4, 9) # turn on middle pixel # of bottom row...
  • Page 15: Experiment 4. Data Logging To A File

    4. D XPERIMENT OGGING TO A MakeCode Link: https://makecode.microbit.org/_3xmAJXR6yLEu This experiment will only work on a micro:bit version 2 and there is no Python version for this project. To use the program, press button A to start data logging – you will see a heart icon to show that all is well.
  • Page 16 If you click on the Visual preview button, a simple plot of the data will be displayed. Page 16...
  • Page 17: Experiment 5. Data Logging Over Usb

    5. D XPERIMENT OGGING OVER MakeCode Link: https://MakeCode.microbit.org/_C3w0vJhY6cMc This project only works on micro:bit version 2 and using the Google Chrome browser. Even so, you may find that the web USB feature of Chrome does not work reliably with the CO2 Mini. Instead of logging data to a file, like we did in Experiment 5, you will be logging data to your computer in real-time over the USB connection.
  • Page 18 Having captured the data, you can then click on the blue download icon to save it as a CSV file that can be imported into a spreadsheet, where you can plot charts. Because the three readings are actually logged at slightly different times, there will be a separate time column, in the CSV file, for each reading type.
  • Page 19: Makecode Extension

    * Click on + New Project to create a new MakeCode project – give it whatever name you like * Click on the + Extension and in the Search area paste the following web address: https://github.com/monkmakes/co2_mini_MakeCode_extension This should bring up a single search result. * Click on the CO2 Mini extension and it will be installed.
  • Page 20 Blocks Description Block Description This block is usually placed in your on start block and it redirects the micro:bit's serial port to talk to the CO2 Mini. This block returns the CO2 concentration detected by the sensor in ppm (parts per million). Fresh air is usually about 400ppm. This sensor can measure concentrations as high as 5000ppm.
  • Page 21: Python Module

    YTHON ODULE The Python module for the CO2 Mini can be found here: https://github.com/monkmakes/co2_mini_micropython_module It comprises a class called CO2Mini that has the following methods, that correspond to the blocks in the MakeCode extension. Method Description start() This method redirects the micro:bit's serial port to talk to the CO2 Mini.
  • Page 22: Factory Reset

    ALIBRATION Given 5 or 10 minutes to settle, the CO2 Mini should produce reasonably accurate CO2 readings without calibration. However, when you need the most accurate results, the CO2 Mini should be calibrated. Also, as time goes on, its readings will drift away from the true CO2 level.
  • Page 23: Troubleshooting

    3V connections of the micro:bit are connected to the GND and 3V connectors of the CO2 Mini. Problem: When a program is running, the orange LED in the MonkMakes logo of the CO2 Mini blinks repeatedly. Solution: This indicates an error with the board and the number flashes indicates the error.
  • Page 24 Problem: I'm using Python and the CO2 Mini RGB LED has gone off and no readings are coming back, but the Orange power LED in the MonkMakes logo is lit. Solution: A side-effect of sharing the serial link between USB and the CO2 Mini, is that if an error occurs in your code, the error message will be sent to CO2 Mini, causing unexpected problems.
  • Page 25: Learning

    EARNING micro:bit Programming If you want to learn more about programming the micro:bit in MicroPython, then you should consider buying Simon Monk's book 'Programming micro:bit: Getting Started with MicroPython', which is available from all major book sellers. For some interesting project ideas, you might also like micro:bit for the Mad Scientist from NoStarch Press.
  • Page 26: Monkmakes

    For more information on this kit, the product's home page is here: https://monkmakes.com/co2_mini As well as this kit, MonkMakes makes all sorts of kits and gadgets to help with your maker projects. Find out more, as well as where to buy here: https://monkmakes.com...

Table of Contents