Cov txheej txheem:
- Kauj Ruam 1: Yam Koj Xav Tau..
- Kauj Ruam 2: Kev Sib Txuas:
- Kauj ruam 3: Code:
- Kauj Ruam 4: Cov ntawv thov:
Video: Raspberry Pi HTS221 Tus txheeb ze Vaum thiab Kub Sensor Java Qhia: 4 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
HTS221 yog lub ntsuas hluav taws xob me me uas muaj peev xwm ntsuas tau rau qhov txheeb ze thiab qhov kub thiab txias. Nws suav nrog lub hauv paus ntsiab lus thiab qhov sib xyaw ua ke daim ntawv thov tshwj xeeb kev sib xyaw ua ke (ASIC) los muab cov ntaub ntawv ntsuas los ntawm kev cuam tshuam digital. Kev koom ua ke nrog ntau cov yam ntxwv no yog ib qho ntawm cov ntsuas tsim nyog tshaj plaws rau qhov ntsuas qhov ntsuas cua thiab ntsuas kub. Nov yog qhov ua piv txwv nrog java code siv Raspberry Pi.
Kauj Ruam 1: Yam Koj Xav Tau..
1. Raspberry Pi
2. HTS221
3. I²C Cable
4. I²C Shield rau Raspberry Pi
5. Ethernet Cable
Kauj Ruam 2: Kev Sib Txuas:
Siv I2C daim thaiv rau raspberry pi thiab maj mam thawb nws hla gpio pins ntawm raspberry pi.
Tom qab ntawd txuas ib qho kawg ntawm I2C cable rau HTS221 sensor thiab lwm qhov kawg rau I2C daim ntaub thaiv.
Kuj txuas Ethernet cable rau pi lossis koj tuaj yeem siv WiFi module.
Kev sib txuas tau qhia hauv daim duab saum toj no.
Kauj ruam 3: Code:
Tus nab npawb nab npawb rau HTS221 tuaj yeem rub tawm los ntawm peb qhov chaw cia khoom github-Dcube Store
Nov yog qhov txuas rau tib yam:
github.com/DcubeTechVentures/HTS221/blob/master/Java/HTS221.java
Peb tau siv pi4j tsev qiv ntawv rau java code, cov kauj ruam rau nruab pi4j ntawm raspberry pi tau piav qhia ntawm no:
pi4j.com/install.html
Koj tseem tuaj yeem luam cov cai los ntawm no, nws tau muab raws li hauv qab no:
// Faib nrog daim ntawv tso cai yuav dawb.
// Siv nws txhua txoj hauv kev uas koj xav tau, muaj txiaj ntsig lossis pub dawb, muab nws haum rau hauv daim ntawv tso cai ntawm nws cov haujlwm ua haujlwm.
HWV 221
// Tus lej no yog tsim los ua haujlwm nrog HTS221_I2CS I2C Mini Module.
ntshuam com.pi4j.io.i2c. I2CBus;
ntshuam com.pi4j.io.i2c. I2CDevice;
ntshuam com.pi4j.io.i2c. I2CFactory;
ntshuam java.io. IOException;
pej xeem hauv chav HTS221 {pej xeem zoo li qub void lub ntsiab (Txoj hlua args ) cuam tshuam Kev zam
{
// Tsim I2CBus
I2CBus tsheb npav = I2CFactory.getInstance (I2CBus. BUS_1);
// Tau txais I2C ntaus ntawv, HTS221 I2C chaw nyob yog 0x5F (95)
I2CDevice ntaus ntawv = bus.getDevice (0x5F);
// Xaiv qhov nruab nrab teeb tsa sau npe
// Qhov ntsuas kub nruab nrab piv txwv = 16, ntsuas qhov nruab nrab qhov nruab nrab = 32
device.write (0x10, (byte) 0x1B);
// Xaiv tswj npe 1
// Fais fab, thaiv cov ntaub ntawv hloov tshiab, cov ntaub ntawv tus nqi o/p = 1 Hz
ntaus ntawv.write (0x20, (byte) 0x85);
Xov.sleep (500);
// Nyeem Calibration qhov tseem ceeb los ntawm lub cim xeeb tsis hloov pauv ntawm lub cuab yeej
// Humidity Calibration qhov tseem ceeb
byte val = tshiab byte [2];
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x30 (48)
val [0] = (byte) ntaus ntawv nyeem (0x30);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x31 (49)
val [1] = (byte) ntaus ntawv nyeem (0x31);
int H0 = (val [0] & 0xFF) / 2;
int H1 = (val [1] & 0xFF) / 2;
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x36 (54)
val [0] = (byte) ntaus ntawv nyeem (0x36);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x37 (55)
val [1] = (byte) ntaus ntawv nyeem (0x37);
int H2 = ((val [1] & 0xFF) * 256) + (val [0] & 0xFF);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x3A (58)
val [0] = (byte) ntaus ntawv nyeem (0x3A);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x3B (59)
val [1] = (byte) ntaus ntawv nyeem (0x3B);
int H3 = ((val [1] & 0xFF) * 256) + (val [0] & 0xFF);
// Kub Calibration qhov tseem ceeb
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x32 (50)
int T0 = ((byte) device.read (0x32) & 0xFF);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x33 (51)
int T1 = ((byte) device.read (0x33) & 0xFF);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x35 (53)
int raw = ((byte) device.read (0x35) & 0x0F);
// Hloov qhov ntsuas kub ntsuas qhov ntsuas kom 10-ntsis
T0 = ((raw & 0x03) * 256) + T0;
T1 = ((raw & 0x0C) * 64) + T1;
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x3C (60)
val [0] = (byte) ntaus ntawv nyeem (0x3C);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x3D (61)
val [1] = (byte) ntaus ntawv nyeem (0x3D);
int T2 = ((val [1] & 0xFF) * 256) + (val [0] & 0xFF);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x3E (62)
val [0] = (byte) ntaus ntawv.read (0x3E);
// Nyeem 1 byte ntawm cov ntaub ntawv los ntawm chaw nyob 0x3F (63)
val [1] = (byte) ntaus ntawv nyeem (0x3F);
int T3 = ((val [1] & 0xFF) * 256) + (val [0] & 0xFF);
// Nyeem 4 bytes ntawm cov ntaub ntawv
// hmoob, hmoob, hmoob, hmoob, hmoob, hmoob, hmoob, hmoob
byte cov ntaub ntawv = tshiab byte [4]; device.read (0x28 | 0x80, cov ntaub ntawv, 0, 4);
// Hloov cov ntaub ntawv
int hum = ((cov ntaub ntawv [1] & 0xFF) * 256) + (cov ntaub ntawv [0] & 0xFF);
int temp = ((cov ntaub ntawv [3] & 0xFF) * 256) + (data [2] & 0xFF);
yog (temp> 32767)
{
temp -= 65536;
}
ob npaug av noo = ((1.0 * H1) - (1.0 * H0)) * (1.0 * hum - 1.0 * H2) / (1.0 * H3 - 1.0 * H2) + (1.0 * H0);
ob cTemp = ((T1 - T0) / 8.0) * (temp - T2) / (T3 - T2) + (T0 / 8.0);
ob fTemp = (cTemp * 1.8) + 32;
// Cov ntaub ntawv tso tawm rau lub vijtsam
System.out.printf ("Tus txheeb ze Vaum: %.2f %% RH %n", av noo);
System.out.printf ("Kub hauv Celsius: %.2f C %n", cTemp);
System.out.printf ("Kub hauv Fahrenheit: %.2f F %n", fTemp);
}
}
Kauj Ruam 4: Cov ntawv thov:
HTS221 tuaj yeem ua haujlwm hauv ntau yam khoom siv xws li huab cua ua kom txias thiab tub yees thiab lwm yam.
Pom zoo:
TouchFree: Kev Txheeb Kub Kub thiab Kev Txheeb Xyuas Lub Ntsej Muag: 5 Kauj Ruam
TouchFree: Kev Txheeb Kub Kub thiab Kev Tshawb Pom Lub Ntsej Muag Kiosk: Raws li Lub Tebchaws nyob ib puag ncig lub ntiaj teb tab tom rov qhib, nyob nrog Tus Kab Mob Tshiab Coronavirus tau dhau los ua txoj hauv kev tshiab. Tab sis kom Tsis txhob kis tus kab mob no peb yuav tsum cais cov neeg muaj tus mob coronavirus los ntawm tus so. Raws li CDC, ua npaws yog tus
Arduino Nano - HTS221 Tus txheeb ze Vaum thiab Kub Sensor Tutorial: 4 Kauj Ruam
Arduino Nano - HTS221 Txheeb Ze Cov Vaum thiab Kub Sensor Tutorial: HTS221 yog lub ntsuas hluav taws xob me me uas muaj peev xwm ntsuas tau rau qhov txheeb ze thiab qhov kub thiab txias. Nws suav nrog lub hauv paus ntsiab lus thiab cov teeb liab sib xyaw daim ntawv thov tshwj xeeb kev sib txuas (ASIC) los muab cov ntaub ntawv ntsuas los ntawm cov lej
Siv Raspberry Pi, Txheeb Xyuas Cov Vaum thiab Kub Nrog SI7006: 6 Cov Kauj Ruam
Siv Raspberry Pi, Txheeb Xyuas Cov Vaum thiab Kub Nrog SI7006: Ua tus txhawb siab rau Raspberry Pi, peb xav txog qee qhov kev sim zoo tshaj plaws nrog nws. SI7006, Vaum thiab Kub hnov
ARUPI - Tus Nqi Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi Uas Tau Txais Tus Nqi/Tus Kheej Tus Kheej (ARU) rau Soundscape Ecologists: 8 Kauj Ruam (nrog Duab)
ARUPI - Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi Tus Nqi Uas Tau Txais Tus Nqi/Tus Kheej Tus Kheej (ARU) rau Soundscape Ecologists: Cov lus qhia no tau sau los ntawm Anthony Turner. Txoj haujlwm tau tsim los nrog ntau qhov kev pab los ntawm Shed hauv Tsev Kawm Ntawv ntawm Kev Suav, University of Kent (Mr Daniel Knox tau pab zoo!)
Yuav Ua Li Cas Siv DHT11 Kub Sensor Nrog Arduino thiab Luam Kub Kub thiab Vaum: 5 Kauj Ruam
Yuav Ua Li Cas Siv DHT11 Kub Sensor Nrog Arduino thiab Luam Kub Kub thiab Vaum: Lub DHT11 sensor tau siv los ntsuas kub thiab av noo. Lawv yog cov khoom siv hluav taws xob nrov tshaj plaws.Qhov DHT11 cov av noo thiab ntsuas kub ua rau nws yooj yim ntxiv cov av noo thiab ntsuas kub rau koj li DIY cov phiaj xwm hluav taws xob. Nws yog rau