adafruit / adafruit_sensor Goto Github PK
View Code? Open in Web Editor NEWCommon sensor library
License: Apache License 2.0
Common sensor library
License: Apache License 2.0
Hi I just spent half a day pondering upon the fact that BNO055 can be used along with this library only to obtain orientation and not the accelerometer values.
I was aiming to use the event method to use event.orientation
for Roll, Pitch, Yaw and event.acceleration
to obtain linear accerleration in X, Y, Z directions but if I use the code I get the same values for event.acceleration
and event.orientation
SE Query supporting this Issue created by Me
Looking for some discussion on the same.
Hello,
I'm trying to play with samples scripts and meet troubles while compilation.
My env : OS: OpenBSD 6.1 with arduino package.
My Board is a Arduino MEGA 2560.
The sample script is the one available with Adafruit_FXAS21002C driver.
The make stop with this message :
make: don't know how to make Adafruit_Sensor.o (prerequisite of: applet/core.a)
I tried other libs like Servo without issues.
Note : I'm note using Arduino IDE (not available)
Thank's for your help
Bruno.
Hello!
I love the idea of this type of abstraction library and it looks like it has a lot of great things going for it. I'm a little confused at the moment about certain things.
And to event.LIGHT() would call it instead
The reason is, what if I have sensors that aren't on this list? What if I have multiples of one sensor? Sure I could easily modify this library to accommodate that but shouldn't an abstraction library not need to be updated per application?
I am sure this has a large part to do with the SIs but that seems more like something that needs to be a convention for people writing the drivers. It can't really be enforced by explicitly naming the sensors.
Anyway, I'm really glad there's some people thinking about this. Maybe my desires for a library are a little different then what this library intends on having here.
Another thing I am interested in is decoupling getEvent() into: startEvent(), getEventRaw() and getEvent(). This would be useful so that a microcontroller could launch many sensor conversion in a series without waiting to hear back from them. Data could be transmitted in raw form offloading the parsing to SI to another system. getEvent() could still be there for those who just want the parsed form as soon as it can be available.
Both are needed for water testing.
This is a ticket for the pull request for NOX/VOC index.
What is Sensirion’s NOx Index?
What is Sensirion’s VOC Index?
Meant to support the Sensirion SEN55/SEN54, but may also be useful for the BME680
There is a mixup of using sensor Resolution vs. Accuracy.
The AHT10 sensor reports the following:
Adafruit AHT10 test!
AHT10 Found!
------------------------------------
Sensor: AHT10_T
Type: Ambient Temp (C)
Driver Ver: 1
Unique ID: 257
Min Value: -40.00
Max Value: 85.00
Resolution: 0.30
------------------------------------
------------------------------------
Sensor: AHT10_H
Type: Relative Humidity (%)
Driver Ver: 1
Unique ID: 256
Min Value: 0.00
Max Value: 100.00
Resolution: 2.00
------------------------------------
The AHT10 temperature resolution is 0.01C but its overall accuracy is +/- 0.30 C.
The same goes for RH.
What is expected of sensor to enter as "resolution" parameter?
I gather that is not made clear, and causes this mixup.
(i'll enter also ticket in AHT1x library about this; these Adafruit libraries should agree on how to use this)
Arduino: 1.8.7 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Enabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
In file included from C:\Users\shalinee mishra\Documents\Arduino\libraries\Adafruit_IO_Arduino\src/wifi/AdafruitIO_ESP8266.h:18:0,
from C:\Users\shalinee mishra\Documents\Arduino\libraries\Adafruit_IO_Arduino\src/AdafruitIO_WiFi.h:32,
from C:\Users\SHALIN~1\AppData\Local\Temp\arduino_modified_sketch_178491\adafruitio_15_temp_humidity.ino:26:
C:\Users\shalinee mishra\Documents\Arduino\libraries\Adafruit_IO_Arduino\src/AdafruitIO.h:23:31: fatal error: ArduinoHttpClient.h: No such file or directory
#include "ArduinoHttpClient.h"
^
compilation terminated.
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hi, I was wondering how to implement the interface toward a power/energy meter that gives me reading in W/Wh respectively. Thanks
sensors_type_t has no power/energy constant. I wonder if it's "by design" or it's only a matter of defining a new enum value
The repository doesn't have a LICENSE or COPYING file, which license is the library distributed under?
If it's up for a vote, I'd suggest MIT or some other permissive license.
Arduino: 1.8.9 (Mac OS X), Board: "Arduino Ethernet"
Multiple libraries were found for "Adafruit_Sensor.h"
Used: /Users/imac/Documents/Arduino/libraries/Adafruit_Sensor
Not used: /Users/imac/Documents/Arduino/libraries/Adafruit_Unified_Sensor
sensortest:3:30: error: Adafruit_ADXL343.h: No such file or directory
compilation terminated.
exit status 1
Adafruit_ADXL343.h: No such file or directory
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hi! This library is very nice! But an event can't contain multiple values (because it is an union) neither the interface offers a way to provide them. I was checking some libraries for sensors to see how do you deal with that and I saw the following:
In DHT you handle this doing dht.temperature().getSensor(&sensor);
And in BMP183 you get the event and then bmp.getTemperature();
As you can see you handle this by two different ways and I think that a normalized way to do this would be great. I am doing a library that needs sensors as much generic as possible and at this moment I can't use sensors as "generic" sensor when the sensor provides multiple values.
Thank you!
I am unable to compile, as it is looking for that file. Does it expect the file to be in the library, or as part of a base path?
I am using the esptool programmer, and targeting the generic esp8266 board.
Currently, there is no support for Load cell or weight sensors in the Sensor type and standardized SI values. Is there a plan to add support or open to contributing to add support?
I am looking to add support for NAU7802 to wippersnapper
Hello
i'm beginer in arduino and don't know how to fix this error
thanx
Arduino: 1.6.7 Hourly Build 2015/11/04 11:34 (Windows 7), Board: "Arduino/Genuino Uno"
In file included from C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.cpp:1:0:
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:75:5: error: 'int8_t' does not name a type
int8_t status;
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:76:5: error: 'uint8_t' does not name a type
uint8_t reserved[3];
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:90:5: error: 'uint32_t' does not name a type
uint32_t rgba; /**< 24-bit RGBA value */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:97:5: error: 'int32_t' does not name a type
int32_t version; /**< must be sizeof(struct sensors_event_t) */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:98:5: error: 'int32_t' does not name a type
int32_t sensor_id; /**< unique sensor identifier */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:99:5: error: 'int32_t' does not name a type
int32_t type; /**< sensor type */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:100:5: error: 'int32_t' does not name a type
int32_t reserved0; /**< reserved */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:101:5: error: 'int32_t' does not name a type
int32_t timestamp; /**< time is in milliseconds */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:125:5: error: 'int32_t' does not name a type
int32_t version; /**< version of the hardware + driver */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:126:5: error: 'int32_t' does not name a type
int32_t sensor_id; /**< unique sensor identifier */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:127:5: error: 'int32_t' does not name a type
int32_t type; /**< this sensor's type (ex. SENSOR_TYPE_LIGHT) */
^
C:\Users\hdp-1\Documents\Arduino\libraries\Adafruit_Sensor-master\Adafruit_Sensor.h:131:5: error: 'int32_t' does not name a type
int32_t min_delay; /**< min delay in microseconds between events. zero = not a constant rate */
^
exit status 1
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Three months ago I am operating 5 mushroom growing houses without any problem. Each room has 5 ASAIR 2302 sensors. Everything worked fine on a Raspberry PI3 B +
Two days ago I switched to version 6.3.3 and the sensors no longer work.
What should I do?
Thank you
Hi,
The Adafruit BNO055 seems to have some issues with the Adafruit unified sensor library. The sensors_event_t returned seems to contain incorrect components. The acceleration, and gyro components both return the orientation data. Here is a stack exchange question that details this more.
https://arduino.stackexchange.com/questions/56937/get-accelerometer-values-from-bno055-using-adafruits-unified-sensor-library?newreg=c6a3bcfaa15e48438c38521da1a330b5
I'm not exactly sure where to put this information but I'll leave it here as well as some other places.
Here is the code that yields this problem:
#include <math.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
Adafruit_BNO055 bno = Adafruit_BNO055(55);
void setup(void)
{
Serial.begin(9600);
Serial.println("Orientation Sensor Test"); Serial.println("");
/* Initialise the sensor */
if(!bno.begin())
{
/* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1);
}
delay(1000);
bno.setExtCrystalUse(true);
}
void loop(void)
{
/* Get a new sensor event */
sensors_event_t event;
bno.getEvent(&event);
/* Display the floating point data */
Serial.print("RPY X: ");
Serial.print(event.orientation.x, 4);
Serial.print("\tY: ");
Serial.print(event.orientation.y, 4);
Serial.print("\tZ: ");
Serial.print(event.orientation.z, 4);
Serial.println("");
Serial.print("Gyro X: ");
Serial.print(event.gyro.x, 4);
Serial.print("\tY: ");
Serial.print(event.gyro.y, 4);
Serial.print("\tZ: ");
Serial.print(event.gyro.z, 4);
Serial.println("");
Serial.print("Acceleration X: ");
Serial.print(event.acceleration.x, 4);
Serial.print("\tY: ");
Serial.print(event.acceleration.y, 4);
Serial.print("\tZ: ");
Serial.print(event.acceleration.z, 4);
Serial.println("");
delay(100);
}
Thanks for your time!
Hi,
I have encountered this warning while using your library in the context of an ADXL345 sensor.
The problem could be solved in two different ways, depending on what you really want with the code.
The warning is the following:
/sketchbook/arduino/libraries/Adafruit_Unified_Sensor/Adafruit_Sensor.h:146:37: warning: unused parameter 'enabled' [-Wunused-parameter]
virtual void enableAutoRange(bool enabled) {};
The relevant code is the following:
// These must be defined by the subclass
virtual void enableAutoRange(bool enabled) {};
virtual bool getEvent(sensors_event_t*) = 0;
virtual void getSensor(sensor_t*) = 0;
The comment above the statement causing the warning implies that maybe the enableAutoRange method should be pure virtual as the other two methods below it. But that breaks the code in the sensor, because this method is not implemented there.
An easy way to avoid the warning in the case that the code should stay like this is to change the line to
virtual void enableAutoRange(bool) {}
I can do a pull request for that if this is the case. The other option has a lot of breaking potential, but could in fact be the most correct one.
Regards,
Marcelo.
We need to plot our ascent up mountains, so we need to plot altitude...
This is an issue to add an Altitude data type, in metres.
Some sensors report readings without a unit, such as a percentage or a ratio of 2 numbers.
Do you install this file the same as the drivers?
cd ..../Arduino/libraries
git clone [email protected]:adafruit/Adafruit_Sensor.git
# Restart Arduino
Add Lux sensor type. Must match the CircuitPython Design Guide for Lux readings:
lux | float | SI lux |
---|
This is likely because it requires avr/pgmspace.h, which won't exist on a non-AVR.
I am wanting to get the BNO055 to be read on this device, so I may tinker a bit.
I've noticed that this library depends on Adafruit ADXL343, which also pulls in Adafruit BusIO.
This seems rather excessive just for an example.
As a suggestion, maybe a smaller dependency could be used instead?
Hi... When I try to compile the example code "DHT_Unified_Sensor", and this error code occurs. Is that the issue happens in the library?
There is a PM2.5 sensor as part of wippersnapper, and wippersnapper have listed the following relevant supported sensor types (although the _env variants seem unimplemented):
"pm10-std"
"pm25-std"
"pm100-std"
"pm10-env"
"pm25-env"
"pm100-env"
I plan to add the Sensirion SEN55, which has particle sensing at 0.5, 1, 2.5, 4, and 10 (micron?) in particles per cm3, and for all except <0.5um there are readings in ug/m3 (SI unit?), along with Temp(c)/Humidity(%RH), a Voc index and Nox index both without units. I assume the nox and voc are irrelevant as the device doesn't offer units but an "index".
The wippersnapper adding a sensor guide says to file an issue here for unsupported sensor types.
https://learn.adafruit.com/how-to-add-a-new-component-to-adafruit-io-wippersnapper/adding-an-i2c-component-driver#:~:text=NOTE%20%2D%20If%20you%27re%20adding%20a%20sensor%20that%20does%20not%20yet%20have%20a%20predefined%20sensor_type%2C%20please%20add%20a%20new%20issue%20to%20Adafruit_Sensor.
I guess I'm filing an issue to get support for count(#)/cm3 as that seems to be the preferred SI unit. I do commonly see a converted ug/m3 so anyone's input here would be good. I'd love support for the pm05 pm10 pm25 pm40 and pm100 too.
Adafruit_Sensor/Adafruit_Sensor.h
Lines 144 to 155 in 69d2d4f
with its very generic sensor_t
typename directly clashes with
A type used in the esp_camera
system, aka a camera sensor. Using both these libraries in the same code file is not possible (but in split files it is).
Not sure if that should be fixed since changing the name breaks compatibility, but at least FYI for other people running into this error during development, as they did in our forum.
Euler angles might not be the best for various applications. Some applications prefer quaternions.
Gas resistance is proportional to the amount of VOC particles in the air, in Ohms, formatted as "{value}Ω"
Following CircuitPython's design guide:
CO2 | float | measured CO2 in ppm |
---|---|---|
eCO2 | float | equivalent/estimated CO2 in ppm (estimated |
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.