Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect the sensor properly #54

Open
vinzenzwolf1 opened this issue Apr 28, 2023 · 5 comments
Open

Cannot connect the sensor properly #54

vinzenzwolf1 opened this issue Apr 28, 2023 · 5 comments

Comments

@vinzenzwolf1
Copy link

I used an Arduino Micro and just used your example code and connected the sensor like this:

  • 5V (Arduino) to Vin (MH-Z19B)
  • GND to GND
  • Rx (Arduino) to Tx (MH-Z19B)
  • Tx (Arduino) to Rx (MH-z19B)

Unfortunately, I got this Error:
image

I changed the value of the rx_pin and tx_pin like this:
#define RX_PIN 10
#define TX_PIN 11

When I look at the Sensor, I can see the IR light turning on every 2 seconds or so. On the arduino, the tx light flashes on and of, but the rx light is permanentely of.

What can I do?

@WifWaf
Copy link
Owner

WifWaf commented Apr 28, 2023

I'm not sure which Arduino Micro board you are using, however some versions operate at 3.3V, so there could be a serial voltage compatibility issue.

To be honest, I'm not that familiar with the Arduino Micro ... however, I think you can use Serial1 and the respective pins instead - have you tried this?

@vinzenzwolf1
Copy link
Author

The Arduino Micro has a 5V Port, I used that one.
90D016D4-4185-4243-B3E4-56001FC44DB8

The operating voltage of my arduino is 3 Volts.

Sorry, which port should I try?

@WifWaf
Copy link
Owner

WifWaf commented Apr 29, 2023

If the operating voltage is 3V, then the serial port might also be using 3V. Try using the 3.3V to power the MHZ19 instead of the 5V.

Serial1 is a pre-defined serial instance, you can pass it to the library just like you can pass the software serial instance. You'll have to read up on it as I don't know much about the Micro, however, try using the 3.3V to power the MHZ19 first.

@vinzenzwolf1
Copy link
Author

I tried using the 3V port, but unfortunately it wasn't successfull. After some research I found out about the same as you told me (to change to Serial1). As I'm new into microcontroller and in general C++ I need to make some research on Serial ports to understand the general idea. Thanks a lot for the hints! I'll keep you updated!

@WifWaf
Copy link
Owner

WifWaf commented May 1, 2023

No problem.

The Serial1 type of definitions are not very self-explanatory and also inconsistent between MCU (as each has its own unique Arduino framework). Best of luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants