HOME
- - - - - - - - Table of contents, my Arduino "How To" articles
Other material for programmers
Humidity and Temperature Sensing
Si7021. Easy! Inexpensive!
filename: aht4humidSi7021.htm
September 2018: You could buy a humidity and temperature sensor breakout from Sparkfun for $7, plus p&p.
And it is easy to use.
Once you install Sparkfun's library, the code boils down to....
#include "SparkFun_Si7021_Breakout_Library.h"
#include <Wire.h>
float humidity = 0;
float tempf = 0;
Weather sensor;
//-------------------------------
void setup()
{
Serial.begin(9600);
sensor.begin();
}// End of setup()
//-------------------------------
void loop()
{
getWeather();
printInfo();
delay(1000);
}//End of loop()
//-------------------------------
void getWeather()
{
humidity = sensor.getRH();
tempf = sensor.getTempF();
}//End of getWeather()
//-------------------------------
void printInfo()
{
//This function prints the weather data out to the default Serial Port
Serial.print("Temp:");
Serial.print(tempf);
Serial.print("F, ");
Serial.print("Humidity:");
Serial.print(humidity);
Serial.println("%");
}//End of printInfo()
A few minor "pay attentions" to notice... not "problems", unless you fail to notice...
- a) 3v3 only... but I'm told it plays nicely via a level shifter if you want to use a 5v controller
- b) Do not remove "the white thing" covering the sensor... little (3mm) black square. Notes about this ARE present in the Sparkfun hookup guide... if you read it!
- c) You can only have one of these on a given I2C string. This is due to the address being hardcoded (0x40) into the chip. Not Sparkfun's fault!
Don't, by the way, be scared by the I2C. I know little about it, but had no problems. Be sure you connect SDA and SCL to the right pins on whatever microcontroller you are using.
Put humidity/ temperature data from Si7021 online with $16 ESP8266
The code of a webserver in an 8266 ($16... programmed with Arduino IDE)... is available. See my discussion of creating an inexpensive webserver ($16) to report data from sensors.
Site Map
What's New
Search
The search engine is not intelligent. It merely seeks the words you specify. It will not do anything sensible with "What does the 'could not compile' error mean?" It will just return references to pages with "what", "does", "could", "not".... etc.
In addition to the tutorials for which this page serves as Table of Contents, I have other sites with material you might find useful.....
Sequenced set of tutorials on Arduino programming and electronics interfacing.
Tutorials about the free database supplied with Open Office/ Libre
Office.
Some pages for programmers.
Using the parallel port of a Windows computer.
If you visit 1&1's site from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service.
Ad from page's editor: Yes.. I do enjoy
compiling these things for you... hope they are helpful. However..
this doesn't pay my bills!!! If you find this stuff useful, (and you
run an MS-DOS or Windows PC) please visit my freeware and shareware
page, download something, and circulate it for me? Links on your page
to this page would also be appreciated!
Click here
to visit editor's Sheepdog Software (tm) freeware, shareware pages.. Material on this page © TK Boyd qDATE
And if you liked that, or want different things, here are some more pages from the editor of these tutorials....
Click here
to visit the homepage of my biggest site.
Click here
to visit the homepage of Sheepdogsoftware.co.uk. Apologies if the "?FrmAht" I added to that link causes your browser problems. Please let me know, if so?
Click here
to visit editor's pages about using computers in Sensing and Control, e.g. weather logging.
To email this page's editor, Tom Boyd....
Editor's email address. Suggestions welcomed!
Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org
Why does this page cause a script to run? Because of the Google panels, and the code for the search button. Why do I mention the script? Be sure you know all you need to about spyware.
....... P a g e . . . E n d s .....