Cov txheej txheem:
- Kauj Ruam 1: BH1715 Txheej Txheem:
- Kauj Ruam 2: Yam Koj Xav Tau..
- Kauj Ruam 3: Khoos Phis Tawj Hookup:
- Kauj Ruam 4: Teeb Pom Kev Ntsuas Siv Java Code:
- Kauj Ruam 5: Cov ntawv thov:
Video: Kev ntsuas lub teeb pom kev zoo los ntawm kev siv BH1715 thiab Raspberry Pi: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:25
Nag hmo peb tau ua haujlwm ntawm LCD cov lus, thiab thaum ua haujlwm dhau ntawm lawv peb tau pom qhov tseem ceeb ntawm kev suav qhov teeb pom kev zoo. Kev siv lub teeb tsis yog tsuas yog qhov tseem ceeb hauv lub cev ntawm lub ntiaj teb no tab sis nws muaj nws lub luag haujlwm hais tau zoo hauv kev siv tshuaj lom neeg ib yam nkaus. Qhov kwv yees kwv yees ntawm lub teeb siv ua lub luag haujlwm tseem ceeb hauv peb cov txheej txheem, hauv kev loj hlob ntawm cov nroj tsuag, thiab lwm yam.
Hauv qhov kev qhia no, peb yuav los qhia txog kev ua haujlwm ntawm BH1715 nrog Raspberry pi, siv Java ua cov lus programming.
Kho vajtse uas koj yuav xav tau rau lub hom phiaj no yog raws li hauv qab no:
1. BH1715 - Ambient Teeb Sensor
2. Raspberryy Pi
3. I2C Cable
4. I2C Shield Rau Raspberry Pi
5. Ethernet Cable
Kauj Ruam 1: BH1715 Txheej Txheem:
Ua ntej tshaj plaws, peb xav paub koj nrog cov yam ntxwv tseem ceeb ntawm lub ntsuas qhov ntsuas uas yog BH1715 thiab kev sib txuas lus raws tu qauv uas nws ua haujlwm.
BH1715 yog digital Ambient Light Sensor nrog I²C tsheb npav sib cuam tshuam. BH1715 feem ntau yog siv kom tau txais cov ntaub ntawv teeb pom kev zoo los kho LCD thiab Keypad lub teeb pom kev zoo rau lub xov tooj ntawm tes. Cov cuab yeej no muaj 16-ntsis kev daws teeb meem thiab ntsuas ntsuas tau ntau, tso cai kuaj pom los ntawm.23 txog 100, 000 lux.
Cov txheej txheem kev sib txuas lus uas lub sensor ua haujlwm yog I2C. I2C sawv cev rau kev sib koom ua ke. Nws yog cov txheej txheem kev sib txuas lus uas kev sib txuas lus tau tshwm sim los ntawm SDA (cov ntaub ntawv xov xwm) thiab SCL (cov xov tooj). Nws tso cai txuas ntau yam khoom siv tib lub sijhawm. Nws yog ib qho ntawm cov txheej txheem kev sib txuas lus yooj yim tshaj plaws thiab muaj txiaj ntsig tshaj plaws.
Kauj Ruam 2: Yam Koj Xav Tau..
Cov ntaub ntawv uas peb xav tau kom ua tiav peb lub hom phiaj suav nrog cov khoom siv hauv qab no:
1. BH1715 - Ambient Teeb Sensor
2. Raspberry Pi
3. I2C Cable
4. I2C Shield Rau Raspberry Pi
5. Ethernet cable
Kauj Ruam 3: Khoos Phis Tawj Hookup:
Tshooj khoos phis tawj sib txuas ntu piav qhia qhov txuas txuas uas xav tau ntawm lub ntsuas cua thiab raspberry pi. Ua kom muaj kev sib txuas raug yog qhov tseem ceeb xav tau thaum ua haujlwm ntawm ib qho system rau qhov xav tau cov zis. Yog li, qhov xav tau kev sib txuas yog raws li hauv qab no:
BH1715 yuav ua haujlwm dhau I2C. Nov yog qhov piv txwv kab hluav taws xob daim duab, qhia txog yuav ua li cas xaim txhua lub interface ntawm lub sensor.
Tawm-ntawm-lub thawv, lub rooj tsavxwm tau teeb tsa rau I2C interface, zoo li peb pom zoo siv qhov kev sib txuas no yog tias koj tsis ntseeg lwm yam. Txhua yam koj xav tau yog plaub lub xov hlau!
Tsuas yog plaub qhov kev sib txuas xav tau Vcc, Gnd, SCL thiab SDA tus pin thiab cov no txuas nrog kev pab ntawm I2C cable.
Cov kev sib txuas no tau qhia hauv cov duab saum toj no.
Kauj Ruam 4: Teeb Pom Kev Ntsuas Siv Java Code:
Qhov zoo ntawm kev siv raspberry pi yog, uas muab rau koj hloov pauv ntawm cov lus programming uas koj xav tau los teeb tsa lub rooj tsav xwm txhawm rau txhawm rau cuam tshuam lub sensor nrog nws. Kev siv cov txiaj ntsig zoo ntawm pawg no, peb tab tom qhia ntawm no nws tau ua haujlwm hauv Java. Java code rau BH1715 tuaj yeem rub tawm los ntawm peb cov zej zog GitHub uas yog Dcube Store.
Ntxiv rau qhov yooj yim ntawm cov neeg siv, peb tab tom piav qhia cov cai ntawm no thiab:
Raws li thawj kauj ruam ntawm kev sau npe, koj yuav tsum rub lub pi4j lub tsev qiv ntawv hauv java, vim tias lub tsev qiv ntawv no txhawb nqa cov haujlwm siv hauv txoj cai. Yog li, txhawm rau rub lub tsev qiv ntawv koj tuaj yeem mus ntsib qhov txuas hauv qab no:
pi4j.com/install.html
Koj tuaj yeem luam qhov ua haujlwm java code rau lub ntsuas no los ntawm no kuj:
// 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.
SWB 1715 Stb
// Tus lej no yog tsim los ua haujlwm nrog BH1715_I2CS I2C Mini Module muaj los ntawm ControlEverything.com.
//
ntshuam com.pi4j.io.i2c. I2CBus;
ntshuam com.pi4j.io.i2c. I2CDevice;
ntshuam com.pi4j.io.i2c. I2CFactory;
ntshuam java.io. IOException;
pej xeem chav BH1715
{
pej xeem zoo li qub tsis muaj dab tsi tseem ceeb (Txoj hlua args ) cuam tshuam zam
{
// Tsim I2C npav
I2CBus tsheb npav = I2CFactory.getInstance (I2CBus. BUS_1);
// Tau txais I2C ntaus ntawv, BH1715 I2C chaw nyob yog 0x23 (35)
I2CDevice ntaus ntawv = bus.getDevice (0x23);
// Xa lub zog ntawm kev hais kom ua
ntaus ntawv.write ((byte) 0x01);
// Xa cov lus ntsuas ntsuas mus tas li
ntaus ntawv.write ((byte) 0x10);
Xov.sleep (500);
// Nyeem 2 bytes ntawm cov ntaub ntawv
// luminance msb, lumance lsb
byte cov ntaub ntawv = tshiab byte [2];
device.read (cov ntaub ntawv, 0, 2);
// Hloov cov ntaub ntawv
ob chav ci ntsa iab = ((cov ntaub ntawv [0] & 0xFF) * 256 + (cov ntaub ntawv [1] & 0xFF)) / 1.20;
// Cov ntaub ntawv tso tawm rau lub vijtsam
System.out.printf ("Ambient Light Luminance: %.2f lux %n", luminance);
}
}
Lub tsev qiv ntawv uas txhawb nqa i2c kev sib txuas lus ntawm lub sensor thiab pawg thawj coj yog pi4j, nws ntau pob khoom I2CBus, I2CDevice thiab I2CFactory pab tsim kom muaj kev sib txuas.
ntshuam com.pi4j.io.i2c. I2CBus; ntshuam com.pi4j.io.i2c. I2CDevice; ntshuam com.pi4j.io.i2c. I2CFactory; ntshuam java.io. IOException;
Ib feem ntawm txoj cai no ua rau lub ntsuas hluav taws xob ua haujlwm rau ntsuas lub teeb los ntawm kev sau cov lus txib tshwj xeeb uas siv sau () ua haujlwm thiab tom qab ntawd cov ntaub ntawv raug nyeem siv siv nyeem () ua haujlwm.
ntaus ntawv.write ((byte) 0x01); // hwj chim ntawm kev hais kom ua
ntaus ntawv.write ((byte) 0x10); // kev ntsuas ntsuas txuas ntxiv
byte cov ntaub ntawv = tshiab byte [2]; // Nyeem 2 bytes ntawm cov ntaub ntawv
device.read (cov ntaub ntawv, 0, 2);
Cov ntaub ntawv tau txais los ntawm lub ntsuas hluav taws xob tau hloov pauv mus rau qhov tsim nyog siv los ntawm kev siv cov hauv qab no:
ob npaug luminance = ((cov ntaub ntawv [0] & 0xFF) * 256 + (cov ntaub ntawv [1] & 0xFF)) / 1.20;
Cov zis tau luam tawm siv System.out.println () ua haujlwm, hauv cov qauv hauv qab no.
System.out.printf ("Ambient Light Luminance: %.2f lux %n", luminance);
Qhov tso tawm ntawm lub ntsuas hluav taws xob tau qhia hauv daim duab saum toj no.
Kauj Ruam 5: Cov ntawv thov:
BH1715 yog lub teeb pom kev ib puag ncig lub teeb pom kev zoo uas tuaj yeem suav nrog hauv xov tooj ntawm tes, LCD TV, NCEJ PC thiab lwm yam. siv lub teeb pom kev zoo.
Pom zoo:
Yuav Ntsuas Li Cas Ntsuas Kev Siv Lub Hwj Chim ntawm Kev Sib Txuas Lus Wireless hauv Era ntawm Kev Siv Hluav Taws Xob?: 6 Cov Kauj Ruam
Yuav Ua Li Cas Ntsuas Kom Tau Txais Kev Siv Lub Hwj Huam ntawm Kev Sib Txuas Lus Wireless hauv Era ntawm Kev Siv Hluav Taws Xob? Feem ntau IoT nodes yuav tsum tau siv lub roj teeb. Tsuas yog los ntawm kev ntsuas ntsuas lub zog siv ntawm lub wireless wireless peb tuaj yeem kwv yees kwv yees ntau npaum li cas roj teeb kuv
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej
Lub Teeb Pom Kev Pom Kev Pom Zoo/ Handheld Photograpy Teeb: 7 Cov Kauj Ruam (nrog Duab)
Intimate Video Light/ Handheld Photograpy Light: Kuv paub koj xav li cas. Los ntawm "intimate," Kuv txhais tau tias teeb pom kev nyob ze rau qhov xwm txheej teeb pom kev nyuaj-tsis tas yuav rau "xwm txheej zoo." (Txawm li cas los xij, nws tuaj yeem siv rau qhov ntawd ib yam nkaus …) Raws li New York City tus kws yees duab-lossis
Motion Controlled Outlet - Los ntawm Lub Teeb Pom Kev Pom Kev Pom Teeb: 6 Cov Kauj Ruam
Motion Controlled Outlet - Los ntawm Lub Teeb Pom Kev Pom Kev: Xav txog tias koj yog ib tus neeg dag-lossis-coj mus rau lub tsev txaus ntshai tshaj plaws ntawm qhov thaiv. Tom qab dhau mus tag nrho cov dab, dab thiab lub qhov ntxa koj thaum kawg tau mus rau txoj kev kawg. Koj tuaj yeem pom cov khoom qab zib hauv lub tais ua ntej ntawm koj! Tab sis tam sim ntawd gho
Teeb pom kev pom lub teeb pom kev zoo (LED) Nrog C Stamp Microcontroller: 5 Kauj Ruam
Teeb pom kev rau lub teeb pom kev zoo (LED) Nrog C Stamp Microcontroller: Nov yog Thawj Qhov Kev Tsim Qauv thiab Kev Ua Haujlwm los ntawm CS310XXX (μ C 101) Cov Ntawv Qhia Qhia Los ntawm A-WIT Technologies, Inc. Hauv qhov kev qhia no, peb yuav pom Lub Teeb Emitting Diode (LED) nrog C Stamp Microcontroller. Cov C & n