Cov txheej txheem:

TfCD - Ntxiv rau: 7 Kauj Ruam
TfCD - Ntxiv rau: 7 Kauj Ruam

Video: TfCD - Ntxiv rau: 7 Kauj Ruam

Video: TfCD - Ntxiv rau: 7 Kauj Ruam
Video: TFCD 14 de Mayo 2024, Hlis ntuj nqeg
Anonim
Image
Image
Cov khoom xyaw
Cov khoom xyaw

Ntxiv rau yog lub teeb pom kev zoo me me, uas tsis tsuas yog ceeb toom rau tib neeg txog huab cua, tab sis kuj tsim kev txaus siab rau cov neeg siv los ntawm kev hloov pauv hauv xim ntawm lub teeb los ntawm kev hloov pauv ntxiv. Nws cov duab muab sijhawm rau cov neeg siv los ua ke ntau ntxiv cov qauv lossis tsim lub teeb loj loj nrog ntau ntau ntxiv cov khoom tso los ntawm cov phooj ywg. Txoj haujlwm teeb pom kev zoo no yog ib feem ntawm Kev Kawm Txuj Ci Siab (ACD) ntawm TU Delft tsev kawm ntawv, thiab thev naus laus zis siv los ntawm kev siv TfCD cov tswv yim los ua qhov chaw txhawb siab.

Kauj ruam 1: Cov khoom xyaw

Cov khoom xyaw
Cov khoom xyaw
Cov khoom xyaw
Cov khoom xyaw

1 Raspberry pi zero w

1 Groove Adxl345 accelerometer

4 Ws2812b LED

1 Pawg thawj coj saib xyuas

3D luam ntawv thiab laser-cut enclosures

Kauj ruam 2: Kho vajtse

Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse
Kho vajtse

LEDs

Neopixel LEDs muaj 4 tus pin npe: +5V, GND, Cov Ntaub Ntawv Hauv thiab Cov Ntaub Ntawv tawm.

  1. Pin 4 ntawm raspberry pi txuas nrog +5V ntawm txhua lub LEDs
  2. Pin 6 ntawm raspberry pi txuas nrog GND ntawm txhua LEDS
  3. Cov Ntaub Ntawv Hauv tus pin ntawm thawj LED txuas nrog tus pin 12 ntawm raspberry pi.
  4. Cov Ntaub Ntawv tawm tus pin ntawm thawj LED txuas nrog Cov Ntaub Ntawv hauv qhov thib ob thiab lwm yam.

Thov ua tibzoo saib daim kab xev kom nkag siab zoo dua.

Accelerometer

Tus ntsuas qhov ntsuas muaj 4 tus pin npe: VCC, GND, SDA thiab SCL.

  1. Pin 1 ntawm raspberry pi txuas nrog VCC.
  2. Tus pin 3 ntawm raspberry pi txuas nrog SCL.
  3. Pin 5 ntawm raspberry pi txuas nrog SDA.
  4. Pin 9 ntawm raspberry pi txuas nrog GND.

Tsim

  1. Txhawm rau kom yooj yim, cov LEDs tuaj yeem muab muag rau ntawm pawg thawj coj saib. Peb tau txiav txim siab txiav lub rooj tsavxwm rau hauv cov duab ntxiv kom nws haum zoo hauv 3D tsim rooj plaub.
  2. Thaum peb tau muab cov LEDs tso rau ntawm lub rooj tsavxwm, peb tau xaim cov hlua txuas txuas kom sib txuas ntawm 0.1 "lub taub hau txuas thiab LEDs.

Kauj ruam 3: Software

Software
Software

Raspberry Pi Operating System Duab

Peb thawj zaug yuav tsum tau txais Raspberry Pi thiab ua haujlwm. Txhawm rau ua qhov no peb ua raws cov theem hauv qab no:

  1. Rub tawm qhov tseeb version ntawm Raspbian los ntawm no. Koj tuaj yeem rub nws ncaj qha lossis dhau ntawm torrents. Koj yuav xav tau tus kws sau duab los sau qhov rub tawm OS rau hauv daim npav SD (daim npav micro SD thaum Raspberry Pi B+ qauv thiab Raspberry Pi Zero).
  2. Yog li rub tawm "win32 disk imager" los ntawm no. Ntxig daim npav SD rau hauv lub khoos phis tawj/pc thiab khiav tus sau daim duab. Thaum qhib, xauj thiab xaiv cov duab Raspbian rub tawm. Xaiv lub cuab yeej raug, uas yog tus tsav sawv cev rau SD daim npav. Yog tias tus tsav (lossis khoom siv) xaiv sib txawv ntawm daim npav SD ces lwm qhov kev xaiv tsav yuav dhau los ua tsis ncaj. Yog li ceev faj.
  3. Tom qab ntawd, nyem rau ntawm "Sau" khawm hauv qab. Ua piv txwv, pom cov duab hauv qab no, qhov twg daim npav SD (lossis micro SD) tsav tau sawv cev los ntawm tsab ntawv "G: \" Lub OS tam sim no tau npaj rau kev siv ib txwm muaj. Txawm li cas los xij hauv qhov kev qhia no peb yuav siv Raspberry Pi hauv hom taub hau. Qhov no txhais tau tias tsis muaj lub cev saib xyuas thiab cov keyboard txuas rau nws!
  4. Tom qab hlawv daim npav SD, tsis txhob tshem nws tawm ntawm koj lub computer! Siv cov ntawv sau los qhib cov ntawv config.txt uas nyob hauv daim npav SD. Mus rau hauv qab thiab ntxiv dtoverlay = dwc2as kab kawg:
  5. Txuag cov ntaub ntawv config.txt ua cov ntawv yooj yim thiab tom qab ntawd qhib cmdline.txt Tom qab rootwait (lo lus kawg ntawm thawj kab) ntxiv qhov chaw thiab tom qab ntawd modules-load = dwc2, g_ether.
  6. Tam sim no tshem daim npav SD ntawm koj lub PC thiab ntxig nws rau hauv Raspberry Pi thiab txuas nws rau koj lub PC siv USB cable. Thaum OS tau pib ua haujlwm, koj yuav tsum pom lub cuab yeej Ethernet Gadget tshiab tau pom.
  7. Koj tuaj yeem siv ssh [email protected] los txuas rau pawg thawj coj saib xyuas thiab tswj nws nyob deb. Ua cov lus qhia ntxaws txog kev ua haujlwm tsis muaj taub hau mus ntawm no. Neopixel Driver

Rpi_ws281x lub tsev qiv ntawv yog tus yuam sij uas ua rau siv NeoPixels nrog Raspberry Pi ua tau.

Ua ntej peb yuav tsum teeb tsa cov cuab yeej xav tau los sau cov tsev qiv ntawv. Hauv koj li Raspberry Pi khiav: sudo apt-tau hloov tshiab && sudo apt-get install build-essential python-dev git scons swig Tam sim no khiav cov lus txib no mus rub tawm thiab sau cov tsev qiv ntawv:

git clone https://github.com/jgarff/rpi_ws281x.git && cd rpi_ws281x && scons Thaum kawg, tom qab lub tsev qiv ntawv tau ua tiav ua ke, peb tuaj yeem nruab nws rau nab nab siv:

cd nab hab sej && sudo nab hab sej setup.py nruab Tam sim no los txog tus nab npawb nab npawb uas tsav lub LEDs. Cov cai yog yooj yim haum nrog qee cov lus los pab koj. los ntawm neopixel ntshuam * # NeoPixel teeb tsa LED_PIN = 18 # Raspberry Pi's GPIO tus pin txuas nrog lub pixels LED_BRIGHTNESS = 255 # Teeb rau 0 rau qhov tsaus ntuj tshaj plaws thiab 255 rau qhov ci tshaj plaws LED_COUNT = 4 # Tus lej ntawm LED kab txaij = Adafruit_NeoPixel (LED_COUNT, LED_PIN, 800000, 5, Cuav, LED_BRIGHTNESS, 0, ws. WS2811_STRIP_GRB) # Pib lub tsev qiv ntawv strip.begin () strip.setPixelColor (0, Xim (255, 255, 255)) strip.show ()

ADXL345 tsav tsheb

Lub ntsuas qhov ntsuas uas peb tau xaiv muaj I2C cuam tshuam rau kev sib txuas lus nrog ntiaj teb sab nraud. Hmoov zoo rau peb, Raspberry Pi kuj muaj I2C interface. Peb tsuas yog xav kom nws siv nws hauv peb tus kheej cov cai.

Hu rau Raspbian cov cuab yeej teeb tsa siv sudo raspi-teeb tsa. Thaum khiav, mus rau Interfacing Options, Advanced Options thiab tom qab ntawd qhib I2C.

sudo apt-get install python-smbus i2c-tools Cov cai nab nab hauv qab no tso cai rau peb sib txuas lus nrog lub ntsuas qhov ntsuas cua thiab nyeem nws cov npe sau npe rau peb tus kheej lub hom phiaj. import smbus import struct # Accelerometer configurations bus = smbus. SMBus (1) chaw nyob = 0x53 nce = 3.9e-3 bus.write_byte_data (chaw nyob, 45, 0x00) # Mus rau hom standby bus.write_byte_data (chaw nyob, 44, 0x06) # Bandwidth 6.5Hz bus.write_byte_data (chaw nyob, 45, 0x08) # Mus rau hom ntsuas # Nyeem cov ntaub ntawv los ntawm lub ntsuas buf = bus.read_i2c_block_data (chaw nyob, 50, 6) # Unpack the data from int16_t to sej integer data = struct.unpack_from ("> hhh", tsis (bytearray (buf)), 0)

x = ntab (cov ntaub ntawv [0]) * nce

y = ntab (cov ntaub ntawv [1]) * nce

z = ntab (cov ntaub ntawv [2]) * nce

Kev txav chaw

Ib qho ntawm cov yam ntxwv ntawm lub teeb uas peb tab tom ua, yog tias nws tuaj yeem tshawb pom lub zog (lossis tsis muaj) nkag mus rau kev sib tham sib sib tham (qhov twg lub teeb hloov pauv raws kev sib hloov) thiab hom huab cua huab cua (qhov twg hloov pauv nyob ntawm huab cua huab cua rau hnub no). Cov cai hauv qab no siv yav dhau los ua haujlwm los nyeem qhov nrawm nrawm rau 3-axes thiab ceeb toom peb thaum muaj kev txav mus los.

accel = tauAcceleration ()

dx = abs (prevAccel [0] - accel [0])

dy = abs (prevAccel [1] - accel [1])

dz = abs (prevAccel [2] - accel [2])

yog dx> moveThreshold lossis dy To> moveThreshold lossis dz> moveThreshold:

luam 'tsiv'

tsiv = Tseeb

lwm tus:

tsiv = tsis tseeb

Huab cua API

Txhawm rau tau txais huab cua huab cua peb tuaj yeem siv Yahoo Huab Cua. Qhov no cuam tshuam nrog tham nrog Yahoo Huab Cua So API uas tuaj yeem nyuaj dua. Hmoov zoo rau peb, qhov nyuaj yog twb tau saib xyuas hauv daim ntawv huab cua-api module rau nab hab sej.

  1. Ua ntej peb yuav tsum teeb tsa tus qauv siv: sudo apt install python-pip && sudo pip install weather-api
  2. Thov mus ntsib tus sau lub vev xaib kom paub ntau ntxiv txog tus qauv no.

Thaum nruab ib txoj cai hauv qab no tau txais cov xwm txheej huab cua rau lub sijhawm no

los ntawm huab cua ntshuam Weatherweather = Huab cua ()

qhov chaw = huab cua.lookup_by_location ('dublin')

condition = qhov chaw.condition ()

print (cov ntaub ntawv.text ())

Muab nws tag nrho ua ke

Tag nrho cov cai rau txoj haujlwm uas txuas rau txhua daim saum toj no tuaj yeem pom nyob ntawm no.

Pib pib tsab ntawv nab hab sej ntawm lub sijhawm khau raj

Txhawm rau tuaj yeem tso raspberry pi rau hauv ib lub thawv thiab kom nws khiav peb cov cai txhua lub sijhawm peb txuas nws rau lub zog, peb yuav tsum ua kom ntseeg tau tias cov cai tau pib thaum pib khau raj. Txhawm rau ua qhov no peb siv cov cuab yeej hu ua cron.

  1. Ua ntej hu rau cron cuab yeej siv: sudo crontab -e
  2. Cov kauj ruam dhau los yuav qhib cov ntaub ntawv teeb tsa, uas peb ntxiv kab hauv qab no:

    @reboot sej /home/pi/light.py &

Kauj Ruam 4: Ua Qauv thiab Luam 3D

Qauv thiab 3D Luam
Qauv thiab 3D Luam
Qauv thiab 3D Luam
Qauv thiab 3D Luam

Tus qauv 3D ntawm Plus tau ua hauv Solidworks, thiab khaws cia ua. Stl hom ntawv. Tom qab ntawd rau 3D luam ntawv tus qauv,. Stl cov ntaub ntawv raug xa tawm hauv Cura software. Txhua sab ntawm qhov ntxiv siv sijhawm 2:30 teev los tsim khoom; yog li txhua qhov Plus siv sijhawm li 5 teev los luam tawm. Thiab rau ob sab pob tshab, plexiglass tau txiav-laser.

Kauj ruam 5: Sib dhos

Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke
Los ua ke

Nrog 3D luam tawm ib feem, cov khoom siv hluav taws xob thiab software ntawm tes, thaum kawg peb tuaj yeem sib sau ua khoom kawg.

  1. Cov ntawv luam tawm 3D sab saum toj thiab hauv qab, peb pom tias muaj pob tshab ntau dua qhov xav tau. Ib txheej ntawm txhuas ntawv ci daws teeb meem teeb pom kev zoo.
  2. Txawm li cas los xij, cov ntawv no yog cov khoom siv thiab tuaj yeem ua rau luv luv hauv peb qhov kev tiv thaiv uas tsis muaj kev tiv thaiv. Yog li lwm txheej ntawm daim npav dawb daim ntawv tau muab lo rau saum.
  3. Cov diffuse Plexiglas ntu tau glued rau ib qho ntawm cov phaj sab.
  4. Lub qhov yog drilled hauv ib sab ntawm 3D luam ntawv vaj huam sib luag. Qhov no yog kom peb tuaj yeem hla dhau lub hwj huam qaum.
  5. Ib zaug, lub xaim hluav taws xob tau teeb tsa los ntawm lub qhov, peb muab nws tso rau ntawm peb lub rooj tsav xwm tsim qauv.
  6. Peb txuas lub sensor rau raspberry pi thiab tom qab ntawd ntsaws nws rau hauv qhov txuas.
  7. Peb txuas 2 daim ua ke kom tau txais peb cov khoom kawg.
  8. Kev xaiv koj tuaj yeem ua kua nplaum 2 daim los ua kev sib txuas ruaj khov dua. Txawm li cas los xij yuav tsum paub tias nws yuav nyuaj rau nkag mus rau hauv lub thawv tom qab nws tau kaw yog tias koj xav hloov pauv txoj cai tom qab.

Pom zoo: