0.1.2 MTP40F

This commit is contained in:
Rob Tillaart 2023-11-14 16:44:34 +01:00
parent 9bff659775
commit 9017ded7ae
7 changed files with 43 additions and 29 deletions

View File

@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.2] - 2023-11-14
- update readme.md
## [0.1.1] - 2023-08-02 ## [0.1.1] - 2023-08-02
- fix **getGasConcentration()** status handling - fix **getGasConcentration()** status handling
- update readme.md - update readme.md
@ -16,7 +20,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- add default value to **setSelfCalibrationHours(hours = 168)** - add default value to **setSelfCalibrationHours(hours = 168)**
- update examples - update examples
## [0.1.0] - 2023-07-25 ## [0.1.0] - 2023-07-25
- initial version. - initial version.

View File

@ -2,7 +2,7 @@
// FILE: MTP40F.cpp // FILE: MTP40F.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// DATE: 2023-07-25 // DATE: 2023-07-25
// VERSION: 0.1.1 // VERSION: 0.1.2
// PURPOSE: Arduino library for MTP40F CO2 sensor // PURPOSE: Arduino library for MTP40F CO2 sensor
// URL: https://github.com/RobTillaart/MTP40F // URL: https://github.com/RobTillaart/MTP40F
@ -211,7 +211,7 @@ int MTP40F::lastError()
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
// PRIVATE // PROTECTED
// //
bool MTP40F::request(uint8_t *data, uint8_t commandLength, uint8_t responseLength) bool MTP40F::request(uint8_t *data, uint8_t commandLength, uint8_t responseLength)
{ {

View File

@ -3,7 +3,7 @@
// FILE: MTP40F.h // FILE: MTP40F.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// DATE: 2023-07-25 // DATE: 2023-07-25
// VERSION: 0.1.1 // VERSION: 0.1.2
// PURPOSE: Arduino library for MTP40F CO2 sensor // PURPOSE: Arduino library for MTP40F CO2 sensor
// URL: https://github.com/RobTillaart/MTP40F // URL: https://github.com/RobTillaart/MTP40F
@ -11,7 +11,7 @@
#include "Arduino.h" #include "Arduino.h"
#define MTP40F_LIB_VERSION (F("0.1.1")) #define MTP40F_LIB_VERSION (F("0.1.2"))
#define MTP40F_DEFAULT_ADDRESS 0x64 #define MTP40F_DEFAULT_ADDRESS 0x64
@ -64,8 +64,9 @@ public:
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
//
// PROTECTED
//
protected: protected:
Stream * _ser; Stream * _ser;
uint8_t _buffer[16]; uint8_t _buffer[16];

View File

@ -1,9 +1,12 @@
[![Arduino CI](https://github.com/RobTillaart/MTP40F/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci) [![Arduino CI](https://github.com/RobTillaart/MTP40F/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![JSON check](https://github.com/RobTillaart/MTP40F/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/MTP40F/actions/workflows/jsoncheck.yml)
[![Arduino-lint](https://github.com/RobTillaart/MTP40F/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/MTP40F/actions/workflows/arduino-lint.yml) [![Arduino-lint](https://github.com/RobTillaart/MTP40F/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/MTP40F/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/MTP40F/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/MTP40F/actions/workflows/jsoncheck.yml)
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/MTP40F.svg)](https://github.com/RobTillaart/MTP40F/issues)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/MTP40F/blob/master/LICENSE) [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/MTP40F/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/MTP40F.svg?maxAge=3600)](https://github.com/RobTillaart/MTP40F/releases) [![GitHub release](https://img.shields.io/github/release/RobTillaart/MTP40F.svg?maxAge=3600)](https://github.com/RobTillaart/MTP40F/releases)
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/MTP40F.svg)](https://registry.platformio.org/libraries/robtillaart/MTP40F)
# MTP40F # MTP40F
@ -45,7 +48,7 @@ commands e.g. **setSelfCalibration()**.
The CRC of the sensor responses are not verified by the library (yet). The CRC of the sensor responses are not verified by the library (yet).
###s# Hardware interface MTP40-F #### Hardware interface MTP40-F
Has TTL level RS232, I2C and PWM IO. Has TTL level RS232, I2C and PWM IO.
@ -54,25 +57,25 @@ Has TTL level RS232, I2C and PWM IO.
+-------------+ +-------------+
| | | |
VCC (3v3 out) 5 --| |-- 1 Vin VCC (3v3 out) 5 --| |-- 1 Vin
TX 6 --| |-- 2 GND TX / SDA 6 --| |-- 2 GND
RX 7 --| |-- 3 ALARM RX / SCL 7 --| |-- 3 ALARM
R?T 8 --| |-- 4 PWM / I2C R/T 8 --| |-- 4 PWM / I2C
GND 9 --| | GND 9 --| |
| | | |
+-------------+ +-------------+
``` ```
| Pin | Name | Description | | Pin | Name | Description |
|:-----:|:----------|:-----------------------------| |:-----:|:-----------|:-----------------------------|
| 1 | Vin | 4.2V - 5.5V | | 1 | Vin | 4.2V - 5.5V |
| 2 | GND | idem | | 2 | GND | idem |
| 3 | ALARM | HIGH above 1000 PPM, LOW below 800 PPM (hysteresis) | | 3 | ALARM | HIGH above 1000 PPM, LOW below 800 PPM (hysteresis) |
| 4 | PWM/I2C | PWM out | | 4 | PWM/I2C | PWM out |
| 5 | VCC_O | 3V3 out for serial | | 5 | VCC_O | 3V3 out for serial |
| 6 | TX | Transmit 9600 baud or SDA | | 6 | TX / SDA | Transmit 9600 baud or SDA |
| 7 | RX | Receive 9600 baud or SCL | | 7 | RX / SCL | Receive 9600 baud or SCL |
| 8 | R/T | select I2C / Serial | | 8 | R/T | select Serial or I2C |
| 9 | GND | idem | | 9 | GND | idem |
#### Links #### Links
@ -208,7 +211,6 @@ Note: read datasheet!
datasheet states 0x2000 but that is 8192 which is rather strange. datasheet states 0x2000 but that is 8192 which is rather strange.
Assumption 2000 decimal is meant. Assumption 2000 decimal is meant.
#### Could #### Could
- serial bus with multiple devices? => diodes - serial bus with multiple devices? => diodes
@ -224,8 +226,16 @@ Note: read datasheet!
- some functions returning bool should return int - some functions returning bool should return int
to handle errors better MTP40F_OK or ERROR flag. to handle errors better MTP40F_OK or ERROR flag.
#### Wont #### Wont
- store SPC point in the class? - store SPC point in the class?
## Support
If you appreciate my libraries, you can support the development and maintenance.
Improve the quality of the libraries by providing issues and Pull Requests, or
donate through PayPal or GitHub sponsors.
Thank you,

View File

@ -7,7 +7,7 @@
// This sketch is meant to test the PWM conversion formula. // This sketch is meant to test the PWM conversion formula.
// Written for an Arduino UNO. // Written for an Arduino UNO.
// - it first loops through all possible values. // - it first loops through all possible values.
// - then it generates a random pulselength (within range) on pin 7 // - then it generates a random pulse length (within range) on pin 7
// - connect pin 7 to interrupt pin 3 as test. // - connect pin 7 to interrupt pin 3 as test.
// //
// Connect the PWM output to the interrupt pin 2 or 3 of the UNO. // Connect the PWM output to the interrupt pin 2 or 3 of the UNO.

View File

@ -15,9 +15,9 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/MTP40F.git" "url": "https://github.com/RobTillaart/MTP40F.git"
}, },
"version": "0.1.1", "version": "0.1.2",
"license": "MIT", "license": "MIT",
"frameworks": "arduino", "frameworks": "*",
"platforms": "*", "platforms": "*",
"headers": "MTP40F.h" "headers": "MTP40F.h"
} }

View File

@ -1,5 +1,5 @@
name=MTP40F name=MTP40F
version=0.1.1 version=0.1.2
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for MTP40F CO2 sensor sentence=Arduino library for MTP40F CO2 sensor