Customer:
I’m trying to interface an MQ131 ozone sensor with easyC to a proprietary embedded microcontroller board. I understand the board has an Atmel processor implementing I2C, but I cannot find documentation on the register space or I2C commands needed to read the sensor.
I’ve looked at the Arduino code repository and the code for MQ131 appears to use the Arduino internal ADC rather than the easyC interface. Since our platform is proprietary and does not use Arduino, I need information about how to use the I2C interface directly to read this sensor.
Originally submitted via email support on 2 April 2025. Migrated to the forum for community visibility.
Soldered Support:
The ATMEGA chip on the board runs this firmware: Soldered-MQ-Gas-Sensor-Arduino-Library/extras/attiny_firmware at dev · SolderedElectronics/Soldered-MQ-Gas-Sensor-Arduino-Library · GitHub
The firmware packs two bytes from the AnalogRead (analog read from the sensor itself). When reading the bytes, note the order when unpacking the analogRead value.
We’ve created this example in the library for MQ131: https://github.com/SolderedElectronics/Soldered-MQ-Gas-Sensor-Arduino-Library/blob/dev/examples/easyC/MQ-131-ALL-easyC/MQ-131-ALL-easyC.ino
You can see in the driver what these functions do. Keep in mind that (native) will be False for the easyC version (native means the regular version where the microcontroller reads from the sensor directly without the attiny middleman).
Internally the library uses the MQUnifiedSensor library: Soldered-MQ-Gas-Sensor-Arduino-Library/src/libs/MQUnifiedsensor/src/MQUnifiedsensor.cpp at main · SolderedElectronics/Soldered-MQ-Gas-Sensor-Arduino-Library · GitHub
Attachment omitted in migration: image.png