Skip to content

Commit f13d003

Browse files
committed
0.1.2 ACD3100
1 parent d048c60 commit f13d003

File tree

8 files changed

+75
-56
lines changed

8 files changed

+75
-56
lines changed

libraries/ACD3100/ACD3100.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: ACD3100.cpp
33
// AUTHOR: Rob Tillaart
44
// DATE: 2024-10-29
5-
// VERSION: 0.1.1
5+
// VERSION: 0.1.2
66
// PURPOSE: Arduino library for I2C ACD3100 CO2 sensor
77
// URL: https://github.com/RobTillaart/ACD3100
88
// http://www.aosong.com/products-220.html
@@ -267,7 +267,6 @@ int ACD3100::getLastError()
267267
//
268268
// PRIVATE
269269
//
270-
271270
int ACD3100::_command(uint8_t * arr, uint8_t size)
272271
{
273272
_wire->beginTransmission(_address);

libraries/ACD3100/ACD3100.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// FILE: ACD3100.h
44
// AUTHOR: Rob Tillaart
55
// DATE: 2024-10-29
6-
// VERSION: 0.1.1
6+
// VERSION: 0.1.2
77
// PURPOSE: Arduino library for I2C ACD3100 CO2 sensor
88
// URL: https://github.com/RobTillaart/ACD3100
99
// http://www.aosong.com/products-220.html
@@ -13,7 +13,7 @@
1313
#include "Wire.h"
1414

1515

16-
#define ACD3100_LIB_VERSION (F("0.1.1"))
16+
#define ACD3100_LIB_VERSION (F("0.1.2"))
1717
#define ACD3100_DEFAULT_ADDRESS 0x2A // 0x54 ?
1818

1919
// ERROR CODES
@@ -85,7 +85,3 @@ class ACD3100
8585

8686
// -- END OF FILE --
8787

88-
89-
90-
91-

libraries/ACD3100/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.1.2] - 2025-02-04
10+
- update readme.md
11+
- add preheat in example ACD3100_demo.ino
12+
913
## [0.1.1] - 2024-10-29
1014
- fix #4, remove calibration mode (not supported as in ACD10)
1115
- fix #2, update documentation

libraries/ACD3100/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024-2024 Rob Tillaart
3+
Copyright (c) 2024-2025 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

libraries/ACD3100/README.md

Lines changed: 58 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,43 @@
1313

1414
Arduino library for the ACD3100 CO2 sensor (I2C).
1515

16-
**The documentation needs to be updated**
17-
**This is a copy of the ADC10 readme.md**
18-
19-
The ACD3100 is very similar to the ACD10 but details differ.
20-
21-
**Work in progress Work in progress Work in progress Work in progress**
22-
2316

2417
## Description
2518

2619
**Experimental**
2720

21+
The documentation is an adjusted copy of the ACD10 readme.md, as the
22+
ACD3100 is very similar to the ACD10 but some details differ.
23+
24+
**Work in progress Work in progress Work in progress Work in progress**
25+
2826
This library is to use the Aosong ACD3100 CO2 sensor.
2927
Besides CO2 concentration this sensor also provides a temperature reading.
3028

3129
The CO2 concentration supported by the sensor has a range from 400 ~ 5000 ppm ±(50ppm + 5% reading).
3230
This makes the sensor applicable for outdoor and indoor measurements in
3331
a normal building setting.
3432
The sensor is not suitable for CO2 heavy "industrial" environments.
33+
See also datasheet warning below.
3534

3635
**Warning** The temperature range the sensor can measure is **UNKNOWN**
3736
as there is no documentation how to convert the raw data to meaningful one.
37+
As far as information could tell this temperature is for Aosong internal use.
38+
If you can decode the temperature bits please let me know.
3839

3940
The sensor can be read over I2C and over Serial.
4041
This library only support the I2C interface (see hardware notes below).
42+
The Serial mode is **NOT** supported by this library.
43+
44+
Feedback as always is welcome.
4145

46+
### Datasheet warning
4247

