Micropython code for SEN0322 I2C Oxygen Sensor (ESP32)
I am using an ESP32 and I would like to read data from the SEN0322 sensor with Micropython. Unfortunately I am new to coding and I only know Python. SEN0322 sensor doesn't come with a micropython code for ESP32, just for C++ and Raspberry Pi Python only. Can anyone link me if there's an available library?
Thank you!
There are libraries now, and I was able to get them working with my ESP32 running Micropython, the only issue is the program only puts out 0 values. And if I read the raw data into the REPL, it also just displays 0 values.
Raw Data: b'\x00\x00\x00' Factored Data: 0.0 Oxygen Concentration: 0.00 %vol Key Register Data: 0.255 Raw Data: b'\x00\x00\x00' Factored Data: 0.0 Oxygen Concentration: 0.00 %vol Key Register Data: 0.255 Raw Data: b'\x00\x00\x00' Factored Data: 0.0 Oxygen Concentration: 0.00 %vol
It displays when scanned…the LED can be turned on with the reset button, and it communicates back and forth, so I'm not sure what my issue is. Possibly my sensor is broken or defective? I'm able to use a DHT11 sensor just fine.
Let me know if I should post the Micropython library I've tweaked to get this far. I was able to find almost workable solutions on GitHub by searching for SEN0322.
I have been working with someone on the forum at Adafruit to develop CircuitPython code for this (which should work on MicroPython just as well). We have it almost working - we are communicating with the device, but currently the issue is that the register that should contain Oxygen Data (0x10) is returning all ones (b'\xff\xff\xff') all the time, yielding an oxygen concentration reading of 283.05 lol…
Were you ever successful in getting your unit to work on MicroPython? Anybody?
Happy to share the code we have so far if anyone might be able to help with it. You'd need to be pretty good with CircuitPython/MicroPython, understand classes… unless you have a method of calling the registers in this thing that doesn't involve building classes… :)
David.Xanatos
Hi, I'm trying to get this sensor to work on a raspberry pi pico, but still haven't found a micropython library that works with this sensor. Did you get it to work?
I would really help me if you did :)