Go Down

Topic: CJMCU-6814 adapter board with MICS-6814 CO/NH3/NO2-sensor (Read 6242 times) previous topic - next topic

aunt_hjoordis

Jun 06, 2019, 04:53 pm Last Edit: Jun 06, 2019, 06:55 pm by aunt_hjoordis Reason: Schematic didn't upload properly, fixed links, fixed some bad english
Hi folks!

I'm working with air quality monitor and using this quite easily available module/adapter: https://www.aliexpress.com/item/CJMCU-MICS-6814-Air-Quality-CO-VOC-NH3-Nitrogen-Oxygen-Gas-Sensor/32762216430.html

It's main and only sensor component is MICS-6814: https://www.mouser.fi/datasheet/2/18/1143_Datasheet-MiCS-6814-rev-8-1144828.pdf

Using clone Mega2560 and reading values through serial monitor. Using old ATX-PSU as a power supply, stripped one IDE-power connector to get +12V, +5V and grounds. Expecting to ground to be common on PSU side, so didn't wire them together on prototyping board.

I'm having very hard time trying to find anyone who has wired this particular model to Arduino boards and supplied photos of working configuration to the internet. Mostly I can find information about Grove-boards with I2C-communication (and their inbuilt weaknesses). Found some comments saying: "Just wire it up, you silly!", meaning connecting adapter's gas-labeled pins straight to Arduino's analog ports and power up the board.

So tried to wire it like that (attached picture, point 1.), but only input I got on analog ports was just noise on level about 20/1024, (0.05V). Could not get sensor to react to tobacco smoke, gas stove nor alcohol.

Next I found this project: http://kstobbe.dk/2019/02/16/esp32-pms5003-bme280-mics6814-sensor-build/
, which uses exactly same adapter board, but with 3.3V ESP32-board. His schematic includes pull up resistors for analog lines:

, so I gave it a shot and included 47kOhm pull ups to every gas channel (attached picture, point 2.). Now I got readings which made sense and 2 out of 3 sensors reacted to alcohol as expected. Clean air readings were about CO:950/1024, NH3: 900/1024 and NO2 200/1024.

Anyway, I was still unsure if I'm using the sensor the right way, so read these documents: https://www.cdiweb.com/datasheets/e2v/Load%20resistance%20for%20MiCS%20sensors%20measurements.pdf
https://www.cdiweb.com/datasheets/e2v/AN172_Useandperform.pdf

According to those, I should (?) try to set basic level of readings to VCC/2, so I tweaked with pull up resistors a bit and changed CO-pull up to 680kOhm, NH3-pull up to 470kOhm and NO2-pull up to 20kOhm to get all the channels' analog input near 500/1024.

I used Nis Wechselberg's MICS-6814-I2C-library and stripped all the I2C-parts off to get easy start on conversions and calibration (this modified source attached). I got readings like NH3:1ppm, CO:5ppm and NO2:0.15ppm. NH3- and CO-sensors react to alcohol (60% et.) well: analog read diving to 50/1024 and ppm going up to 300, so good reaction on these. Anyhow NO2 value reacts a bit to alcohol (falls to 0.1ppm, shouldn't), but not at all to nearby gas stove (below 20cm) nor daily fluctuation due city traffic (which should make figures double on heavy traffic hours, but still should be well below 0.1ppm at most.) Done pre-heating for few days now.

Datasheet tells me to resize pull down (load) resistors to make analog input = VCC/2 on normal level, but I can't figure out how to do it with this adapter board, so had to go with pull up -option. I tried to look at components of the adapter board and found three resistors: 27 Ohm, 120 Ohm and 820 Ohm, which most certainly are heaters' resistors. Then there's two small yellow SMD-components which I can't identify, but I guess they are capacitors (of unknown value). I'm pretty sure there's no load resistors on board to read values on analog inputs straight out-of-the-box.

Questions:
1) Is pull up resistors the way to go with this adapter? Or should I just wire it differently?
2) Are the pull up resistors' values reasonable now or should I go back to 47-100kOhm which allowed more "space", since expected reaction was analog input to fall on those which were high and to rise on NO2, which was low?
3) Any ideas what's up with the NO2-sensor? How to make sure it works? What figures I should expect nearby gas stove (or other obtainable source)?

davidsuzuki256

Tested the sensor with the code and schematic. Connected 47k to 3 gases and 5v rather than 3v. The results seem to reflect well to CO. Have not tested NO2 and NH3.

sulochanaU

I need the help you both. I am using the same module with Arduino UNO. Wired without any resistors. Output channels are directly connected to the analog inputs on the uno board. I always having nearly 0 value from the CO channel and around 10 for NO2 channel.


paragbonde

hi friends

i used the same software.


i connect 47k resistors to 5v for all 3 gases.

i use 500 ppm CO gas but its shows only 10 to 13 ppm ..

what will be the issue?/

mortenx

i use arduno mega ,connect 47k resistors to 5v for all 3 gases. (MICS-6814 CO/NH3/NO2-sensor)
analogread() in clean air is
CO 933/1024
NO2 208/1024
NH3 877/1024

how to convert this results to ppm?

i use liquid 10% ammonia  to generate NH3 , i put one drop ammonia to 4 litre close box and
  readings are going down to
CO  820/1024
NO2  130/1024
 NH3 450/1024

maxNr2

Hello,

I just start with these topic, but I guess the solution could be as follows (please correct if I'm wrong)

For converting in ppm you have to get the value of Ro (if you don't have a defined atmosphere with a kown concentration,  measuring in clean air may work too? Just a guess, maybe there are better ways).

The voltage at the analog input-pin of the arduino can be derived from the result of analogread() in this way:
1024 corresponds to 5V    ==>   (value-of-analogread() / 1024 )* 5v = the measured voltage. Can be checked ba a ordinary multimeter.

The added 47k resistors and the sensor form a voltage divider. You can calculate the resistance of the sensor by the formula of voltage dividers. Here:
(measured voltage) / 5v = Rs / (Rs + 47k) ==> Rs = (47k * (measured voltage) ) / (5v - (measured voltage) ). With the ratio Rs/Ro you can get the ppm-value from the diagram in the datasheet.
 
The lower values you got at higher NH3 concentration match the datasheet, where in the digrams the Rs/Ro-value decreses with increasing NH3-concentration too.

Did you wait a while for heating? At winsen-sensor.com they suggest for their MEMS-gas-sensors in the datasheets a preheating time for "no less than 48 hours" for a storage time of less than one month, no less than 72 hours for up to 6 months and no less than 168 hours for a storage time of more than 6 months. But I don't know wether this is recommended for the MiCS-6814 too.
 
But I wonder about the CO-curve in the datasheet anyway: clean air contains about 0.1 ppm CO. What is the sensor's output in such an atmosphere? Does anyone know wether an interpolation of the curve permitted, ie about Rs/Ro=30 @ CO=0,1 ppm?

My first measurments with the MiCS-6814 on the purple CJMCU6814-adapter-board with 47k to 5v give me, when used in a (I guess) pure CO2-atmosphere, about 4V at the analog pin ==>  Rs = 188k,
But this doesn't match to the datasheet, where R0 = 100k ... 1500k.  Because if Rs/Ro = 30 or even higher because of there's no CO, Rs should be in the range of 3000 k ... 45000k, and that's nonsense. Does anyone see the mistake in this consideration?
Thanks!
   

mortenx

how can humidity calibration factor can be considered

ZingPow

My initial attempt at using this was to go directly from the CO/NO2/NH3 pins to a bit leveler to go from 5.5 to 3.3 and then to a ADS1115 connected to a Raspberry Pi and then use the voltages to get the RL/R0 ratio and then use that with the equations to get the ppm (after doing a long term calibration in fresh air to calculate the fresh air values, ie the max voltage or ADC steps). (sample output show in attached image) which does show some variation over the test time consistent with the two CJMCU-6814 I was testing (values shown are ADS1115 steps).  I wasn't using any pull up resistors which I'm now worried might have damaged the sensors.

What is the correct way to use the CJMCU-6814?  Are 47K 5.5v pull up resistors the correct way to hook this up or what?

feu

#8
May 14, 2020, 11:23 pm Last Edit: Jul 07, 2020, 06:49 pm by feu Reason: adding schematics
Hi there,

Things I learned about the MICS-6814 and CJMCU-6814 (please note that I'm no expert and I may be wrong):

- MICS-6814 can measure up to 10 different gases, but the CJMCU-6814 (purple board that includes MICS-6814) only allows 3 gases to be detected, each one directly in a different analog output - which means NOT using I2C;

- there are other boards which include the MICS-6814 which use I2C and thus allow support for the 10 gases, but it's not the case with the purple CJMCU-6814;

- the datasheet (link below) states that this sensor is not meant to get exact values for the gases proportions in the air (ppm), it's meant only for relative use. Examples: now the air has 10% more CO than 10 minutes ago; Yesterday there was 20% less CO in the air;

- in order to be able to relatively detect the changes, you must calibrate the sensor by using a certain amount of resistance, which you will have to find out in your own environment (it will be different on the top of a mountain, by the beach or in a big polluted city) - and that for each analog output or gas; It really doesn't make much sense to use it without calibrating, reason below;

- the datasheet states that you should measure voltage between the sensor and ground - but like others, I couldn't make it work that way. You need to pull it up. By pulling it up (adding a resistor between the analog output of the sensor and Vcc), you get the opposite values of what the datasheet describes: in the datasheet, it says the more gas, the lesser resistance and thus, greater voltage. However, by pulling it up, it inverts that and you start having voltage drop when you detect an increase of the gas concentration;

- the sensor must warm up, in the datasheet the example shows that even after 120 minutes the sensor was still heating up;

- and which resistor value should I use, then? the datasheet says that the best resolution is achieved by using the midrange voltage. So as the sensor uses 5V, midrange is 2.5V, So, you pull up the analog output, and measure its value. You must increase or decrease the resistor value until you get the midrange voltage (2.5V). THAT'S WHY in the datasheet it is suggested to use a 820 ohm resistor in series with a potentiometer (I'm using a Trimmer pot for each gas);

- the datasheet suggests a 820 ohm resistor so that even if the potentiometer (trimpot) is zeroed, you would still have a small resistor, thus not damaging your sensor; however, I believe it only gets damaged if it stays in use without resistors for a long time;

- for CO, I'm using a 1M ohm resistor in series with a 1M trimmer pot;
- for NH3, I'm using a 1K ohm resistor in series with a 500K trimmer pot;
- for NO2, I'm using a 1K ohm resistor in series with a 100K trimmer pot;
- that way I was able to calibrate it to 2.5V each;

- after "calibrated", you'll get the variations quite quickly (that's a good thing about it, it reacts quite fast). So, if you were at 2.5V (and using a pull up), and voltage went down to 2.0V, then you have 20% more of that gas;

- in the code sample below, I initialized it using pinMode(SENSOR_PIN, INPUT), which means I didn't use INPUT_PULLUP;

- the readings fluctuate quite a lot, so you better make an average of the last X readings;

Hope this is correct and help others trying to use this board.

Cheers,
Feu.

datasheet:
https://www.cdiweb.com/datasheets/e2v/load%20resistance%20for%20mics%20sensors%20measurements.pdf

other interesting documents:
https://cdn-learn.adafruit.com/downloads/pdf/adafruit-mics5524-gas-sensor-breakout.pdf
https://cdn-shop.adafruit.com/product-files/3199/MiCS-5524.pdf

Code: [Select]

#include <Arduino.h>

const float max_volts = 5.0;
const float max_analog_steps = 1023.0;
  
void setup() {
  Serial.begin(9600);
  delay(1000);
  Serial.println("Setup initializing");

  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
}

void loop() {
  int a0_read = analogRead(A0);
  int a1_read = analogRead(A1);
  int a2_read = analogRead(A2);

  Serial.print("Latest reading in volts, CO (a0): ");
  Serial.print(a0_read * (max_volts / max_analog_steps));
  Serial.print(" NH3 (a1): ");
  Serial.print(a1_read * (max_volts / max_analog_steps));
  Serial.print(" NO2 (a2): ");
  Serial.print(a2_read * (max_volts / max_analog_steps));
  Serial.println("");

  delay(200);
}



calvinf76

Feu,

Thanks for your update. Very useful info...

anyway know how to convert the voltage received to ppm?

Thanks in advance.

feu

Hi Calvinf76,

Unfortunately that's not possible using only this sensor.

From the datasheet:

SGX semiconductor gas sensors are well suited for leak detection and applications
requiring limited accuracy. Their use for absolute gas concentration detection is more
complicated because they typically require temperature compensation, calibration, and
sometimes as well, humidity compensation.

Cheers,
Feu


oldblackcrow

Hi y'all! I just purchased this sensor as well and found the support lacking horribly from anywhere, except here. So, thank you very much for the information y'all provided!

Anyway... I'm building a TOS Tricorder with a Raspberry Pi Zero W in the main body and the Adafruit ItsyBitsy nRF52840 Express with Bluetooth LE in the hand-held part that will *hopefully* connect with the MICS 6814.

I'm a bit disappointed that the sensor info states it can read 8 gases, but the breakout only has 3 outputs.

My question is, would the ItsyBitsy nRF52840 have enough power (it does have a 5v pin) for both the sensor and the bluetooth that it needs to communicate with the Pi? Also, how sensitive is the resistance? I have 50k resistors... would that affect the accuracy?

Again, thanks so much everyone!

oldblackcrow

I connected everything up minus the trim pots and did get data on my ItsyBitsy board. Very nice! Then I removed the 1M ohm and the two 100k ohm resistors and the data numbers increased significantly.

Again, I need to minimize hardware since the handheld case is so small.

Just wondering how that affects the data.

Go Up