43-
#### Pre-heat period
48+
_Do not apply this product to safety protection devices or emergency stop equipment,
49+
and any other applications that may cause personal injury due to the product's failure._
50+
51+
52+
### Pre-heat period
4453

4554
When the sensor starts up it has a pre-heat period of 120 seconds.
4655
The library provides functions to check the time since the constructor is called.
@@ -49,62 +58,66 @@ During the preheat period one can make measurements but one should use those
4958
carefully as these are less accurate than after the preheat period.
5059

5160

52-
#### Calibration
61+
### Calibration
5362

5463
Also important is the calibration of the sensor, although done in the factory,
5564
a CO2 sensor needs regular calibration. See datasheet for details.
5665

5766

58-
#### Power
67+
### Power
5968

6069
The sensor must be powered with 5V and uses about 225 mW.
6170
This implies the sensor uses 50 mA (@5V) and needs a separate power supply.
6271
One must connect GND from the power supply to the GND of the MCU.
6372

6473

65-
#### Datasheet warning
66-
67-
Do not apply this product to safety protection devices or emergency stop equipment,
68-
and any other applications that may cause personal injury due to the product's failure.
69-
74+
### Operating conditions
7075

71-
#### Operating conditions
76+
| parameter | value | notes |
77+
|:--------------------|:-------------:|:--------|
78+
| temperature | 0°C~ +50°C | keep away from freezing cold or direct sunlight.
79+
| humidity | 0% ~ 95% RH | keep in non-condensing conditions.
80+
| Refresh frequency | 2 seconds |
7281

73-
- temperature: 0°C~ +50°C ==> keep away from freezing cold or direct sunlight.
74-
- humidity: 0% ~ 95% RH ==> non-condensing conditions.
75-
- Data refresh frequency: 2 seconds
7682

77-
78-
#### Hardware
83+
### Hardware
7984

8085

8186
```
8287
TOPVIEW ACD3100
8388
+--------------------+
84-
pin 5 | o |
85-
| o o | pin 1
86-
| o o | pin 2
87-
| o o | pin 3
88-
| o o | pin 4
89+
pin 5 | o S |
90+
pin 6 | o C R o | pin 1
91+
pin 7 | o D T o | pin 2
92+
pin 8 | o V G o | pin 3
93+
pin 9 | o G 5 o | pin 4
8994
| |
9095
+--------------------+
9196
```
9297

93-
| pin | name | description | Notes |
94-
|:-----:|:--------:|:------------------|:-------:|
95-
| 1 | SDA/RX | I2C data | 3-5V
96-
| 2 | SCL/TX | I2C clock | 3-5V
97-
| 3 | GND | Ground |
98-
| 4 | VCC | Power +5V | separate power supply needed.
99-
| 5 | SET | select com mode | HIGH (or n.c.) => I2C, LOW => Serial
100-
| 6 | - | not connected |
98+
**Note the code chars are on the bottom side of the sensor!**
99+
100+
101+
| pin | code | name | description | Notes |
102+
|:-----:|:------:|:--------:|:------------------|:-------:|
103+
| 1 | R | SDA/RX | I2C data | 3-5V
104+
| 2 | T | SCL/TX | I2C clock | 3-5V
105+
| 3 | G | GND | Ground |
106+
| 4 | 5 | VCC | Power +5V | separate power supply needed.
107+
| 5 | S | SET | select com mode | HIGH (or n.c.) => I2C, LOW => Serial
108+
| | | | |
109+
| 6 | C | | | unknown (clock?)
110+
| 7 | D | | | unknown (data?)
111+
| 8 | V | | | unknown (ground?)
112+
| 9 | G | | | unknown (voltage?)
113+
101114

102115
If pin 5 is not connected or connected to HIGH, **I2C** is selected (default).
103116
If pin 5 is connected to GND (LOW), Serial / UART mode is selected.
104117
This latter serial mode is **NOT** supported by this library.
105118

106119

107-
#### Related
120+
### Related
108121

109122
- https://emariete.com/en/sensor-co2-mh-z19b/
110123
- https://emariete.com/en/sensor-co2-low-consumption-mh-z1311a-winsen/
@@ -118,7 +131,7 @@ This latter serial mode is **NOT** supported by this library.
118131
- https://github.com/RobTillaart/Cozir
119132

