More complete SHT-31 library


#21

@RWB i’m not sure what capabilities the 4d system display has re animations but I did set up some animations using a timer and sprites, would be a little easier if the nextion instruction set included mod but whatever


#22

@hawesg, are you using an external antenna?
The keepout-zone around the chip antenna seems small to me - what is the RSSI on your board?

BTW, Nextion does now support modulo via the standard C notation (e.g. n0.val=n0.val%10 or n0.val%=10)


#23

I haven’t decided yet about the external antenna @ScruffR, as for the keepout zone, I will probably just put those two traces on the back, I specifically routed everything except a ground plane on the top so it would be easy to keep track of everything and because it would force me to be more deliberate with the routing. It’s going to go inside of the cooler in the center i found this picture on google images to show where it is going to go


And very nice about the modulo, wonder why it didn’t work when i tried

Can I measure RSSI without actually having a board in hand?

Also thanks for all your efforts on the Nextion library.


#24

You may have a dated Nextion Editor. Modulo was added in one of the more recent versions, I’ve just tried it with 0.48.

Are you having keeping the bottom layer coppper free around the chip antenna too?
Some people even decided to have the chip antenna hang over the edge of the PCB since even the copper free carrier material caused them some grief with the Photon directly touching.

You can use WiFi.RSSI() and publish the result as Partricle.variable() or display in your “WiFi” screen.


#25

@ScruffR I just booted windows and have 0.48, maybe I didn’t actually try it and just read that it was unavailable. That’s good info to know, as for the RSSI, I don’t have any actual boards, I just started laying it out, so I haven’t gotten as far as really thinking about that particular issue, I was thinking, in the end, i would do something like this


I am only planing on making a few of them I could easily mount it with headers, or use an external antenna.
While I’m talking to you, I noticed in all the nextion examples there are callbacks for each of the text components regardless of whether they have touch-enabled, which simply say setText(“50”), am I missing something or can I leave these out for components where all i am doing is updating the values.


#26

Most of the Nextion samples are stock samples as provided by ITEAD with only modifications to make them compatible with my port of the library, but no extra thought about the actual logic behind them :blush:


#27

Perfect, they seem to have an interesting way of thinking over there, I’m sure you have had some interactions with Patrick and whatever the other one is named. I figured i could just drop them but hadn’t tried yet. I will probably wrap all of my display stuff in a class so that it doesn’t clutter up my main code, and so that i can reuse the parts of the code that is repeated easily. Because i wanted the main part of the readings to be larger than the decimal part I have to write the two seperately and the decimal point is part of the background. I havn’t put too much thought into it but for the moment I’m seperating out the numbers with something like this

        n0.setValue((int)tempF);
        n1.setValue(((int)(tempF*100)%100));

I feel like there should be an easier way but I haven’t really looked into it.


#28

@RWB I published the library, not that you couldn’t have just downloaded from github, I also started writing some documentation in the form of a Wiki on github, I will finish writing it at some point, I did add a section explaining the alert mode.


#29

@hawesg I used the Adafruit libraries for the CCS811 VOC Sensor + SHT31D Temp Humidity sensor which is used to calibrate the VOC readings based on the current temp and humidity.

I bought a board that used the BMP280 Temp-Humdity-Air Pressure sensor but the temp readings were always higher than real temp by about what seemed like 3-4 degrees. So I switched to the SHT31D temp sensor for more accurate temp readings.

I tried to use your library but I got errors along with Sparkfun’s libraries for some reason which would give me the flashing RED SOS message as soon as the Photon started up.

Using both Adafruit SHT31 & CCS811 libraries together finally allowed me to get both sensors working together. So it’s working now. I’m sure you could work your extra SHT31 functions into this library without much trouble.

Spend to many hours on this today but atleast it’s working now :smile:

Library is here: https://www.dropbox.com/sh/syreq62m5gse010/AADvSB4cPVNLyxtOeRfL7FVPa?dl=0


View my Losant-powered dashboard “Voc Readings”


#30

Interesting, what were the errors?


#31

I’m not saying your library created the errors. It was me trying to combine both libraries that got me into trouble. It was the RED SOS error that keeps the Photon form booting up.

No idea what part of the code was causing that or way, but I figured out a way to do it get everything working.

I always heard the BMP280 temp sensor was pretty accurate, but from my testing, it would show a room that was 75F to be 79-80F which is a pretty big difference. I saw others complaining about this on Sparkfun’s website also saying it was 1-3 degrees higher than other sensors were reading.

The SHT line of thermostats are very accurate.


#32

Did it give you compile errors or did it just throw the SOS when you tried to boot?


#33

I did not try your library by its self. I’m sure it works and compiles just fine as you have already tested it to be working just fine.

My goal was to merge the SHT31 temp and humidity data into a sketch for the VOC sensor so I could have the VOC readings compensated for based on the current temp and humidity.

It’s working now, I was just trying lots of stuff that didn’t work and just ended up using both of Adafruits libraries for both sensors and that ended up working and I was happy because I didn’t have any more time to mess with it.

Using your library would be better because it opens up the other functions of the temp sensor which would be important if this was a battery-based solution not where I’m just plugging it into the wall to run 24/7.

I just shared it here because I know you are a Fan of the SHT temp sensors.

I just updated my online Dashboard to a database the trends over time.

https://app.losant.com/dashboards/599c9a05b36c040007c6e20c


#34

How is losant? I was considering trying it out.


#35

Losant is the way to go. It’s super simple to send a Particle.publish with all your data separated by colons.

This is all the code it took to send Temp, Humidity, Voc, Co2 data into my Losant account.

  snprintf(publishStateString, sizeof(publishStateString), "%u:%u:%f:%f:",
                                                          ccs.getTVOC(), ccs.geteCO2(), tF, h );
          Particle.publish("Voc", publishStateString);

Try their latest Particle Integration Setup guide, it’s all free.


#36

I’ll check it out when i get to that point, I stupidly plugged my power supply in backwards last night and fried the power regulator with 12v, goto dig out another photon :slight_smile: I’ll get back to it when i have some free time.


#37

@RWB, is it semicolon (;) or colon (:) - your verbal description and your code snippet don’t match :wink:


#38

Your right! I changed it :slight_smile:

Just open some E6000 glue to attached a laser cut label to a canvas bag and look at how the VOCs shot up. It was some really strong smelling adhesive.

I’m surprised at how long it’s taking to dissipate out of the garage I would have thought it wouldn’t be as strong still.


#39

Hey @RWB,

I’ve attempted to use your and SF’s CCS811 library and example. Initially started getting values over serial then the Photon starts breathing green (no cloud). Photon works as expected in any other instance, just this hardware/software combo is giving me trouble. Any insight is appreciated.


#40

Are you supply GND to the WKP pin? That is required for the CCS811 to bring the chip out of sleep mode.

Here is the code I used just for the CCS811 sensor only: https://www.dropbox.com/sh/uqdm9b43d6rxeea/AABWvO6yi4Zo-GlLwGVx8fIAa?dl=0