Cov txheej txheem:

GPS Nrhiav 3D Daim Ntawv Qhia: 9 Kauj Ruam
GPS Nrhiav 3D Daim Ntawv Qhia: 9 Kauj Ruam

Video: GPS Nrhiav 3D Daim Ntawv Qhia: 9 Kauj Ruam

Video: GPS Nrhiav 3D Daim Ntawv Qhia: 9 Kauj Ruam
Video: Мужская Casio G-Shock Magma Ocean Золотой Rangeman | 35-летие GPRB1000TF-1 Обз... 2024, Hlis ntuj nqeg
Anonim
GPS Nrhiav 3D Daim Ntawv Qhia
GPS Nrhiav 3D Daim Ntawv Qhia
GPS Nrhiav 3D Daim Ntawv Qhia
GPS Nrhiav 3D Daim Ntawv Qhia

Txoj haujlwm no yog daim duab 3D luam tawm daim duab qhia chaw, nrog rau txoj kev, dej ntws thiab hauv nroog, nrog cov teeb ci LED los qhia qhov chaw ntawm cov tswv cuab ntawm tsev neeg. Nws tuaj yeem qhia pom tias tus menyuam nyob hauv tsev kawm ntawv lossis tsis yog, lossis tsuas yog qhov chaw ntawm niam txiv. Peb kuj tseem tuaj yeem siv nws los kwv yees lub sijhawm twg uas cov niam txiv tuaj txog hauv tsev, yog li kev noj hmo tuaj yeem ua rau lub sijhawm raug. Nws kuj tseem yog qhov haujlwm txias uas nthuav tawm thiab nthuav tawm rau tsev neeg thiab phooj ywg.

Kuv vam tias koj txaus siab ua qhov Kev Qhia Ntawv no, lossis txaus siab nrhiav qhov project uas kuv tau ua

Kauj Ruam 1: Tau Txais Daim Ntawv Qhia 3D

Txhawm rau kom tau txais daim duab qhia chaw 3D ntawm koj thaj chaw, Kuv tau sau cais qhia kom pab coj koj mus dhau cov txheej txheem ntawm kev ua ib qho. Qhov txuas rau kev qhia yog ntawm no:

www.instructables.com/id/Making-a-3D-Print…

Kauj Ruam 2: Npaj Daim Ntawv Qhia rau LED Ntxig

Tam sim no koj muaj daim ntawv qhia 3D, nrog txoj kev, hauv nroog thiab dej ntws, peb xav tau ib txoj hauv kev qhia tias tus neeg nyob qhov twg hauv daim duab qhia chaw. Kuv siv ob-xim 3mm RG LEDs, vim lub hom phiaj tseem ceeb ntawm daim duab qhia chaw yog kom qhia ob niam txiv nyob qhov twg. Hauv qee qhov chaw kuv siv RGB LED, tso cai rau kuv qhia qhov twg yog tus menyuam hlob tshaj plaws. Muaj qhov txwv ntawm 28 tus pin rau tso tawm ntawm Raspberry Pi, Yog li xaiv qhov chaw ntawm LEDs kom zoo. Kuv tau xaus siv ib ncig ntawm 24 ntawm lawv, yog li koj yuav tsum zoo.

Txhawm rau laum PLA, Kuv pom ib qho ntoo me ntsis ua haujlwm tau zoo, thiab kuv kho yog zoo li kuv yuav kho ntoo.

Hauv cov chaw, qhov twg daim ntawv qhia tau tuab dhau, Kuv yuav laum tawm txheej txheej txheej nrog lub laum loj, thiab tom qab ntawd pom cov txheej saum toj no nrog qhov raug 3mm laum ntsis.

Kauj Ruam 3: Ntxig rau cov LEDs

Ntxig cov LEDs
Ntxig cov LEDs

Tam sim no peb muaj qhov rau LEDs zaum hauv, Peb tuaj yeem lo lawv rau hauv. PVA lossis Superglue ua haujlwm zoo rau qhov no, Kuv pom tias PVA tau khiav ncig nws muab nws khi rau hauv qhov chaw, thiab superglue kuj ua haujlwm zoo heev. Nco ntsoov tias nrog txhua LED, lawv tsuas yog lo tawm ntawm sab pom los ntawm ob peb mm, Vim tias muaj cov LEDs lo tawm txhua txoj kev zoo li tsis zoo ib yam. Tsis txhob txhawj xeeb txog ob txhais ceg nyob tom qab, peb tuaj yeem quav cov no ib zaug thaum lawv tau muag.

Kauj Ruam 4: Txuas cov LEDs rau Raspberry Pi