120133

121-
#### Tested
134+
### Tested
122135

123136
TODO: Test on Arduino UNO and ESP32
124137

@@ -141,7 +154,7 @@ Every time the power is shut off the pre-heat would run again internally.
141154
It is unclear what effect this has on the lifetime and quality of the sensor.
142155

143156

144-
#### I2C multiplexing
157+
### I2C multiplexing
145158

146159
Sometimes you need to control more devices than possible with the default
147160
address range the device provides.
@@ -161,7 +174,7 @@ too if they are behind the multiplexer.
161174
See example **TCA9548_demo_ACD3100.ino**
162175

163176

164-
#### I2C Performance
177+
### I2C Performance
165178

166179
Only test **readSensor()** as that is the main function.
167180

@@ -176,7 +189,7 @@ Only test **readSensor()** as that is the main function.
176189
| 600 KHz | |
177190

178191

179-
TODO: run performance sketch.
192+
TODO: run performance sketch on hardware.
180193

181194

182195
## Interface
@@ -185,15 +198,15 @@ TODO: run performance sketch.
185198
#include "ACD3100.h"
186199
```
187200

188-
#### Constructor
201+
### Constructor
189202

190203
- **ACD3100(TwoWire \*wire = &Wire)** optional select I2C bus.
191204
- **bool begin()** checks if device is visible on the I2C bus.
192205
- **bool isConnected()** Checks if device address can be found on I2C bus.
193206
- **uint8_t getAddress()** Returns the fixed address 0x2A (42).
194207

195208

196-
#### PreHeat
209+
### PreHeat
197210

198211
PreHeat functions assume the sensor is (and stays) connected to power.
199212

@@ -202,7 +215,7 @@ PreHeat functions assume the sensor is (and stays) connected to power.
202215
left before preHeat is complete.
203216

204217

205-
#### Request and Read
218+
### Request and Read
206219

207220
The interface of the sensor is made asynchronous as there is a delay needed
208221
of around 80 milliseconds between a request for new data and the availability
@@ -230,7 +243,7 @@ Use 5~10 milliseconds above the minimal value the sensor still works.
230243
- **uint8_t getRequestTime()** returns the current request time in milliseconds.
231244

232245

233-
#### Calibration
246+
### Calibration
234247

235248
Read the datasheet about calibration process (twice).
236249
Incorrect calibration leads to incorrect output.
@@ -242,7 +255,7 @@ from 400 to 5000, the parameter value should be in this range.
242255
Note: One should wait 5 milliseconds between the calibration calls (see datasheet).
243256

244257

245-
#### Miscellaneous
258+
### Miscellaneous
246259

247260
- **void factoryReset()** idem.
248261
- **bool readFactorySet()** Read back if factory reset was successful.
@@ -252,7 +265,7 @@ Minimum length off arr is 11.
252265
Minimum length of arr is 11.
253266

254267

255-
#### Debug
268+
### Debug
256269

257270
- **uint8_t getLastError()** returns last error of low level communication.
258271

libraries/ACD3100/examples/ACD3100_demo/ACD3100_demo.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ void setup()
2121

2222
Wire.begin();
2323
mySensor.begin();
24+
while (!mySensor.preHeatDone())
25+
{
26+
delay(10000);
27+
Serial.print("..");
28+
Serial.println(mySensor.preHeatMillisLeft() / 1000);
29+
}
30+
Serial.println();
2431
}
2532

2633

libraries/ACD3100/library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/ACD3100.git"
1717
},
18-
"version": "0.1.1",
18+
"version": "0.1.2",
1919
"license": "MIT",
2020
"frameworks": "*",
2121
"platforms": "*",

libraries/ACD3100/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ACD3100
2-
version=0.1.1
2+
version=0.1.2
33
author=Rob Tillaart <[email protected]>
44
maintainer=Rob Tillaart <[email protected]>
55
sentence=Arduino library for the ACD3100 CO2 sensor.

0 commit comments

Comments
 (0)