Skip to content

co2meter-org/ExampleCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

111 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CO2Meter Example Code

Table of Contents

Downloading the Repository

To download and use the repository and code, you can either download the zip or clone the repository. Below are the steps for each.

Download Zip

1. Near the top right of the page, click on the green "Code" button

drawing

2. Click on the "Download Zip" button in the popup

drawing

3. Extract the Zip file. The files can be extraced anywhere on a local PC including Downloads, Documents, or Desktop.

Clone Repository

There are multiple ways to clone this repository. This README will cover the most popular.

GitHub Desktop

1. Download and Install GitHub Desktop

2. Near the top right of the page, click on the green "Code" button

drawing

3. Click on the Open with GitHub Desktop button in the options

drawing

4. Click on Open GitHub Desktop button in the popup

drawing

5. In GitHub Desktop, click the "Clone" button

drawing

Windows Git Bash

1. Download and install Git Bash for Windows

2. Change to the directory where the repository will be downloaded / cloned

3. Copy and paste this line into the terminal

git clone --recursive https://github.com/co2meter-org/ExampleCode.git

Mac / Linux Terminal

1. Open a terminal and change to the directory where the repository will be downloaded / cloned

2. Copy and paste this line into the terminal

git clone --recursive https://github.com/co2meter-org/ExampleCode.git

CM-200 Sensor Development Board

The CM-200 Sensor Development Board is a kit developed by CO2Meter to help customers, hobbyists, and students to go from concept to product as quickly as possible. We've provided a PCB that can interface with our free GasLab or any terminal application to evaluate sensors and view the communication protocols. Using the CM-200 as an Arduino Shield and the example code provided in this repository can rapidly get a prototype running for interfacing our most popular sensors with Arduino Uno and Arduino Mega. Also available, use the CM-200 as a Raspberry Pi Hat to prototype using the Raspberry Pi ecosystem. Finally, users can also develop production ready code with the onboard STM32WB55, with available BLE, USB, User LEDs, User Buttons, and multiple communication protocols.

Compatible Sensors

K-Series CO2 Sensors

Sunrise CO2 Sensors

Senseair Miniature Sensors

LuminOx Sensors

MinIR Sensors

Cubic

If marked with a * request no pins. May need to purchase longer pin headers

Getting to know your CM-200 Sensor Development Kit

Connector Side

drawing

The top of the CM-200 will have the electonics running the development kit, including the microcontroller and headers for Arduino and Raspberry Pi.

1. Arduino Shield Headers

To attach an Arduino Uno or Arduino Mega, set the CM-200 onto the headers of the Arduino. The Arduino can power the CM-200, or the Arduino can be powered by the USB Type-C connector. To run the example code for a specific sensor, download or clone this repository, download and install Arduino IDE, navigate to the sensor Arduino code, double click the .ino file and click Upload.

2. Raspberry Pi Hat Headers

Soldering a female socket to a Raspberry Pi Zero will fit directly onto the CM-200. If using a full Raspberry Pi Single Board Computer, such as a Raspberry Pi 4, a direct connection can be done with a cable assembly such as this. The Raspberry Pi can power the CM-200, or the Raspberry Pi can be powered by the USB Type C connector on the CM-200. To run the example code, download or clone this repository onto the Raspberry Pi, navigate to the sensor Raspberry Pi python code, and double click.

3. USB Type-C Connector

USB Type-C connector will provide 5V to the board while also appear on a PC as virtual COM port for communication through any terminal application such as RealTerm or CoolTerm. You can also download our Free GasLab software for Windows to evaluate, configure, and calibrate, as well as read the communication between Host and Sensor to help with development of communications with the sensors.

4. Power Switch

Turn on and off the CM-200 and any other devices powered by the CM-200.

5. 3v3 LDO and Power Indicator

Provides a 3.3V local power supply for the CM-200 to power the microcontroller. Also has an LED indicator to show that power is on.

6. STM32WB55

Microcontroller running the CM-200 for USB V-COM and BLE communication. Programmable for more production ready code. There is a starting point for the USB V-COM already available in this Git Repository.

7. Reset Button

To reset the STM32WB55 (V-COM port)

8. BLE Enable Button (Provisional)