Kuv ncaj qha muag cov LEDs rau Raspberry Pi, txawm li cas los xij, yog tias koj muaj ib qho nrog lub taub hau ua ntej muag, lossis koj xav kom tuaj yeem siv pi rau lwm yam, tom qab ntawd kuv xav qhia siv jumper xov hlau rau txhua LED, lub ntsiab lus tias Pi yog tshem tawm. Koj tuaj yeem pom tias ib zaug kuv tau siv lub teeb LED, Kuv tau khawm ob txhais ceg kom lawv tsis lo rau tom qab.

Kauj Ruam 5: Xeem cov LEDs

Xeem cov LEDs
Xeem cov LEDs

Kom paub tseeb tias txhua lub LEDs ua haujlwm, Kuv tau sau ib tsab ntawv uas dhau los ntawm txhua tus pin uas tuaj yeem ua tau, thiab teeb lawv ib zaug, ib qho zuj zus, uas, dhau mus rau qhov tom ntej thaum kuv nyem nkag mus. Qhov no tau tso cai rau kuv kom sau tseg tus lej tus lej ua qhov chaw twg, uas tuaj yeem pab tau.

ntshuam RPi. GPIO ua GPIO

ntshuam sijhawm GPIO.setmode (GPIO. BCM) rau kuv hauv thaj tsam (0, 28): GPIO.setup (i, GPIO. OUT) rau kuv hauv ntau (0, 28): GPIO.output (i, GPIO. HIGH) time.sleep (0.3) GPIO.output (i, GPIO. LOW) print ("Uas Yog:" + str (i)) z = raw_input ("Tom ntej?")

Whilst qhov no tau tshwm sim, Kuv yuav sau cia ntawm kab ntawv uas tus pin ua qhov twg thiab xim twg. Koj yuav tsum ua qhov no, vim nws muaj txiaj ntsig zoo hauv qib tom ntej.

Kauj Ruam 6: Txoj Cai Txhawm rau Qhib LED Thaum Thov

Txoj kev uas kuv tau ua txoj haujlwm no cuam tshuam nrog ib qho Raspberry Pi Zero W, nrog lub vev xaib yooj yim uas tso cai rau koj tig tus pin. Qhov no txhais tau tias lub ntsiab Pi 4, uas feem ntau yog ua, thiab ua haujlwm, tuaj yeem ua tiav, thiab tom qab ntawd me Pi 0 tsuas yog yuav tsum tig tus pin, ua rau qee yam nyuab dua. Kuv tau ua qhov no vim tias nws haum rau kuv teeb tsa, thiab kuv kuj xav tias Pi 0 tuaj yeem qeeb me ntsis rau qhov peb yuav ua tom qab.

ntshuam RPi. GPIO ua GPIO

ntshuam lub sijhawm los ntawm lub raj mis ntshuam Flask, render_template, thov, jsonify ntshuam os app = Flask (_ name_) p = GPIO.setmode (GPIO. BCM) rau kuv hauv ntau (0, 28): GPIO.setup (kuv, GPIO. OUT) @app.route ('/') def index (): rov thov.remote_addr @app.route ("/off/") def turn_off (pin): GPIO.output (int (tus pin), GPIO. LOW) rov qab "Tawm" @app.route ("/tawm/tag nrho") def alloff (): rau kuv hauv ntau (0, 28): GPIO.output (i, GPIO. LOW) rov "tawm" @app.route ("/rau/") def turn_on (tus pin): GPIO.output (int (tus pin), GPIO. HIGH) rov "On" yog _name_ == '_main_': app.run (debug = Tseeb, host = '0.0. 0.0 ')

Txoj hauv kev no ua haujlwm yog nws tos rau qhov url ntawm pi tus IP chaw nyob thiab tom qab ntawd qhib lossis tawm thiab tom qab ntawd tus lej tus lej.

txuag cov cai no hauv phau ntawv qhia tsev ntawm Raspberry Pi, thiab npe nws "pin_website.py"

Koj yuav tsum teeb tsa qhov no kom ua haujlwm tau zoo, yog li ua qhov no, hauv hom davhlau ya nyob twg: sudo nano /etc /profile

Hauv qab ntawm cov ntawv no, ntxiv "python3 pin_website.py &"

"&" Yog qhov tseem ceeb, vim nws ua rau nws khiav hauv keeb kwm yav dhau, thiab yog li ntawd tso cai rau khau raj txuas ntxiv

Kauj Ruam 7: Yuav Ua Li Cas Txais Qhov Chaw

Yuav Ua Li Cas Tau Txais Qhov Chaw Nyob
Yuav Ua Li Cas Tau Txais Qhov Chaw Nyob

Siv IFTTT, koj tuaj yeem teeb tsa kev pabcuam kom thaum lub xov tooj nkag mus rau qee qhov chaw, nws tuaj yeem xa email rau koj, lossis ping lub vev xaib, lossis xa xov rau koj hauv xov tooj.

Kauj Ruam 8: Qhov No Txhua Yam Ua Li Cas

Kev teeb tsa kuv muaj yog Server Pi, hosting kuv lub vev xaib, nrog chaw nres nkoj xa mus thiab DNS zoo li qub siv cov kev pabcuam los ntawm https://freedns.afraid.org/. Ntau qhov no yog qhov nyuaj heev, thiab koj yuav tsum muaj kev nkag siab ntawm kev xa mus rau chaw nres nkoj, Kuv yuav ua tus qhia kom paub yuav ua li cas ua ntu no lwm lub sijhawm.

Lwm txoj hauv kev koj tuaj yeem ua nws yog siv xov tooj xa xov mus rau tus pi, lossis tej zaum qhov yooj yim tshaj plaws, yog teeb tsa tus nyeem ntawv email uas nyeem email thiab txais qhov chaw hloov tshiab ntawm qhov ntawd.

Kuv tsis tau sim Telegram bot lossis email nyeem ntawv, tab sis muaj ntau cov kev qhia tawm uas yuav qhia koj yuav ua li cas.

Nov yog kuv lub khob / Python code uas yog tom qab ntawv thov los ntawm webhooks siv IFTTT:

los ntawm lub raj mis ntshuam Flask, render_template, thov, jsonify

ntshuam os los ntawm datetime ntshuam datetime los ntawm daim ntawv qhia ntshuam * app = Flask (_ name_) l = 0 teeb () @app.route ('/') def index (): rov thov.remote_addr @app.route ('/niam/nkag /') def mu (qhov chaw): mum.current_loc (qhov chaw) rov qab "Ua Tsaug Rau Qhov Hloov Tshiab, Niam!" @app.route ("/dad/enter/") def da (l): dad.current_loc (l) return "Ua Tsaug Rau Qhov Hloov Tshiab, Txiv!" @app.route ("/menyuam/nkag/") def child_enter (l): me.current_loc (l) rov "Hav, Kuv" @app.route ('/niam/tawm/') def mume (qhov chaw): mum.offline (qhov chaw) rov qab "Ua Tsaug Rau Qhov Hloov Tshiab, Niam!" @app.route ("/dad/exit/") def dade (l): dad.offline (l) return "Tsaug Rau Qhov Hloov Tshiab, Txiv!" @app.route ("/menyuam/tawm/") def child_exit (l): me.offline (l) rov "Hav, Kuv" @app.route ("/rov pib dua") def rov ua dua (): teeb tsa () rov qab "Pib dua!" yog _name_ == '_main_': app.run (debug = True, host = '0.0.0.0')

thiab map.py:

ntshuam http.client, urllib.request, urllib.parse, urllib.error, base64

