sciosense / ens160_driver Goto Github PK
View Code? Open in Web Editor NEWDriver for the ScioSense ENS160 digital gas sensor
License: MIT License
Driver for the ScioSense ENS160 digital gas sensor
License: MIT License
Hi all,
is there any implementation of the ENS160 driver for circuitpython/ micropython planned?
Thanks in advance!
in the example code ens160_dev_shield.ino
, why is there an offset of 500 for the tVOC readings and 400 for the eCO2?
if (new_TVOC < 500) new_TVOC = 0;
else if (new_TVOC > 5000) new_TVOC = 5000;
else new_TVOC = new_TVOC - 500;
new_eCO2 = (uint16_t)ens160.geteCO2();
if (new_eCO2 < 400) new_eCO2 = 400;
else if (new_eCO2 > 5000) new_eCO2 = 5000;
I downloaded the library files to work with a ScioSense devkit, containing ENS160+ENS210.
The lib had a bunch of compile errors, so I reversed some of the recent changed to the ScioSense_ENS160.cpp file, and now it works:
149 - result = this->write8(_slaveaddr, ENS160_REG_COMMAND, ENS160_COMMAND_GETVER);
149 + result = this->write8(_slaveaddr, ENS160_REG_COMMAND, ENS160_COMMAND_GET_APPVER);
251 - bool ScioSense_ENS160::measure()
251 + bool ScioSense_ENS160::measure(bool waitForNew)
275 - this->read(_slaveaddr, ENS160_REG_DATA_IAQ, i2cbuf, 7);
275 + this->read(_slaveaddr, ENS160_REG_DATA_AQI, i2cbuf, 7);
I do not wish to commit this code, because I'm new to the code, so I not confident that I havn't fucked something up somewhere else... But like this, the library works for me.
There is a function to retrieve AQI500, but I'm at a loss as to what it refers to, and the old datasheet I have doesn't mention it.
The code indicates it's only for hardware revisions greater than zero: https://github.com/sciosense/ENS160_driver/blob/master/src/ScioSense_ENS160.cpp#L290
Can the code be documented, and the latest datasheet supplied?
This was my reference:
https://www.sciosense.com/wp-content/uploads/documents/SC-001224-DS-9-ENS160-Datasheet.pdf
When using the device in a system that has I2C wire previously defined; then an instantiator [ begin() ] that uses that existing definition instead of trying to define its own wire port.
The use case: I have 'SmartCitizen' SAMD21G system that has two I2C channels defined; one of which has I2C Mux (TCA9458A) connected; and the ENS160 + ENS210 are connected to one channel.
The operation mode calls for switching one the appropriate Mux Channel before communicating with the ENS devices.
It is simply unnecessary for the ENS160 library to carry on making its own wire definition. I do not want to have to support that.
Its not the business of the library that supports VOC measurement to manage I2C.
Therefore my request is to add support for the predefined Wire such as begin( uint8_t deviceAddress, TwoWire *Wire).
I will add such function to my copy of the library; but would like you to add it to the master.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.