By default, the CM-200 is not advertising over BLE for connection. To make a BLE connection, press and hold the BLE Enable Button until the Blue User LED lights up. The Green User LED will light up when a connection is made.

Also can be used and programmable when developing code for the STM32WB

9. User LEDs

User controllable LEDs from Arduino or Raspberry Pi. Also used as indicators for BLE in default mode.

10. User Button

User programmable button that is controllable from Arduino or Raspberry Pi.

11. I2C or UART Switch

Certain sensors share pins with UART and I2C busses. To communicate with those sensors over UART, move the switch to the right. To communicate with those sensors over I2C, move the switch to the left.

12. Switch for UART Source

UART can only be used from a single source. To use UART with STM32WB over Bluetooth or USB, slide the switch to the left over USB BLE. If doing any development with Arduino or Raspberry Pi, slide the switch to the right over ARD RPI.

13. Sensor Configuration Jumpers

Some sensors have pin configurations to switch between I2C and UART, or to hold the Sensor in Enabled mode or be user controlled. Those can be changed by making cuts or solder bridges on the pads. There are also by default I2C Pull Up resistors, whic if using external I2C development kits that already have I2C Pull Ups, then a cut can be made to remove the Pull Ups.

Sensor Side

drawing

The bottom of the CM-200 has sockets and pogo pins for the sensors, mounting hardware, and programming pins for the STM32WB

1. K30 Power and UART Pins

Pogo pins to provide 5V as well as RX and TX for UART Communication to a Sensair K30 (030-8-0006). WHen sensor is aligned and mounted to the mounting spacers, all of the pogo pins wills make necessary contact with the K30.

2. K30 I2C Pins

Pogo pins for I2C Communication with a Sensair K30 (030-8-0006). No power is provided. There are 4.7k pull up resistors available by default that can be removed by cutting the pads on the sensor configuration jumpers.

3. K30 Mounting Spacers

Mounting spacers for the Sensair K30 (030-8-0006). Use M2.5 screws on both sides of the sensor and ensure good contact is made to the pogo pins. Do not overtighten!

4. S11 Pins

Pin sockets for Senseair Sunrise 006-0-0008 formerly known as SE-11 or SE-12. Use included Press-Fit male header pins to mount the sensor to the sockets.

5. S8 Pins

Pin sockets for Senseair S8 004-0-0013. Use included Press-Fit male header pins to mount the sensor to the sockets.

6. LuminOx Pins

Pin sockets for inserting an SST LOX-O2 UV Flux.

7. CozIR MinIR Pins

Pin sockets for inserting a GSS MinIR or SprintIR CO2 Sensor.

8. CozIR LP Pins

Pin sockets for inserting a GSS LP or LP2 Sensor.

9. STM32 Programming Pins

Designed for use with TC2030-CTX-NL-STDC14 and STLINK-V3MINIE.

Using CM-200 with GasLab

Quick Steps to evaluate sensors with the CM-200 Sensor Development Kit and a compatible Windows PC

1. Download and Install the GasLab Software

https://www.co2meter.com/pages/downloads

drawing

2. Exit the GasLab Software and Unplug the USB Cable

3. Start the GasLab Software. Select the port dropdown in the lower left corner.

drawing

4. Plug the USB cable into your PC. A new COM Port number should appear.

If no COM Port appears, go to the troubleshooting section

5. Select the new COM Port

6. Select your sensor model from the Product Dropdown list.

drawing

7. Click Connect

drawing

8. Click any "Read" button to take a sensor reading.

See the manual for additional options or to begin data logging

drawing

GasLab Troubleshooting

COM Port does not appear

Windows 7

Follow this link from FTDI: https://www.ftdichip.com/Support/Documents/AppNotes/AN_119_FTDI_Drivers_Installation_Guide_for_Windows7.pdf to ensure proper installation

Windows 10

Follow this link from FTDI: https://www.ftdichip.com/Support/Documents/InstallGuides/AN_396%20FTDI%20Drivers%20Installation%20Guide%20for%20Windows%2010.pdf to ensure proper installation

About

CO2Meter's App Notes and Example Code for Arduino and Raspberry Pi to communicate with Sensors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors