Cov txheej txheem:

Tsom iav ntse: 4 Kauj Ruam
Tsom iav ntse: 4 Kauj Ruam

Video: Tsom iav ntse: 4 Kauj Ruam

Video: Tsom iav ntse: 4 Kauj Ruam
Video: Tus Neeg Ruam - R-Lin Thoj | New Song [ Official MV ] Nkauj Tawm Tshiab 2023 Hmong Song 2023 2024, Hlis ntuj nqeg
Anonim
Ntse tsom iav
Ntse tsom iav
Ntse tsom iav
Ntse tsom iav

Nyob zoo txhua tus neeg hnub no kuv yuav qhia koj yuav ua li cas thiaj ua Smart Glasses hauv tsev! Ib qho tseem ceeb tshaj plaws ntawm tsom iav ntse yog qhov muaj txiaj ntsig zoo li cas yog muaj qee yam zoo li no hauv ntiaj teb kev siv thev naus laus zis niaj hnub no thiab yuav ua li cas tsis yog tsuas yog ib qho ntawm cov iav tsom iav zoo li txhua tus muaj cov yam ntxwv zoo kawg thiab muaj qhov kawg ntawm cov ntawv thov uas tuaj yeem koom ua ke yav tom ntej Cov yam ntxwv ntawm cov tsom iav ntse no suav nrog qhia sijhawm, qhia koj qhov ntsuas kub txhua 5 feeb, nruab nrab ntawm cov 5 feeb nws sib pauv ntawm qhov xav tau siab thiab qis kub rau hnub ntawd, nws tseem qhia koj hnub tim. Tab sis nws lub ntsiab tseem ceeb yog nws siv daim duab txhua 10 vib nas this thiab tom qab ntawd tshuaj xyuas daim duab ntawd rau cov ntawv uas nws yuav rov qab cov ntaub ntawv muaj txiaj ntsig txog nws, yog tias nws pom cov lus nug ces nws yuav teb nws siv wolfram, lossis yog nws pom qhov zauv zauv nws yuav daws nws!

Khoom siv:

Cov khoom siv tsim nyog rau txoj haujlwm no yuav suav nrog cov hauv qab no:

1) Raspberry Pi 0 W (Los ntawm vilros.com)

2) Pom meej 128x64 OLED zaub (Los ntawm Sparkfun.com)

3) Lub koob yees duab qauv teeb tsa rau Raspberry Pi 0 W (Los ntawm amazon.com)

4) Txhua lub iav uas koj xaiv

5) Cov xov hlau

6) Soldering hlau

7) Tsis muaj cov hmoov lead dawb (vim koj tsis xav tuag los ntawm txhuas)

8) 2 txoj kev nplaum

9) SD daim npav min ntawm 8gb

10) computer thiab internet txuas

Piv txwv tias koj twb muaj lub khoos phis tawj thiab siv internet txuas tus nqi ntawm cov tsom iav no yuav los nyob ib puag ncig $ 130.00

Kauj ruam 1: Txuas lub Circuit Court

Tiv thaiv Circuit Court!
Tiv thaiv Circuit Court!

Txhawm rau kom pom cov ntawv ntawm lub vijtsam koj yuav tau txuas rau OLED ntawm I2C lossis SPI, Kuv xaiv I2C vim nws yog qhov kuv nyiam siv tab sis yog koj xav tias txuas nrog nws ntawm SPI mus ua raws cov lus qhia no Sparkfun lub vev xaib thiab rov qab los ntawm no thaum koj ua tiav. https://learn.sparkfun.com/tutorials/transparent-g… Yog tias koj tau xaiv I2C raws li kuv tau xaim cov xov hlau raws li qhia hauv qab no:

Pib \/ OLED \/

3.3v 3.3v ib

GND GND

SDA SDA

SCL SCL Cov

Thov nco ntsoov tias qhov tseeb OLED tuaj yeem ua haujlwm tau 3.3v.

Tom qab koj tau ua tiav kev sib txuas hauv Circuit Court, xaub daim kab xev ntawm lub koob yees duab hloov pauv mus rau tus tuav txoj hlua khi ntawm raspberry pi los ntawm kev rub tawm cov xim dub thiab swb nws rov qab thaum cov hlua kab nyob hauv qhov chaw.

Kauj ruam 2: Nkag mus rau Raspberry Pi

Siv ssh peb tuaj yeem nkag mus rau peb tus pi nrog peb lub pc yam tsis txuas lwm cov keyboard sab nraud ntxiv thiab saib xyuas. Thawj qhov koj ua yog txuas koj daim npav SD rau hauv koj lub PC nrog lub adapter lossis lub chaw tsim ua, tom qab ntawd koj yuav tsum tau taub hau mus rau qhov txuas no https://www.raspberrypi.org/downloads/raspbian/ thiab rub Raspbian buster nrog desktop. Qhov thib ob koj yuav tsum tso OS rau hauv daim npav SD siv BalenaEtcher xaiv koj daim npav SD thiab Raspbian OS thiab nyem "nyem" cov txheej txheem no tuaj yeem siv qee lub sijhawm yog li rov qab los thaum koj ua tiav. Thib peb mus rau SD daim npav hauv cov ntawv tshawb nrhiav lossis tshawb pom ntawm mac thiab tsim cov ntawv sau npe wpa_supplicant nco ntsoov tshem tawm.txt ncua ntxiv thiab ntxiv.conf, hauv cov ntawv muab cov hauv qab no:

teb chaws = US

ctrl_interface = DIR =/var/run/wpa_supplicant GROUP = netdev update_config = 1 network = {ssid = "WIFI_SSID" scan_ssid = 1 psk = "WIFI_PASSWORD" key_mgmt = WPA-PSK}

Koj yuav tsum tau nkag mus rau koj lub npe WiFi thiab tus lej zais hauv qhov chaw sib xws thiab lub tebchaws yog tias koj tsis nyob hauv Asmeskas. Nco ntsoov tias Raspberry Pi tuaj yeem txuas rau 2.4Ghz network txhais tau tias koj lub pc tseem yuav tau txuas rau lub network ntawd. Tom qab tsim cov ntawv sau tsis muaj qhov txuas ntxiv hu ua ssh thiab tom qab ntawd tshem koj daim npav SD. Tom qab ntawd koj yuav tsum tau teeb tsa PuTTY https://www.putty.org/ uas yog yam koj yuav siv los pab ssh. Thaum teeb tsa nkag mus rau tus IP chaw nyob ntawm koj tus raspberry pi, koj tuaj yeem paub tias nws yog dab tsi los ntawm kev mus rau koj lub routers lub vev xaib nkag mus thiab saib cov khoom siv sib txuas.

Tom qab koj nkag mus rau Raspberry Pi nws yuav nug koj kom nkag mus-hauv, lub npe siv tsis raug yog "pi" thiab tus password yog "raspberry". Ntaus sudo raspi-teeb tsa tom qab ntawd mus rau cuam tshuam cov kev xaiv thiab qhib lub koob yees duab, ssh, thiab i2c, tom qab ntawd nyem qhov kawg thiab ntaus sudo rov pib dua. Tam sim no koj tau npaj ssh rau hauv raspberry pi, mus tom ntej thiab nruab Chaw Taws Teeb Chaw thiab nkag mus rau koj li raspberry pi tus IP chaw nyob thiab tam sim no koj zoo rau ssh rau hauv raspberry pi.

Kauj ruam 3: Coding Sijhawm

Sijhawm Coding!
Sijhawm Coding!

Kuv tau xaiv los ua txoj haujlwm no hauv nab hab sej kom ntseeg tau tias koj muaj python3.7 lossis 3.8 teeb tsa ntawm koj lub desktop. Txoj cai no ua haujlwm los ntawm kev siv server thiab tus neeg siv khoom, qhov sib cais yog koj lub pc. Tus neeg siv khoom lossis tus neeg raspberry pi yuav thaij duab thiab upload qhov ntawd rau hauv dropbox uas yog khaws los ntawm tus neeg rau zaub mov uas tom qab ntawd ua cov duab ua thiab lees paub cov ntawv ntawm daim duab. Koj yuav tsum tau txais wolframalpha, dropbox, thiab openweathermap app-id rau qhov no kom ua haujlwm, txhua yam koj yuav tsum tau ua yog mus rau cov vev xaib sau npe thiab nws yuav muab koj li app-id. thiab tom qab ntawd nkag mus rau hauv cov chaw sib xws uas tau txiav txim siab los ntawm cov lus hauv cov cai. Nco ntsoov tias koj tau nruab pip txhua yam thiab teeb tsa Tesseract OCR thiab OpenCV. Tsim cov ntaub ntawv sej npe hu ua Server.py ntawm koj lub pc thiab cov ntaub ntawv muaj npe client.py ntawm raspberry pi thiab tom qab ntawd theej thiab paste cov cai. Tab sis paub tias cov ntawv loj dua thiab ua rau lub keeb kwm yav dhau los ua kom tau zoo dua, qhov no yog qhov xwm txheej nrog txhua qhov software lees paub software.

Txhua qhov txuas mus rau npe rau app-id \/

www.wolframalpha.com/

openweathermap.org/api

www.dropbox.com/developers/documentation

Nco ntsoov tias koj nruab Tesseract OCR thiab OpenCV \/

github.com/UB-Mannheim/tesseract/wiki

opencv.org/

Server.py:

ntshuam dropboxfrom PIL ntshuam duab ntshuam cv2 ntshuam pytesseract los ntawm pytesseract ntshuam Ntshuam ntshuam numpy li np ntshuam wolframalpha ntsaws ntshuam lub sijhawm

dbx = dropbox. Dropbox ("dropboxAPIkey")

s = socket.socket (socket. AF_INET, socket. SOCK_STREAM)

app_id = "App-ID"

host = socket.gethostname ()

chaw nres nkoj = 60567 print (host) s.bind ((host, port)) s.listen (2)

thaum Muaj Tseeb:

c, addr = s.accept () print (f'Got txuas los ntawm: {addr} ') tawg

thaum Muaj Tseeb:

thaum muaj tseeb: sijhawm.sleep (13.7) metadata, f = dbx.files_download ("/dropbox_API/Image.jpg") tawm = qhib ("Image.jpg", 'wb') out.write (f.content) tawm. kaw () luam tawm ("Duab rub tawm!") duab = cv2.imread ("Image.jpg") Duab = cv2.resize (duab, (640, 480), interpolation = cv2. INTER_AREA) image68 = cv2.rotate (Duab, cv2. ROTATE_90_COUNTERCLOCKWISE) grey = cv2.cvtColor (duab 68, cv2. COLOR_BGR2GRAY)

def tshem_noise (grey):

rov cv2.medianBlur (grey, 5) def thresholding (grey): xa cv2.threshold (grey, 0, 255, cv2. THRESH_BINARY + cv2. THRESH_OTSU) [1] def dilate (grey): kernel = np.ones ((5, 5), np.uint8) return cv2.dilate (grey, kernel, iterations = 1) d = pytesseract.image_to_data (grey, output_type = Output. DICT)

n_boxes = len (d ['ntawv'])

rau kuv hauv ntau (n_boxes): yog int (d ['conf'] )> 60: (x, y, w, h) = (d ['sab laug'] , d ['saum'] , d ['dav'] , d ['qhov siab'] ) grey = cv2.rectangle (grey, (x, y), (x + w, y + h), (0, 255, 0), 2) so pytesseract.pytesseract.tesseract_cmd = r "C: / Program Files / Tesseract-OCR / tesseract.exe" text = pytesseract.image_to_string (grey) print (text) while True: text2 = " "if len (text)> = 2: c.send (bytes (text," utf-8 ")) if len (text) = 2: query = text client = wolframalpha. Client (app_id) res = client.query (lus nug) teb = tom ntej (res.results).text answer1 = answer.partition ('\ n') [0] print (answer1) c.send (bytes (answer1, "utf-8")) yog len (ntawv nyeem) <= 1: c.send (bytes (text2, "utf-8")) time.sleep (7.5) so

Client.py:

ntshuam dropboximport picameraimport lub sijhawm los ntawm luma.core.interface.serial ntshuam i2c los ntawm luma.core.render ntshuam canvas los ntawm luma.oled.device ntshuam ssd1306, ssd1325, ssd1331, sh1106 ntsaws ntshuam ntshuam lub sijhawm los ntawm lub sijhawm ntshuam ntshuam ntshuam pyowm serial = i2c (chaw nres nkoj = 1, chaw nyob = 0x3C) ntaus ntawv = ssd1306 (serial, tig = 1) lub koob yees duab = picamera. PiCamera () dropbox_access_token = "" #Koj dropbox-id dua computer_path = r "/home/pi/Image.jpg" dropbox_path = f "/dropbox_API/Image.jpg" s = socket.socket (socket. AF_INET, socket. SOCK_STREAM) host = "" #ip chaw nyob ntawm koj lub pc chaw nres nkoj = 60567 s.connect ((host, port)) msg1 = "" owm = pyowm. OWM ("")#app-id rau openweathermap num = ["05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "00"] cdt = datetime.datetime.now () min1 = str (cdt.minute) hnub tim = str (cdt.day) + "/" + str (cdt. hli) + "/" + str (cdt.year) obs = owm.weather_at_place ("")#koj lub nroog thiab lub tebchaws nyob rau hauv txoj hlua hom huab cua = obs.get_weather () temp2 = str (weather.get_temperature ("fahrenheit") ["koj mp_max "]) temp3 = str (weather.get_temperature (" fahrenheit ") [" temp_min "]) thaum True: cdt = datetime.datetime.now () min1 = str (cdt.minute) teev = str (cdt.hour) nrog canvas (ntaus ntawv) raws li kos: kos.text ((0, 0), teev, sau = "dawb") kos.text ((11, 0), ":", sau = "dawb") kos.text ((15, 0), min1, sau = "dawb") kos.text ((0, 9), "_", sau = "dawb") kos.text ((0, 9), hnub tim, sau = "dawb" ") yog min1 hauv tus lej: obs = owm.weather_at_place (" ")#koj lub nroog thiab lub tebchaws nyob rau hauv hom ntawv dua

huab cua = obs.get_weather ()

temp = str (weather.get_temperature ("fahrenheit") ["temp"]) draw.text ((32, 0), "F", sau = "dawb") kos.text ((40, 0), temp, sau = "dawb") yog min1 tsis nyob hauv tus lej: kos.text ((40, 0), temp2, sau = "dawb") kos.text ((32, 0), "F", sau = "dawb") camera.start_preview () time.sleep (2) camera.capture ("/home/pi/Image.jpg") camera.stop_preview client = dropbox. Dropbox (dropbox_access_token) print ("[SUCCESS] dropbox account linked") tus neeg siv khoom. files_upload (qhib (computer_path, "rb"). nyeem (), dropbox_path) print ("[UPLOADED] {}". format (computer_path)) full_msg = "" time.sleep (5) msg = s.recv (100) yog len (msg)> = 2: full_msg += msg.decode ("utf-8") print (full_msg) cdt = datetime.datetime.now () min1 = str (cdt.minute) teev = str (cdt.hour) nrog canvas (ntaus ntawv) raws li kos: kos.text ((0, 19), puv_msg, sau = "dawb") kos.text ((0, 0), teev, sau = "dawb") kos.text ((11, 0), ":", sau = "dawb") kos.text ((15, 0), min1, sau = "dawb") kos.text ((0, 9), "_", sau = " dawb ") kos.text ((0, 9), hnub tim, sau = "dawb") yog min1 hauv tus lej: obs = owm.weather_at_place ("")#koj lub nroog thiab lub tebchaws nyob rau hauv txoj hlua dua

huab cua = obs.get_weather ()

temp = str (weather.get_temperature ("fahrenheit") ["temp"]) draw.text ((32, 0), "F", sau = "dawb") kos.text ((40, 0), temp, sau = "dawb") yog min1 tsis nyob hauv tus lej: kos.text ((40, 0), temp3, sau = "dawb") kos.text ((32, 0), "F", sau = "dawb") yog len (msg) <= 1: cdt = datetime.datetime.now () min1 = str (cdt.minute) teev = str (cdt.hour) nrog canvas (ntaus ntawv) raws li kos: kos.text ((0, 0), teev, sau = "dawb") kos.text ((11, 0), ":", sau = "dawb") kos.text ((15, 0), min1, sau = "dawb") kos. ntawv ((0, 9), "_", sau = "dawb") kos.text ((0, 9), hnub tim, sau = "dawb") yog min1 hauv tus lej: obs = owm.weather_at_place ("") #yog koj lub nroog thiab lub tebchaws nyob rau hauv txoj kab ntawv dua

huab cua = obs.get_weather ()

temp = str (weather.get_temperature ("fahrenheit") ["temp"]) draw.text ((32, 0), "F", sau = "dawb") kos.text ((40, 0), temp, sau = "dawb") yog min1 tsis nyob hauv tus lej: kos.text ((40, 0), temp3, sau = "dawb") kos.text ((32, 0), "F", sau = "dawb") time.sleep (5.4) full_msg1 = "" msg1 = s.recv (100) yog len (msg1)> = 2: full_msg1 += msg1.decode ("utf-8") full_msg2 = ("\ n".join (textwrap.wrap (full_msg1, 9))) cdt = datetime.datetime.now () min1 = str (cdt.minute) teev = str (cdt.hour) nrog canvas (ntaus ntawv) raws li kos: kos.text ((0, 19), puv_msg, sau = "dawb") kos.text ((0, 29), puv_msg2, sau = "dawb") kos.text ((0, 0), teev, sau = "dawb") kos.text ((11, 0), ":", sau = "dawb") kos.text ((15, 0), min1, sau = "dawb") kos.text ((0, 9), "_", sau = "dawb") kos.text ((0, 9), hnub tim, sau = "dawb") yog min1 hauv tus lej: obs = owm.weather_at_place ("")#koj lub nroog thiab lub tebchaws nyob rau hauv hom ntawv dua

huab cua = obs.get_weather ()

temp = str (weather.get_temperature ("fahrenheit") ["temp"]) draw.text ((32, 0), "F", sau = "dawb") kos.text ((40, 0), temp, sau = "dawb") yog min1 tsis nyob hauv tus lej: obs = owm.weather_at_place ("")#koj lub nroog thiab lub tebchaws nyob hauv txoj hlua

huab cua = obs.get_weather ()

temp = str (weather.get_temperature ("fahrenheit") ["temp"]) draw.text ((32, 0), "F", sau = "dawb") kos.text ((40, 0), temp, sau = "dawb") yog min1 tsis nyob hauv tus lej: kos.text ((40, 0), temp3, sau = "dawb") kos.text ((32, 0), "F", sau = "dawb") yog len (msg1) <= 1: cdt = datetime.datetime.now () min1 = str (cdt.minute) teev = str (cdt.hour) nrog canvas (ntaus ntawv) raws li kos: kos.text ((0, 0), teev, sau = "dawb") kos.text ((11, 0), ":", sau = "dawb") kos.text ((15, 0), min1, sau = "dawb") kos. ntawv ((0, 9), "_", sau = "dawb") kos.text ((0, 9), hnub tim, sau = "dawb") yog min1 hauv tus lej: obs = owm.weather_at_place ("") #yog koj lub nroog thiab lub tebchaws nyob rau hauv txoj kab ntawv dua

huab cua = obs.get_weather ()

temp = str (weather.get_temperature ("fahrenheit") ["temp"]) draw.text ((32, 0), "F", sau = "dawb") kos.text ((40, 0), temp, sau = "dawb") yog min1 tsis nyob hauv tus lej: kos.text ((40, 0), temp3, sau = "dawb") kos.text ((32, 0), "F", sau = "dawb") time.sleep (7) client.files_delete (dropbox_path) luam tawm ("Cov ntaub ntawv tshem tawm")

PS Kuv yog tus pib xyaum ua programmer yog li thov tsis txhob nug kuv cov txheej txheem kev txaus ntshai.

Kauj Ruam 4: Muab Nws Ua Ke

Muab tag nrho ua ke!
Muab tag nrho ua ke!

Thaum koj ua tiav txhua yam ntxiv koj tau ua tiav txhua yam koj tau ua dhau los yog txuas lub koob yees duab raspberry pi thiab tso rau lub tsom iav. Koj tuaj yeem ua qhov no los ntawm kev siv daim nplaum ob sab hais hauv cov khoom lossis koj tuaj yeem siv txhua txoj hauv kev uas koj xav tias tsim nyog. Koj kuj tseem yuav tau pom tias kuv tsis tau hais txog lub roj teeb nyob txhua qhov hauv zaj lus qhia no vim tias kuv muaj kev txhim kho yav tom ntej npaj rau cov tsom iav no thiab tsis xav txuas ib qho tam sim no. Tab sis yog tias koj xav txuas ib qho koj yuav xav tau lub tshuab hluav taws xob li-po los ntawm amazon

Yog tias koj nyiam qhov no thiab xav pom ntau dua, Kuv tau pib YouTube channel thiab vam tias yuav tshaj tawm cov lus qhia ntawm qhov ntawd ib yam. Nov yog qhov txuas:

www.youtube.com/channel/UCGqcWhHXdZf231rLe…

Vajtswv cawm!

Yauhas 3:16 "Rau qhov Vajtswv hlub neeg ntiaj teb kawg li uas nws tau muab Nws tib leeg Tub thiab tus uas ntseeg hauv Nws ib txhis tsis ploj mus tab sis yuav tau txoj sia nyob mus ib txhis."

Pom zoo: