How to Fix "Failed to Read Sensor: OSError" on Arduino Nano 33 BLE Sense with MicroPython?
Hey guys am developing an air quality monitoring system using an
Arduino Nano 33 BLE Sense
, MicroPython, and a CCS811
gas sensor. The system will use a TinyML
model to predict air quality index (AQI
) based on sensor data. I have set up the flash MicroPython firmware on the Arduino Nano 33 BLE Sense, connected the CJMCU-8128
module to the Arduino (I2C
pins: SDA
to A4
, SCL
to A5
), also connected the OLED
display to the Arduino using I2C
.
But am getting the error
Failed to read sensor: OSError
Here's my code
Solution:Jump to solution
Thanks @RED HAT o checked if my sensor was initialized using the script you sent and it was but I after I changed the frequency to 100kHz it started working properly 👍, thanks once again
3 Replies
@Enthernet Code Sometimes, sensors might not be initialized correctly if their addresses are not detected. You can use an
I2C
scanner script to check if the sensors are detected on the I2C
bus. Try this I2C
scanner script:
Also, ensure that the I2C
bus speed is compatible with your sensors. You might need to set the I2C
frequency when initializing the I2C
bus. Try setting the frequency to 100kHz:
Solution
Thanks @RED HAT o checked if my sensor was initialized using the script you sent and it was but I after I changed the frequency to 100kHz it started working properly 👍, thanks once again