Cov txheej txheem:

4CH Relay-board Tswj Nrog Cov Khawm Push: 4 Cov Kauj Ruam
4CH Relay-board Tswj Nrog Cov Khawm Push: 4 Cov Kauj Ruam

Video: 4CH Relay-board Tswj Nrog Cov Khawm Push: 4 Cov Kauj Ruam

Video: 4CH Relay-board Tswj Nrog Cov Khawm Push: 4 Cov Kauj Ruam
Video: HOW TO INTERFACE 5V 4 CHANNEL RELAY MODULE WITH ARDUINO 2024, Hlis ntuj nqeg
Anonim
4CH Relay-board Tswj Nrog Cov Khawm Push
4CH Relay-board Tswj Nrog Cov Khawm Push

Kuv lub hom phiaj yog hloov kho kuv li Anet A8 3D-tshuab luam ntawv los ntawm kev ntxiv lub zog tswj kev tswj hwm los ntawm Octoprint interface. Txawm li cas los xij, Kuv kuj xav kom tuaj yeem pib "ua haujlwm" kuv li 3D-tshuab luam ntawv, lub ntsiab lus tsis siv lub vev xaib tab sis tsuas yog nias lub pob.

Kauj Ruam 1: Kev Txuas Hluav Taws Xob

Qhov thaiv
Qhov thaiv
Qhov thaiv
Qhov thaiv
Qhov thaiv
Qhov thaiv
Qhov thaiv
Qhov thaiv

AC-DC PSU txuas nrog Smart-plug (TP-Txuas) uas tuaj yeem tswj tau los ntawm lub xov tooj ntawm tes (App Kasa) lossis khawm.

PSU lub zog Raspberry Pi 3 B+ los ntawm LM2596 DC -DC Buck Converter Module (12V - 5V). 4-Relay Module 5V nrog Optocoupler Low-Level-Trigger tau txuas ncaj qha rau RPI 3B+ (tsis xav tau 3.3V kho dua).

4 Laub khawm tau txuas nrog "rub tawm tus neeg tawm tsam" rau RPI 3B+.

Rau kev thaiv, tsuas yog saib rau daim duab.

Kauj ruam 2: Software

Txog kev tswj hwm los ntawm kev thawb-khawm, Kuv tau siv Python los sau qhov program, txhawb kuv los ntawm kev nyeem cov xov hauv qab no:

www.raspberrypi.org/forums/viewtopic.php?t…

invent.module143.com/daskal_tutorial/raspbe…

www.hertaville.com/introduction-to-accessin…

www.hertaville.com/introduction-to-accessin…

Txhawm rau pov hwm kev cuam tshuam nrog kev tswj hwm ntawm Octoprint, muaj kev sim los tshuaj xyuas qhov xwm txheej tam sim no ntawm kev xa tawm thiab hloov nws.

Tsab ntawv txuas nrog.

Lus Teb: Raws li Relay 1 tswj lub motherboard, Kuv xav ntxiv kev nyab xeeb los ntawm kev hloov nrog lub laub-khawm. Lub hom phiaj yog kom tswj lub pob nyem thaum 5 vib nas this kom paub meej tias hloov mus. Hmoov tsis zoo, tsab ntawv ua haujlwm tab sis tsis ntseeg tau vim muaj kev thim rov qab. Yog tias koj muaj kev kho kom pom zoo thov qhia tawm pub dawb.

Txhawm rau ua tsab ntawv ua tiav: sudo chmod 777 /home/pi/script/Relay_board_control.pyTo sim cov ntawv:./Relay_board_control.py

Txhawm rau luam tsab ntawv: sudo cp Relay_board_control.py/usr/local/bin

Kom khiav tau cov ntawv thaum pib:

sudo nano /etc/rc.local

ntxiv txoj hauv kev rau tsab ntawv "/home/pi/scripts/Relay_board_control.py &" nruab nrab ntawm fi thiab tawm 0

Txog kev tswj hwm los ntawm Octoprint, nws tau sau tseg zoo hauv lub vev xaib.

Muaj ob theem:

1- Kho cov ntaub ntawv /etc/init.d/octoprint los ntawm kev ntxiv hauv qhov thaiv "do_start ()" tom qab RETVAL = "$?:

gpio export 6 tawm

gpio -g sau 61

gpio xa tawm 13 tawm

gpio -g sau 131

gpio xa tawm 19 tawm

gpio -g sau 191

gpio xa tawm 26 tawm

gpio -g sau 26 1

2- Hloov kho /home/pi/.octoprint/config.yaml cov ntaub ntawv los ntawm kev ntxiv qhov thaiv "System":

system: kev ua:

- kev nqis tes ua: Printer_ON

hais kom ua: gpio -g sau 60

lees paub: cuav

lub npe: Printer_ON

- kev nqis tes ua: Printer_OFF

hais kom ua: gpio -g sau 61

lees paub: Koj tab tom yuav tig_OFF lub tshuab luam ntawv.

lub npe: Printer_OFF

- nqis tes ua: LED-String_ON

hais kom ua: gpio -g sau 13 0

lees paub: cuav

lub npe: LED-String_ON

- nqis tes ua: LED-String_OFF

hais kom ua: gpio -g sau 131

lees paub: cuav

lub npe: LED-String_OFF

- nqis tes ua: LED-Cam_ON

hais kom ua: gpio -g sau 19 0

lees paub: cuav

lub npe: LED-Cam_ON

- nqis tes ua: LED-Cam_OFF

hais kom ua: gpio -g sau 191

lees paub: cuav

lub npe: LED-Cam_OFF

- nqis tes ua: Relay-4_ON

hais kom ua: gpio -g sau 260

lees paub: cuav

npe: Relay-4_ON

- nqis tes ua: Relay-4_OFF

hais kom ua: gpio -g sau 26 1

lees paub: cuav

npe: Relay-4_OFF

Kauj Ruam 3: Kev Xeem

Image
Image

Nws ua haujlwm!

Tus cwj pwm ntawm lub laub-khawm yog qhov nyuaj me ntsis tab sis tom qab ob peb qhov kev sim koj tau txais nws.

Kauj Ruam 4: Xaus Qhov Ntsuas

Xaus Lub Tswv Yim
Xaus Lub Tswv Yim
Xaus Lub Tswv Yim
Xaus Lub Tswv Yim
Xaus Lub Tswv Yim
Xaus Lub Tswv Yim

Tam sim no kuv yuav solder lub laub-khawm ntawm lub perfboard thiab ntxiv 5 tus pin txuas.

Thaum kawg, Kuv tau tsim thiab luam tawm 2 kis:

- ib qho rau RPI 3 B+ thiab relay-board

- ib qho los npog cov thaiv ntawm lub hauv paus ntawm PSU thiab kho LM2596 DC-DC Buck Converter Module.

Koj tuaj yeem nrhiav cov ntaub ntawv *.stl thiab *.gcode ntawm www.thingiverse.com

-

-

Pom zoo: