Is there any way to support the hdс1080 sensor? #6416
Replies: 1 comment
-
Posted at 2019-06-20 by AkosLukacs Shouldn't be too hard, just I guess no one has that particular sensor. Posted at 2019-06-20 by Robin Thr 2019.06.20 Please add link to product datasheet Posted at 2019-06-20 by Alexandr http://www.ti.com/lit/ds/symlink/hdc1080.pdf Posted at 2019-06-20 by DrAzzy Looks like a straightforward I2C device, creating a module for it shouldn't be particularly hard. Posted at 2019-06-20 by Robin Thr 2019.06.20 Are you able to interface at this time? (no?) e.g. As the link is to the supplier page, has the purchase been made, or are we still speculating at this point? If yes, what are the results of just trying the snippet for the common temp/humid sensor: If no, use the source and modify as needed, as @AkosLukacs points out. It appears that @drazzy and I agree, after I viewed that source. Posted at 2019-06-21 by AkosLukacs DHT11 is not the best starting point, because the HDC1080 has I2C interface, but the DHT11 has a one-wire interface. Posted at 2019-06-21 by Robin Fri 2019.06.21 Ahhh, . . . hadn't realized the interface difference. Thanks for that tidbit, @AkosLukacs Maybe the BMP280 Environment sensor code snippet would better assist here: Posted at 2019-08-22 by Alexandr
Posted at 2019-08-22 by Robin Thr 2019.08.22 Nice compact little snippet @alexandr Would you mind posting some output so that we may better visualize the solution while sampling please. Posted at 2020-10-03 by parasquid I wasn't able to get @alexandr 's code give the correct values so I tried doing it differently. I tested the sensor with an Arduino and a library for the HDC1080 and then transferred the whole shield over to the Pixl.js for testing.
It's a bit raw for now but that's how it looks like right now, ready to be done as a module. I do have a question for @gfwilliams , I had to use promises because I needed to wait a few ms for the sensor to be ready after setting the pointer for the read (otherwise I get an I2C exception). There isn't any ready pin for this sensor. Would promises be the way to go, or is there some other way to "delay" the I2C read but still maintain a somewhat sychronous flow? Edit: obligatory screenshot' Attachments: Posted at 2020-10-03 by @MaBecker @parasquid What about a callback implementation? Posted at 2020-10-03 by parasquid Callbacks are an option, but I tend to like promises more :P But still, that makes the actual call "nested" in a sense. I'm looking for a possible way to just do
and it "just works." This would be possible with async/await but from what I can see it's not yet available in Espruino (yet). If Espruino had a delay I can do away with the setTimeout and just delay for a few ms at that point and everything should work (this is actually how the Arduino libraries do it) but delay doesn't sound like the Espruino way of doing things. Posted at 2020-10-03 by @MaBecker Well there is no wait, but you can use digitalPulse instead. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2019-06-20 by Alexandr
https://ru.aliexpress.com/item/HDC1080-GY-213V-HDC1080/32831368023.html?spm=a2g0v.search0204.3.22.357d669aa7cVil&transAbTest=ae803_3&ws_ab_test=searchweb0_0%2Csearchweb201602_6_10065_10068_319_317_10696_453_10084_454_10083_10618_10307_10301_537_536_10059_10884_10887_321_322_10915_10103_10914_10911_10910%2Csearchweb201603_52%2CppcSwitch_0&algo_pvid=98b0ef6b-50e1-4ff6-8589-5786a06d7d20&algo_expid=98b0ef6b-50e1-4ff6-8589-5786a06d7d20-3
Beta Was this translation helpful? Give feedback.
All reactions