Winsen ZE25A-O3 – ozone sensor
I’m testing a new sensor from Winsen. It is ZE25a-O3 and as name promises it is ozone (O3) sensor. Last year I did some tests with ZE27, but it has to low resolution (10 ppb vs 1 ppb in ZE25a).
Sensor is small (26×19 mm) has UART interface. After being powered is in active mode, sending data frame each one second. I have written simple library (ZE27 uses the same protocol, so I had some code left after last year tests) and now I’m performing tests with sensors.
With sensor You get cable with connector, so just cut it and solder some golpins to wires. Cable has 7 wires, but only 4 are needed:
- Black – GND
- Red – Vcc
- Blue – sensor RX
- Green – sensors TX
Double check if You correctly provided powers supply and GND. Sensor does not have reverse polarity protection – it will get damaged if You make mistake.
I have soldered them to goldpin in 2.54mm raster, then used short F-F jumper wires to connect to NAM board. I dont have now photo, but now I have placed ZE27 next to ZE25a and I’m comparing readings.
I have extracted code from my messy test sketch and created Winsen-O3 library. It’s interface is not very coherent, but this is a result of rapid prototyping. Since I’m not aware any library for those sensors I think it is better to have something to start :)
OK, after You have connected sensor You can start programming. BTW, for now I suggest not connecting sensor RX. Datasheet says UART will stand only 3.0V. I assume that engineer from Winsen was thinking about generic 3.3V interface and it’s safe (for sensor) to connect RX to ESP8266, but… I’m waiting from confirmation from Winsen that sensor will stand 3.3-3.6V on its RX. Besides – we are listening only, not sending data to sensor, so no need to connect sensor RX.
Download library and place in Arduino/Library or (if you are Platformio fan) place in lib
folder of Your project. Include it with #include "winsen-o3.h"
, define object (WinsenO3 sensor;
). Next just provide RX and TX pins – in setup call sensor.begin(RX_PIN, TX_PIN);
In loop
call periodically sensor.process()
. It will read incoming frames and store readings. Library sums all values and stores in single unsigned long
variable. Call sensor.currentValue()
to get average. sensor.sampleCount()
will return how many samples were taken to calculate currentValue
. Just call sensor.restart()
to start a new measurement.
Right now, after short discussion on our Slack I think that library should be much simpler. Should just read and return last value sent by sensor. OK, that will be for 0.2 :)
So, how to use?
Get sensor: https://nettigo.pl/products/ozon-o3-sensor-winsen-ze25a
Get library v0.1 as described above: https://github.com/nettigo/winsen-o3/releases/tag/v0.1
Start building!