Customer:
I’m working on a project using the MQ7 sensor with breakout board and easyC connector. I’ve been unable to find a library for this sensor or documentation on how to read values from it through the easyC connector. Is there an existing library or instructions on how to integrate this sensor using the easyC connector?
Originally submitted via email support on 27 March 2024. Migrated to the forum for community visibility.
Customer:
I’m having difficulty with the provided code. The library refuses to define ADC_RES and VOLTAGE_RES, and when I hard code these values, there are problems that cascade into MQUnifiedsensor.h and beyond. This sensor should be compatible with the Arduino Uno R4 WiFi since it’s equipped with an ESP32, correct? It seems it is not recognizing this and defining these values in the MQ-Sensor-SOLDERED.h. I’ve tested the code straight from git and am unable to get the library to run properly.
Attachment omitted in migration: image.png
Soldered Support:
We’ve received another report regarding the MQ library and will be testing these issues so that the examples work for you.
Soldered Support:
We have compile tests set up for all our libraries on GitHub at https://github.com/SolderedElectronics/Soldered-MQ-Gas-Sensor-Arduino-Library/actions/runs/ /job/ and they should compile fine. Check the dev branch of the library.
Did you install the library correctly in Arduino/Libraries the same way as other libraries? An incorrect library install could be causing errors like this.
Customer:
I’ve reinstalled the libraries for both the Arduino IDE and Arduino Cloud platform and believe I’ve installed them correctly. I also installed the proper 2.0.1 version of the MQUnifiedsensor library in addition to the Soldered library. I’ve continued to receive the same errors. If this runs properly for you with an Arduino Uno R4 WiFi, then please let me know if this is an issue on my end.
Attachment omitted in migration: Screenshot 2024-04-03 at 10.38.22 PM.png
Attachment omitted in migration: Screenshot 2024-04-03 at 10.40.23 PM.png
Soldered Support:
There may be a conflict between our library and MQUnifiedsensor as they might use some of the same-named files, which can confuse the Arduino compiler. Could you try compiling with the MQUnifiedsensor library uninstalled?
Customer:
I’ve tried with the MQUnifiedsensor library uninstalled and this still results in the same compiling error. Is it possible to use a command to define the board that I am using as operating on ESP32 to ensure VOLTAGE_RES and ADC_RES are defined properly?
Soldered Support:
Modifying #defines is tricky because Arduino doesn’t load defines from the actual .ino file to be then usable in other files. You would have to put the #define in the actual library files. Try adding #define ESP32 in the beginning of our library files.
I can do some tests for you with Arduino Uno R4 WiFi and tell you what worked for me if you give me a bit of time.
Soldered Support:
I just compiled the MQ7 for Arduino Uno R4 WiFi and it worked on the first try, so I unfortunately can’t seem to replicate the issue. I would start with a clean Arduino 1.8.x install and just the Soldered MQ library.