Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Paub Txog DockerPi Series 4 Channel Relay Board
- Kauj ruam 2: Nta
- Kauj Ruam 3: Daim Ntawv Qhia Chaw Nyob
- Kauj Ruam 4: Txuas Txuas Txuas mus rau Tus Tuav Teeb Pom Kev Zoo los ntawm Cov Khoom Siv Hluav Taws Xob
- Kauj Ruam 5: Kho I2C (Raspberry Pi)
- Kauj Ruam 6: Kev Tswj Ncaj Ncees yam tsis muaj Programming (Raspberry Pi)
- Kauj Ruam 7: Qhov program hauv Lus C (Raspberry Pi)
- Kauj Ruam 8: Qhov program hauv Python (Raspberry Pi)
- Kauj Ruam 9: Qhov program hauv Java (Raspberry Pi)
Video: Teeb Tswj System: 9 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Tsis ntev los no kuv tau ua haujlwm ntawm kev nkag siab Microcontrollers thiab IOT raws cov cuab yeej rau Kev Tshawb Fawb Kev Ruaj Ntseg. Yog li, Kuv xav txog kev tsim lub tsev me me hauv tsev siv tshuab rau kev xyaum. Kuv tseem tsis tau ua tiav qhov no, tab sis rau kev pib kuv yuav sib qhia li cas kuv siv Raspberry Pi 2 thiab qee yam khoom siv hluav taws xob los tswj kuv chav chav teeb pom kev zoo hauv kab ntawv no. Tsis tas li, Kuv yuav tsis tham txog Kev teeb tsa thawj zaug rau Raspberry ntawm no, koj yuav pom ntau yam kev qhia rau qhov ntawd.
Tab sis hauv txoj haujlwm no, kuv yuav qhia cov khoom docker pi series no rau koj.
Khoom siv
Daim Ntawv Teev Npe:
- 1 x Raspberry Pi 3B+/3B/Xoom/Xoom W/4B/
- 1 x 16GB Class 10 TF card
- 1 x DockerPi series 4 Channel Relay Board (HAT)
- 1 x [email protected] fais fab mov uas yog los ntawm 52Pi
- 4 x Lub teeb sawb
- 1 x DC txuas
- 1 x 12V fais fab mov rau lub teeb ci.
- ob peb xaim.
Kauj Ruam 1: Paub Txog DockerPi Series 4 Channel Relay Board
DockerPi 4 Channel Relay yog tus tswv cuab ntawm DockerPi Series, feem ntau siv hauv IOT daim ntawv thov.
DockerPi 4 Channel Relay tuaj yeem xa AC/DC, hloov qhov hloov pauv ib txwm, kom ua tiav cov tswv yim ntau dua. DockerPi 4 Channel Relay tuaj yeem teeb tsa tau txog 4, thiab tuaj yeem teeb nrog lwm DockerPi nthuav tawm pawg thawj coj saib. Yog tias koj yuav tsum tau ua haujlwm ntev, peb kuj pom zoo kom koj siv peb DockerPi Lub Rooj Tswjhwm Saib lub zog kom nthuav dav zog ntxiv.
LUS CEEB TOOM Ua ntej peb mus txuas ntxiv Kuv xav ceeb toom koj txog qhov DANGER ntawm kev sim nrog "Mains Electricity". Yog dab tsi mus tsis raug qhov phem yuav ua rau tuag lossis tsawg kawg hlawv koj lub tsev. Yog li, thov TSIS TXHOB ua txhua yam uas tau hais hauv kab lus no yog tias koj tsis nkag siab tias koj tab tom ua dab tsi lossis ua kom zoo dua los ntawm kev pab ntawm qee tus kws paub txog hluav taws xob. Cia peb pib.
Kauj ruam 2: Nta
- DockerPi Series
- Programmable
- Tswj ncaj qha (tsis muaj lub cajmeem)
- Txuas ntxiv GPIO Pins
- 4 Channel Relay
- 4 Alt I2C Addr Support
- Relay Status Leds Support
- 3A 250V AC Txhawb
- 3A 30V DC
- Puas tuaj yeem sib tshooj nrog lwm pawg pawg Pawg ywj pheej ntawm cov cuab yeej tseem ceeb (xav tau kev txhawb nqa I2C)
Kauj Ruam 3: Daim Ntawv Qhia Chaw Nyob
Pawg thawj coj no muaj qhov chaw nyob sib cais, thiab koj tuaj yeem tswj hwm txhua qhov kev xa tawm los ntawm ib qho lus txib.
Lwm Yam Yuav Tsum Tau:
Kev nkag siab yooj yim ntawm Python lossis C lossis plhaub lossis Java lossis lwm yam lus (Kuv yuav siv C, nab hab sej, plhaub, thiab java)
- Kev nkag siab yooj yim ntawm Linux systems
- Kev Ntseeg Ntawm Lub Siab
Tam sim no, ua ntej yuav mus tom ntej koj yuav tsum nkag siab cov khoom siv hluav taws xob peb yuav siv:
1. Tshaj tawm:
Kev xa tawm yog cov cuab yeej hluav taws xob uas feem ntau siv los tswj cov hluav taws xob siab siv hluav taws xob qis heev raws li Kev Nkag Mus. Qhov no suav nrog cov hlua qhwv ib ncig ntawm tus ncej thiab ob lub hlau me me (cov nodes) uas tau siv los kaw qhov Circuit Court. Ib qho ntawm qhov tau tsau thiab lwm qhov yog txav tau. Thaum twg ib qho hluav taws xob dhau los ntawm lub kauj, nws tsim lub zog sib nqus thiab nyiam qhov txav ntawm lub node zoo li qub thiab lub Circuit Court tau ua tiav. Yog li, tsuas yog siv cov hluav taws xob me me los txhawb lub kauj peb tuaj yeem ua tiav qhov Circuit Court rau qhov hluav taws xob siab mus ncig. Tsis tas li, vim tias qhov zoo li qub tsis txuas nrog lub cev rau lub kauj muaj tsawg heev uas Microcontroller ua kom lub kauj tau puas yog tias muaj qee yam tsis raug.
Kauj Ruam 4: Txuas Txuas Txuas mus rau Tus Tuav Teeb Pom Kev Zoo los ntawm Cov Khoom Siv Hluav Taws Xob
Tam sim no mus rau qhov tsis yooj yim, Peb yuav txuas qhov txuas mus rau tus tuav lub teeb uas siv los ntawm Cov Hluav Taws Xob Hluav Taws Xob. Tab sis, ua ntej kuv xav qhia koj lub tswv yim luv luv txog yuav ua li cas lub teeb tau qhib thiab OFF ntawm cov khoom siv ncaj qha.
Tam sim no, thaum lub teeb pom kev zoo txuas nrog lub hauv paus tseem ceeb, peb feem ntau ua qhov no los ntawm kev txuas ob lub xov hlau rau lub teeb. ib qho ntawm cov xaim yog "Neutral" xaim thiab lwm qhov yog "Negative" xaim uas tau nqa tam sim no, tseem muaj qhov hloov pauv ntxiv rau tag nrho cov Circuit Court los tswj ON ON OFF mechanism. Yog li, thaum qhov kev sib txuas tau txuas (lossis Tig Tawm) tam sim no ntws los ntawm qhov muag teeb thiab xaim nruab nrab, ua kom tiav Circuit Court. Qhov no tig lub teeb taws ON. Thaum qhov kev hloov pauv ntawm nws, nws ua txhaum lub Circuit Court thiab lub teeb tig tawm OFF. Nov yog daim duab me me los piav qhia qhov no:
Tam sim no, rau peb qhov kev sim, peb yuav tsum ua kom "Cov Hlau Tsis Zoo" dhau los ntawm peb qhov kev sib txuas kom tawg lub Circuit Court thiab tswj lub zog ntws siv kev hloov pauv. Yog li, thaum qhov kev sib txuas yuav qhib rau, nws yuav tsum ua kom tiav lub Circuit Court thiab Lub Teeb yuav tsum tig rau thiab hloov pauv. Xa mus rau daim duab hauv qab no rau Full Circuit.
Kauj Ruam 5: Kho I2C (Raspberry Pi)
Khiav sudo raspi-teeb tsa thiab ua raws cov lus qhia rau nruab i2c txhawb nqa rau ARM core thiab linux kernel
Mus rau Interfacing Options
Kauj Ruam 6: Kev Tswj Ncaj Ncees yam tsis muaj Programming (Raspberry Pi)
Qhib channel No.1 relay
i2cset -y 1 0x10 0x01 0xFF
Tua tawm channel No.1 relay
i2cset -y 1 0x10 0x01 0x00
Qhib channel No.2 relay
i2cset -y 1 0x10 0x02 0xFF
Tua tawm channel No.2 relay
i2cset -y 1 0x10 0x02 0x00
Qhib channel No.3 relay
i2cset -y 1 0x10 0x03 0xFF
Tua tawm channel No.3 relay
i2cset -y 1 0x10 0x03 0x00
Qhib channel No.4 relay
i2cset -y 1 0x10 0x04 0xFF
Tua tawm channel No.4 relay
i2cset -y 1 0x10 0x04 0x00
Kauj Ruam 7: Qhov program hauv Lus C (Raspberry Pi)
Tsim qhov chaws thiab lub npe nws "relay.c"
#suav nrog
#suav nrog
#suav nrog
#txhais DEVCIE_ADDR 0x10
#define RELAY1 0x01
#define RELAY2 0x02
#define RELAY3 0x03
#define RELAY4 0x04
#define ON 0xFF
#txiav tawm 0x00
int main (tsis muaj dab tsi)
{
printf ("Qhib Relays hauv C / n");
koj fd;.
int kuv = 0;
fd = wiringPiI2CSetup (DEVICE_ADDR);
rau (;;) {
rau (kuv = 1; kuv <= 4; kuv ++)
{
printf ("Qhib rau kev xa xov No. $ d", i);
xaimPiI2CWriteReg8 (fd, i, ON);
tsaug zog (200);
printf ("Tua tawm tsis siv xov tooj. $ d", i);
xaimPiI2CWriteReg8 (fd, i, OFF);
tsaug zog (200);
}
}
rov 0;
}
Sau nws
gcc relay.c -lwiringPi -o relay
Exec Nws
./saib
Kauj Ruam 8: Qhov program hauv Python (Raspberry Pi)
Cov cai hauv qab no tau pom zoo kom ua tiav siv Python 3 thiab teeb tsa lub tsev qiv ntawv smbus:
Tsim cov ntaub ntawv npe nws: "relay.py" thiab muab cov lej hauv qab no:
ntshuam sij hawm li t
ntshuam smbus
ntshuam sys
DEVICE_BUS = 1
DEVICE_ADDR = 0x10
npav = smbus. SMBus (DEVICE_BUS)
thaum Muaj Tseeb:
sim:
rau kuv hauv ntau (1, 5):
bus.write_byte_data (DEVICE_ADDR, kuv, 0xFF)
t. pw tsaug zog (1)
bus.write_byte_data (DEVICE_ADDR, kuv, 0x00)
t. pw tsaug zog (1)
tshwj tsis yog KeyboardInterrupt li e:
print ("Qhib lub Loop")
sys.exit ()
* Txuag nws thiab tom qab ntawv ua sej 3:
python3 tso tawm.py
Kauj Ruam 9: Qhov program hauv Java (Raspberry Pi)
Tsim cov ntaub ntawv tshiab npe: I2CRelay.java thiab muab cov lej hauv qab no:
ntshuam java.io. IOException;
ntshuam java.util. Arrays;
ntshuam com.pi4j.io.i2c. I2CBus;
ntshuam com.pi4j.io.i2c. I2CDevice;
ntshuam com.pi4j.io.i2c. I2CFactory;
ntshuam com.pi4j.io.i2c. I2CFactory. UnsupportedBusNumberException;
ntshuam com.pi4j.platform. PlatformAlreadyAssignedException;
ntshuam com.pi4j.util. Console;
pej xeem chav kawm I2CRelay {
// relay qhov chaw nyob sau npe.
pej xeem zoo li qub zaum kawg int DOCKER_PI_RELAY_ADDR = 0x10;
// channel ntawm relay.
pej xeem zoo li qub zaum kawg byte DOCKER_PI_RELAY_1 = (byte) 0x01;
pej xeem zoo li qub zaum kawg byte DOCKER_PI_RELAY_2 = (byte) 0x02;
pej xeem zoo li qub zaum kawg byte DOCKER_PI_RELAY_3 = (byte) 0x03;
pej xeem zoo li qub zaum kawg byte DOCKER_PI_RELAY_4 = (byte) 0x04;
// Hloov cov xwm txheej
pej xeem zoo li qub zaum kawg byte DOCKER_PI_RELAY_ON = (byte) 0xFF;
pej xeem zoo li qub zaum kawg byte DOCKER_PI_RELAY_OFF = (byte) 0x00;
pej xeem tsis muaj dab tsi zoo li qub (Txoj hlua args) cuam tshuam cuam tshuam, PlatformAlreadyAssignedException, IOException, UnsupportedBusNumberException {
kawg Console console = Console tshiab ();
I2CBus i2c = I2CFactory.getInstance (I2CBus. BUS_1);
I2CDevice ntaus ntawv = i2c.getDevice (DOCKER_PI_RELAY_ADDR);
console.println ("Qhib Relay!");
device.write (DOCKER_PI_RELAY_1, DOCKER_PI_RELAY_ON);
Xov.sleep (500);
console.println ("Tua tawm Relay!");
device.write (DOCKER_PI_RELAY_1, DOCKER_PI_RELAY_OFF);
}
}
Pom zoo:
Tsheb Tswj Chaw Taws Teeb - Tswj Kev Siv Wireless Xbox 360 Tus Tswj: 5 Kauj Ruam
Lub Tsheb Tswj Chaw Taws Teeb - Tswj Kev Siv Wireless Xbox 360 Tus Tswj: Cov no yog cov lus qhia txhawm rau tsim koj tus kheej lub tsheb tswj chaw taws teeb, tswj siv wireless Xbox 360 maub los
ESP8266 RGB LED Sawb WIFI Tswj - NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi - RGB LED Sawb Smartphone Tswj: 4 Cov Kauj Ruam
ESP8266 RGB LED Sawb WIFI Tswj | NODEMCU Raws li IR Chaw Taws Teeb rau Led Sawb Tswj Hauv Wifi | RGB LED Sawb Smartphone Tswj: Nyob zoo cov neeg hauv qhov kev qhia no peb yuav kawm paub siv nodemcu lossis esp8266 li IR chaw taws teeb los tswj RGB LED sawb thiab Nodemcu yuav raug tswj los ntawm smartphone dhau wifi. Yog li hauv paus koj tuaj yeem tswj RGB LED Sawb nrog koj lub xov tooj
DIY LED Teeb - Niaj Hnub Teeb Meem Teeb Nrog Cov Chaw Taws Teeb: 8 Kauj Ruam (nrog Duab)
DIY LED Teeb - Niaj Hnub Teeb Mood Teeb Nrog Chaw Taws Teeb: Hauv kab lus no kuv yuav mus hla cov txheej txheem Kuv tau siv los tsim qhov no zoo heev pyramid zoo li tus LED Mood Teeb.Kuv siv maple rau cov qauv tseem ceeb thiab qee qhov mahogany txhav ntxiv rau lub zog. Rau lub teeb Kuv siv RGB LED teeb uas tuaj nyob hauv 16 ko taw
Bluetooth Chaw Taws Teeb Tswj Chaw Teeb - Retrofit. Lub Teeb Hloov Tseem Ua Haujlwm, Tsis Muaj Kev Sau Ntawv Ntxiv: 9 Kauj Ruam (nrog Duab)
Bluetooth Chaw Taws Teeb Tswj Kev Teeb - Retrofit. Lub Teeb Hloov Tseem Ua Haujlwm, Tsis Muaj Kev Sau Ntxiv: Hloov Kho Lub Kaum Ib Hlis 25, 2017 - Rau Lub Hwj Chim Siab ntawm qhov haujlwm no uas tuaj yeem tswj tau kilowatts ntawm kev thauj mus los saib Retrofit BLE Kev Tswj rau Kev Siv Lub Hwj Chim Siab - Tsis Xav Tau Ntxiv Ntxiv Qee cov BLE cov laug cam / software sib sau ua ke
LED Teeb Teeb Duab Cwjmem: Cov Cuab Yeej rau Teeb Teeb Doodles: 6 Kauj Ruam (nrog Duab)
LED Teeb Teeb Lub Cwjmem: Cov Cuab Yeej rau Teeb Doodles: Kuv tus poj niam Lori yog tus neeg siv tsis tu ncua thiab kuv tau ua si nrog kev yees duab ntev ntev rau ntau xyoo. Kev tshoov siab los ntawm PikaPika pab pawg teeb pom kev zoo thiab yooj yim ntawm cov koob yees duab digital peb tau siv lub teeb duab kos duab kom pom tias peb tuaj yeem ua dab tsi