HTU21D | HTU21D Temperature/Humidity driver for I2C
kandi X-RAY | HTU21D Summary
kandi X-RAY | HTU21D Summary
Use the [HTU21D] temperature and humidity sensor on the Raspberry Pi.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Read current temperature .
- Return the humidity of the bus .
- Initialize SMBus instance
- Reset the device .
HTU21D Key Features
HTU21D Examples and Code Snippets
Community Discussions
Trending Discussions on HTU21D
QUESTION
There is:
- Arduino or Esp8266
- 8 port expanders MCP23017
- 8 HTU21D humidity sensors with I2C interface.
Port expanders have the ability to change the address on the I2C bus using jumpers A0-A2. Humidity sensors do not have such functionality, they have the same address. Is it possible to connect humidity sensors with I2C interface to the port expander via GPIO and programmatically implement the I2C bus.
From the microcontroller, I need to access the humidity sensor data through the port expander. How to implement this?
...ANSWER
Answered 2019-Nov-15 at 04:18I wouldn't recommend using the I2C GPIO port expander to implement the i2c protocol for below reasons:
- First, since the port expander is already operating on i2c frequency, the I2C protocol via bit-banging the GPIO pins of the port expander will be slower or there might be unforeseen timing issues.
- Implementing the i2c protocol might turn out to be a little tricky/risky. For instance, you might need to implement the clock-stretching feature in your software i2c.
I would recommend using the i2c bus switch http://www.ti.com/lit/ds/symlink/tca9545a.pdf which is a lot simple to use and multiplexes a single i2c bus between 4 i2c devices and the devices can have the same or different i2c slave addresses. The switch itself has a configurable i2c address (so multiple of them can be used). The required channel can be enabled by sending i2c data to the switch address. Then the subsequent i2c communication with the desired device will happen via the enabled channel.
QUESTION
I wrote a Spring Boot app and I'd like to expose custom metrics to Prometheus with Micrometer. Here's a code snippet where I'm incrementing a counter (which works) and attempts to set a couple of gauges (which doesn't work):
...ANSWER
Answered 2019-Jul-31 at 15:34The objects that you are using are getting garbage collected since noting is holding onto a reference of those values. Gauges use weak references by default.
If you set it to use strong references it should avoid the NaN
s. Unfortunately the global registry helpers don't expose the gauge builder so you'll need to create the gauge a little differently.
QUESTION
I write VB.NET class for implement CH341DLL.DLL functionality. The method CH341StreamI2C() is used for stream write and read into device. This way I've imported the method CH341StreamI2C() from DLL:
...ANSWER
Answered 2018-Sep-09 at 15:41If this is what you're using, the original declaration is:
QUESTION
I'm building a custom HVAC controller. Among other things, it will have temperature sensors in multiple locations. The problem is, at any given instant, the sensors all have slightly different opinions about the current air temperature.
For example, right now, I'm getting the following readings (all sensors are in the same spot):
- 75.4F (SHT11)
- 77.0F (HTU21d)
- 77.7F (BME280)
- 76.1F (DS18B20)
- 76.1F (DS18B20)
- 76.5F (DS18B20)
- 75.7F (DS18B20)
Once I've collected a few sets of simultaneous readings with those sensors in various locations (say, inside the freezer, inside the refrigerator, on my desk in an air-conditioned room, and outside in the shade) to see how their individual opinions differ when measuring (more or less) the same ambient air temperatures, I need to somehow come up with an algorithm to normalize their individual readings to some reasonably consistent consensus temperature.
In this case, the "real" temperature is "whatever consensus temperature seems to have the best linear agreement among all the sensors".
Now, the big question... how do I do this?
I'll be implementing this using C++ (on an Arduino, but at this point it's purely a "C++ and algorithm" problem, not a hardware problem).
...ANSWER
Answered 2018-Jun-19 at 20:47There are several ways to find a "consensus"
the simplest 2:
- simple average (sum up all temps and divide by number of sensors) [will srew up, if you have a strong outlier]
- median (sort and then take the value in the middle)
for more check out https://en.wikipedia.org/wiki/Median#Other_median-related_concepts
for your stated "best linear agreement" => this is just the simple average. But i'd recommend the median - in my experience this was usually the better choice, since its a bit more resiliant to outliers.
QUESTION
I've followed this guide to access two C native methods, but when I call
...ANSWER
Answered 2018-Mar-20 at 12:19Just a long shot: I have had similar problems trying to load a 64-bit compiled native library with a 32-bit java virtual machine. You should make sure that both are 64-bit (or 32-bit if it fits better your needs).
In any other case, I would have a second look at the library paths.
QUESTION
I created a quick & dirty prototype in Python that reads temperature/humidity from an HTU21D sensor sensor that's connected to an Intel Edison. I'm trying to rewrite the Python prototype in Java. Unfortunately, the values being returned for temperature/humidity in Java are zero.
The code is posted on Github: https://github.com/alexwoolford/htu21d_logger. Under the covers, both Python and Java versions are using upm/mraa.
Here's the Java code to read from the sensor:
...ANSWER
Answered 2017-May-26 at 15:24The HTU21D Java example code was missing the following call:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install HTU21D
You can use HTU21D like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page