ENS160 air sensor will not compile

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

ENS160 air sensor will not compile

Post by jimk123 »

trying to follow this tutorial: https://learn.adafruit.com/adafruit-ens ... r?view=all for this product I bought here: https://www.adafruit.com/product/5606

The library install was not what I am used to but I followed the tutorial, downloading a zip and then using the IDE to unzip and install it , it is in the library folder as 'ENS160_driver-master' and I did relaunch the Arduino IDE after installing the library.

I am using arduino 1.8.10 and getting these errors trying to compile the sample code ens160basic_std:


C:\Users\Jim\BANNED\Documents\Arduino\libraries\ENS160_driver-master\src\ScioSense_ENS160.cpp: In member function 'void ScioSense_ENS160::_i2c_init()':

C:\Users\Jim\BANNED\Documents\Arduino\libraries\ENS160_driver-master\src\ScioSense_ENS160.cpp:347:77: error: no matching function for call to 'TwoWire::begin(uint8_t&, uint8_t&)'

if (this->_sdaPin != this->_sclPin) Wire.begin(this->_sdaPin, this->_sclPin);

^

In file included from C:\Users\Jim\BANNED\Documents\Arduino\libraries\ENS160_driver-master\src\ScioSense_ENS160.h:19:0,

from C:\Users\Jim\BANNED\Documents\Arduino\libraries\ENS160_driver-master\src\ScioSense_ENS160.cpp:11:

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:52:10: note: candidate: void TwoWire::begin()

void begin();

^~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:52:10: note: candidate expects 0 arguments, 2 provided

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:53:10: note: candidate: void TwoWire::begin(uint8_t)

void begin(uint8_t);

^~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:53:10: note: candidate expects 1 argument, 2 provided

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:54:10: note: candidate: void TwoWire::begin(int)

void begin(int);

^~~~~

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src/Wire.h:54:10: note: candidate expects 1 argument, 2 provided

Multiple libraries were found for "Wire.h"
Used: C:\Program
Multiple libraries were found for "ScioSense_ENS160.h"
Used: C:\Users\Jim\BANNED\Documents\Arduino\libraries\ENS160_driver-master
exit status 1
Error compiling for board Arduino/Genuino Uno.

User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

Re: BANNED air sensor will not compile

Post by jimk123 »

this is odd, I use the sensor name in the title but when it posted it turned it into 'banned" :(

User avatar
Franklin97355
 
Posts: 23938
Joined: Mon Apr 21, 2008 2:33 pm

Re: BANNED air sensor will not compile

Post by Franklin97355 »

Can you tell us what the word was without using the word so we can investigate? The bot does not like the word.

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: ENS160 air sensor will not compile

Post by adafruit_support_carter »

Yep, it was triggering something in the word filter. Updated that and should work OK now.

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: ENS160 air sensor will not compile

Post by adafruit_support_carter »

In response to the Arduino compile time issue:

Code: Select all

C:\Users\Jim\BANNED\Documents\Arduino\libraries\ENS160_driver-master\src\ScioSense_ENS160.cpp:347:77: error: no matching function for call to 'TwoWire::begin(uint8_t&, uint8_t&)'
That library is using a non-standard begin() call:
https://www.arduino.cc/reference/en/lan ... ire/begin/

Seems related to this issue:
https://github.com/sciosense/ENS160_driver/issues/4

User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

Re: ENS160 air sensor will not compile

Post by jimk123 »

The sensor names was ENS160

User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

Re: ENS160 air sensor will not compile

Post by jimk123 »

Adafruit, if i am reading your reply correctly it is a problem with the vendors library? In the link you provided it looks like another user reported it but the vendor has not responded.

How did adafruit test this in their tutorial?

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: ENS160 air sensor will not compile

Post by adafruit_support_carter »

It was probably tested using a different platform. Something other than an UNO.

The issue is here:
https://github.com/sciosense/ENS160_dri ... 0.cpp#L347
Specifically - the call to Wire.begin(this->_sdaPin, this->_sclPin)

That method never actually gets called, since the example uses default pins. But if a Board Support Package does not have an implementation of Wire.begin(uint8_t sda, uint8_t, scl), then it can't even build.

This should be pretty easy to fix. But it doesn't look like sciosense is responding to issues posted in the library repo. We'll likely fork that repo and fix it there. Will update back here when that's done.

If you want to fix it now, can make a simple edit to your local copy of the library file ScioSense_ENS160.cpp. Scroll down to line 346 and look for this method:

Code: Select all

void ScioSense_ENS160::_i2c_init() {
	if (this->_sdaPin != this->_sclPin) Wire.begin(this->_sdaPin, this->_sclPin);
	else Wire.begin();
}
and change it to:

Code: Select all

void ScioSense_ENS160::_i2c_init() {
	Wire.begin();
}

User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

Re: ENS160 air sensor will not compile

Post by jimk123 »

That is great customer service, thank you so much !

User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

Re: ENS160 air sensor will not compile

Post by jimk123 »

I just downloaded the latest library adafruit forked and it compiles (using the ens160basic_std example) but will not find the sensor on startup, i added a scani2c function it it seems to find the board:

19:41:22.368 -> Scanning I2C devices...
19:41:22.368 -> I2C device found at address 0x53
19:41:22.604 -> I2C devices found: 1
19:41:22.604 -> ------------------------------------------------------------
19:41:22.604 -> ENS160 - Digital air quality sensor
19:41:22.651 ->
19:41:22.651 -> Sensor readout in standard mode
19:41:22.651 ->
19:41:22.651 -> ------------------------------------------------------------
19:41:23.642 -> ENS160...failed!

thoughts ?
thanks

User avatar
adafruit_support_carter
 
Posts: 29457
Joined: Tue Nov 29, 2016 2:45 pm

Re: ENS160 air sensor will not compile

Post by adafruit_support_carter »

Did you change the sketch code to use the 0x53 address?
https://learn.adafruit.com/adafruit-ens ... ss-3127868

User avatar
jimk123
 
Posts: 708
Joined: Sun Dec 26, 2010 7:04 pm

Re: ENS160 air sensor will not compile

Post by jimk123 »

my fault , i did not see that had to be changed to use the default address of 0x53 of the sensor board. Code is working now. Also thanks for forking the ScioSense code and fixing that bug.
thank you

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”