ntshuam ast, json lub sijhawm ntshuam ntshuam ntshuam ntshuam os params = urllib.parse.urlencode ({}) last_loc = 0 dlast_loc = 0 mlast_loc = 0 def teeb tsa (): conn = http.client. HTTPSConnection ('freedns.afraid.org') conn.request ("GET", str ("/dynamic/update.php? "Tau", str ("/tawm/tag nrho")) teb = conn.getresponse () f = qhib ("tus pin", "w") f.write (str (-1)) f.close () f = qhib ("pind", "w") f.write (str (-1)) f.close () f = qhib ("pinm", "w") f.write (str (-1)) f.close () kawm ntawv niam: def tam sim no_loc (l): ntiaj teb kawg_loc locs = {"llansantffraid": 4, "oswestry": 5, "lynclys": 8, "tsev": 9, "shrewsbury": 11, "llanymynech": 13, "plaub tus ntoo khaub lig": 18, "llandrinio": 25, "welshpool": 27} f = qhib ("tus pin", "w") f.write (str (-1)) f.close () lub sijhawm. pw tsaug zog (1) conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.request ("GET", str ("/off/") + str (last_loc)) teb = conn.getrespons e () conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.request ("Tau", str ("/rau/") + str (locs [l])) teb = conn.getresponse () last_loc = locs [l] def offline (l): ntiaj teb kawg_loc locs = {"llansantffraid": 4, "oswestry": 5, "lynclys": 8, "home": 9, "shrewsbury": 11, "llanymynech ": 13," plaub tus ntoo khaub lig ": 18," llandrinio ": 25," welshpool ": 27} conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.request (" GET ", str (" /tawm/") + str (last_loc)) teb = conn.getresponse () f = qhib (" tus pin "," w ") f.write (str (locs [l])) f.close () os.system ("python3 flash.py &") chav txiv: locs = {"welshpool": 3, "lynclys": 1, "tsev": 23, "shrewsbury": 0, "llanymynech": 6, "plaub tus ntoo khaub lig": 15, "llandrinio": 10, "welshpool": 24} def current_loc (l): ntiaj teb dlast_loc locs = {"welshpool": 3, "lynclys": 1, "home": 23, "shrewsbury": 0, " llanymynech ": 6," plaub tus ntoo khaub lig ": 15} f = qhib (" pind "," w ") f.write (str (-1)) f.close () time.sleep (1) conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.reques t ("GET", str ("/off/") + str (dlast_loc)) teb = conn.getresponse () conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.request ("GET", str ("/on/") + str (locs [l])) response = conn.getresponse () dlast_loc = locs [l] def offline (l): ntiaj teb dlast_loc locs = {"welshpool": 3, "lynclys ": 1," tsev ": 23," shrewsbury ": 0," llanymynech ": 6," plaub tus ntoo khaub lig ": 15," llandrinio ": 10} conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.request ("GET", str ("/off/") + str (dlast_loc)) teb = conn.getresponse () f = qhib ("pind", "w") f.write (str (locs [l])) f.close () os.system ("python3 flashd.py &") class me: def current_loc (l): global mlast_loc locs = {"home": 22, "school": 2, "oswestry": 14} f = qhib ("pinm", "w") f.write (str (-1)) f.close () time.sleep (1) conn = http.client. HTTPConnection ('192.168.1.251:5000 ') conn.request ("GET", str ("/off/") + str (mlast_loc)) teb = conn.getresponse () conn = http.client. HTTPConnection (' 192.168.1.251:5000 ') conn.request ("Tau", str ("/rau/") + str (lo cs [l])) teb = conn.getresponse () mlast_loc = locs [l] def offline (l): ntiaj teb dlast_loc locs = {"tsev": 22, "tsev kawm ntawv": 2, "oswestry": 14} conn = http.client. HTTPConnection ('192.168.1.251:5000') conn.request ("GET", str ("/off/") + str (mlast_loc)) teb = conn.getresponse () f = qhib ("pinm", "w") f.write (str (locs [l])) f.close () os.system ("python3 flashm.py &")

Kauj Ruam 9: Tsim Koj Tus Kheej Los Ntawm Kev Tshaj Tawm Ntawm Kuv Qhov Project

Yog li kuv paub tias cov kauj ruam dhau los yuav nyuaj rau nkag siab, yog li kuv yuav tso nws raws li qhia koj yuav ua li cas hauv daim duab qhia chaw, thiab tuaj yeem muaj raspberry pi uas qhib thiab tawm ntawm LEDs. Tam sim no koj yuav tsum tsim tsab ntawv nab nab uas, siv IFTTT, email rau koj. Tom qab ntawd koj yuav tsum nrhiav email nyeem kab ntawm cov cai, uas yog qhov yooj yim heev (google nws). Tom qab ntawd ib zaug koj nyeem email thiab pom tus niam txiv nyob qhov twg, siv 'yog' cov lus los nrhiav tus pin twg los qhib.

Ntawm daim duab qhia chaw, Lub teeb ci ntsa iab txhais tau tias lawv nyuam qhuav tawm ntawm thaj chaw ntawd

Txoj hauv kev qhib cov LEDs ntawm lwm tus pi los ntawm nab nab yog li hauv qab no:

ntshuam http.client, urllib.request, urllib.parse, urllib.error, base64

params = urllib.parse.urlencode ({}) conn = http.client. HTTPConnection ('192.168.1.251:5000') #hloov qhov no nrog raspberry pi daim ntawv qhia tus IP chaw nyob conn.request ("Tau", str ("/tawm /2 ")) # qhov no tua tus lej tus lej 2 cov lus teb = conn.getresponse () # qhov no thov qhov URL, thiab tom qab ntawv daim ntawv qhia pi nyeem qhov no thiab tua tus lej tus lej 2

Yeej, Kuv vam tias koj tuaj yeem siv qhov kuv tau ua nrog kuv daim duab qhia 3D ua kev tshoov siab los ua koj tus kheej GPS taug qab daim ntawv qhia.

Pom zoo: