@Ed1500 I am connecting the Arduino via USB port
Posts made by douma rahma
-
RE: MH-Z19 with Arduino R3 0 outputValue
-
RE: MH-Z19 with Arduino R3 0 outputValue
@Ed1500 Thank you for your response I will try it. Are you using PWM or not?
-
MH-Z19 with Arduino R3 0 outputValue
Hi,
I am using this code to get C02 value. But always I get this result (CRC 0/0) even after waiting more than 3 min for the healing process.#include <SoftwareSerial.h>; SoftwareSerial mySerial(A0, A1); // A0 - к TX сенсора, A1 - к RX byte cmd[9] = {0xFF,0x01,0x86,0x00,0x00,0x00,0x00,0x00,0x79}; unsigned char response[9]; void setup() { Serial.begin(9600); mySerial.begin(9600); } void loop() { mySerial.write(cmd, 9); memset(response, 0, 9); mySerial.readBytes(response, 9); int i; byte crc = 0; for (i = 1; i < 8; i++) crc+=response[i]; crc = 255 - crc; crc++; if ( !(response[0] == 0xFF && response[1] == 0x86 && response[8] == crc) ) { Serial.println("CRC error: " + String(crc) + " / "+ String(response[8])); } else { unsigned int responseHigh = (unsigned int) response[2]; unsigned int responseLow = (unsigned int) response[3]; unsigned int ppm = (256*responseHigh) + responseLow; Serial.println(ppm); } delay(10000); }
I used the sensor directly without any calibration. Another note, why I can only use 3.3V, the 5v make my Arduino card shutdown