sciosense / ens16x-arduino

Arduino library for the ENS16x digital metal-oxide multi-gas sensor family
https://www.sciosense.com/ens16x-digital-metal-oxide-multi-gas-sensor-family/
MIT License
6 stars 3 forks source link

160 basic example I2C address, IRQ #3

Closed starbrights closed 3 months ago

starbrights commented 7 months ago

Thanks for providing lib and example. Have some problems get the basic 160 example running. First I have to change I2C address from 0x52 to 0x53, than init works. (Maybe that is worth to mention in example: The I2C slave address is 0x52 (MISO/ADDR low) or 0x53 (MISO/ADDR high))

The wires in your example doesn't include an INT line - shouldn't be USE_INTERRUPT undefined?

I added a line ens160.writeCompensation(temperature, relativeHumidity); just to be sure. But ok, that might be optional.

ens160.update() give me just once an OK!?! and hence return only one time this: QI UBA: 0 RS0: 1 RS1: 1 RS2: 1 RS3: 1 I need to uncomment ens160.getTvoc() and ens160.getEco2() as it crashes the system ?!?

Can you help me debug that? The board is a combined one with AHT20 and ENS160 and runs on EP8266 D1 Mini

14:20:08.820 -> ENS160 debug -- reset status: ok 14:20:08.852 -> ENS160 debug -- PART_ID : 0x160 14:20:08.852 -> Firmware: 5.4.6

-- After reading the manual I found in section 10.1 Initial Start-up and 10.2 Warm-up. I don't see this is triggered in example.

starbrights commented 7 months ago

Reading in the previous github issues it might be that voltage drop is the issue. https://github.com/sciosense/ENS160_driver/issues/8 I found it difficult to solder some capacitor close to sensor. Will a capacitor at the 3.3V input of the board help as well?

Additional question: I am a C guy - so I am a bit lost here with C++. Tried several attempts to read/write a register - I mean read and write are public but I don't get it. Can someone please help we with an example?

TRScioSense commented 3 months ago

Please make sure you're following the datasheet recommendations. Fig 14 describes the wiring including interrupt pins. Furthermore make sure your electrical parameters stay withing the limits (table 2+3) and add a capacitor of 10µF close to VDD of the sensor (not on 3.3V input). Within the code make sure the line 12 and 13 are uncommented and the pin is accordingly assigned to your wiring

#define USE_INTERRUPT
#define INTN 2

Besides our supported library, you can implement your own functions by reading the registers as basic I²C communication