Cov txheej txheem:
- Kauj Ruam 1: Koj Xav Tau Dab Tsi?
- Kauj Ruam 2: Ua Mega-isp Programmer ntawm Breadboard
- Kauj Ruam 3: Upload Sketch
- Kauj Ruam 4: Siv Nrog Avrdude
- Kauj Ruam 5: Hlawv USBtinyISP Firmware rau Attiny2313
- Kauj Ruam 6: Hlawv Arduino Bootloader
- Kauj ruam 7: Troubleshooting
Video: Yuav Ua Li Cas Program AVR (arduino) Nrog Lwm Arduino: 7 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:31
Cov ntawv qhia no muaj txiaj ntsig yog tias:
* koj tau txais koj cov arduino nrog atmega168 thiab koj yuav atmega328 ntawm koj lub khw hluav taws xob hauv zos. Nws tsis muaj arduino bootloader * koj xav ua qhov haujlwm uas tsis siv arduino - tsuas yog ib qho AVR nti ib txwm (zoo li USBTinyISP) - koj muaj qhov huv huv attiny2313/attiny48 thiab lwm yam uas koj xav kom hlawv cov firmware ntawm. Feem ntau koj yuav tsum muaj ISP (Hauv System Programmer) zoo li USBTinyISP los teeb tsa koj lub nti tshiab. Muaj cov arduino koj tuaj yeem qhia nws ua tus programmer ua tsaug rau txoj haujlwm zoo ua los ntawm Randall Bohn. Nws tsim Mega -ISP - daim duab arduino uas ua haujlwm zoo li tus programmer.
Kauj Ruam 1: Koj Xav Tau Dab Tsi?
* ua haujlwm Arduino (lossis clone - kuv tab tom siv BBB - BareBonesBoard thiab RBBB - RealBareBonesBoard los ntawm ModernDevices) * lub nti uas koj xav tau rau program (kuaj nrog atmega8, atmega168, atmega368, attiny2313, attiny13) * ib lub rooj tsavxwm nrog ISP header * 3 leds + 3 resistors * breadboard xov hlau
Kauj Ruam 2: Ua Mega-isp Programmer ntawm Breadboard
Muaj ob txoj hauv kev los txuas koj Arduino rau program chip.
Koj tuaj yeem ntsaws koj lub avr nti rau ntawm lub khob cij thiab txuas 5v thiab GND rau tus lej sib xws (txheeb xyuas cov ntawv teev tseg!) + Rub tawm tus tiv thaiv kom rov pib dua thiab xaim pins los ntawm koj arduino rau lub nti. Cov no yog cov kab ntawm Arduino thiab lawv cov haujlwm 13 - SCK 12 - MISO 11 - MOSI 10 - RST (Rov Pib dua) Los yog koj tuaj yeem ua 2x3pin ISP header uas koj tuaj yeem ntsaws rau hauv pawg thawj coj uas muab ib qho (lwm pawg thawj coj arduino). Tus pinout rau ISP lub taub hau nyob ntawm daim duab thib peb Muaj 3 leds los qhia qhov xwm txheej ntawm tus programmer. tus pin 9 - xiav coj - nws lub suab hnov ntawm tus programmer. tus pin 8 - coj liab - qhia qhov yuam kev tus pin 7 - ntsuab ntsuab - qhia tias qhov kev zov me nyuam tau ua qhov chaw (kuv tau tub nkeeg ces kuv tsis phim cov xim hauv kuv teeb tsa) Ntawm no yog cov duab kos hauv Fritzing Koj tuaj yeem ua tau MEGA-isp ntaub thaiv npog. Yaroslav Osadchyy tsim daim ntaub thaiv hauv dav dawb hau. Koj tuaj yeem tau txais cov ntaub ntawv dav dav ntawm nws lub xaib:
Kauj Ruam 3: Upload Sketch
Rub tawm daim duab kos los ntawm mega-isp google code. (Avrisp.03.zip thaum lub sijhawm sau ntawv). Unpack nws thiab khiav arduino lub tswv yim thiab qhib avrisp.pde. Rub nws mus rau koj lub rooj tsav xwm arduino. Lub plawv dhia coj yuav tsum pib ntaus.
Kauj Ruam 4: Siv Nrog Avrdude
Txhawm rau siv nrog avrdude (thiab txhua GUIs uas siv nws) koj yuav tsum xaiv tus 'avrisp' programmer. qhov muaj kev nyab xeeb tshaj plaws yog 19200.
Txhawm rau sim koj qhov tshiab atmega168 los ntawm kab lus sim: $ avrdude -p m168 -P /dev /ttyUSB0 -c avrisp -b 19200 /dev /USB0 yog qhov chaw nres nkoj uas arduino txuas nrog kuv lub thawv linux (koj yuav yog com5). Qhov no tuaj yeem tshawb xyuas hauv arduino IDE hauv Cov Cuab Yeej -> Serial Port. Koj yuav tsum tau txais: [kabturek@hal -9000 ~]# avrdude -p m168 -P /dev /ttyUSB0 -c avrisp -b 19200 avrdude: AVR ntaus ntawv pib thiab npaj los lees txais cov lus qhia Nyeem | ############################################# | 100% 0.13s avrdude: Kos npe ntaus ntawv = 0x1e9406 avrdude: safemode: Fuses OK avrdude ua tiav. Ua tsaug. Qhov ntawd txhais tau tias txhua yam zoo. Yog tias koj tau txais qhov yuam kev - txheeb xyuas cov kauj ruam kawg.
Kauj Ruam 5: Hlawv USBtinyISP Firmware rau Attiny2313
USBTinyISP yog tus programmer zoo los ntawm LadyAda uas pheej yig tiag tiag - 22 $. Kuv muaj qhov tsis txaus ntseeg 2313 thiab qee qhov yog li kuv txiav txim siab ua ib tus kheej. Yog tias koj tsis muaj kev paub dhau los ua PCB Kuv qhia koj yuav cov khoom ua rau nws zoo dua li koj tuaj yeem ua rau koj tus kheej:). Yam tsawg kawg yuav PCB yog tias koj xav tsim ib qho. Koj tuaj yeem tau txais nws los ntawm Adafruit. Txuas ATtiny2313 Hauv daim duab kawg koj tuaj yeem pom attiny2313 nrog cov pins siv rau ISP liab. Daim duab yog los ntawm LadyAda avr qhia. Hlawv cov firmware: Unpack USBTinyISP firmware. Mus rau spi dir thiab khiav $ avrdude -p pt2313 -P /dev /ttyUSB0 -c avrisp -b 19200 los tshuaj xyuas yog tias txhua yam zoo nrog lub nti. Tam sim no teeb tsa fuses: $ avrdude -P /dev /ttyUSB0 -c avrisp -b 19200 -pt2313 -U hfuse: w: 0xdf: m -U lfuse: w: 0xef: m Tam sim no koj yuav tsum txuas 12mhz sab nraud oscillator rau lub nti. Thiab hlawv cov firmware: $ avrdude -B 1 -pt2313 -U flash: w: main.hex -P /dev /ttyUSB0 -c avrisp -b 19200 Voila. Koj tus attiny2313 muaj USBTinyISP firmware.
Kauj Ruam 6: Hlawv Arduino Bootloader
Txuas kuv dag me ntsis ua rau kuv siv RBBB los ua kom yooj yim kev sib txuas. Schema nyob ntawm daim duab #2. Yog tias koj siv 2 arduinos siv daim duab #3 thiab txuas tus ISP tus pin rau ICSP 2x3 lub taub hau ntawm tus thib ob (qhev) arduino. Xaiv txuas lub zog usb rau thawj pawg thawj coj. Txoj hauv kev GUI Qhov no yog qhov ua rau me ntsis ua rau koj tsis tuaj yeem siv Cov Cuab Yeej-> Hlawv Bootloader-> w/ AVR ISP ua rau lub nrawm nrawm yog loj heev rau mega-isp. Nrhiav avrdude.conf uas los nrog arduino IDE (hauv arduino/kho vajtse/cuab yeej/avrdude.conf) thiab hloov thaj tsam rau avrisp programmer los ntawm 115200 txog 19200 (nyob ib ncig ntawm kab 312) Nrhiav thiab hloov pauv hauv avrdude.conf programmer id = "avrisp"; desc = "Atmel AVR ISP"; baudrate = 115200; # default yog 115200 hom = stk500;; rau: programmer id = "avrisp"; desc = "Atmel AVR ISP"; baudrate = 19200; # default yog 115200 hom = stk500;; Tam sim no koj tuaj yeem siv Cov Cuab Yeej -> Hlawv Bootloader -> w/AVR ISP (tom qab koj xaiv lub rooj tsav xwm kom raug los ntawm Cov Ntawv Qhia Cuab Yeej) Commanline Koj kuj tseem tuaj yeem siv kab hais kom ua: Hloov kho arduino/hardware/bootloaders/atmega/Makefile thiab hloov ISPTOOL/PORT /SPEED rau: # nkag mus rau qhov ntsuas rau avrdude isp tool ISPTOOL = avrisp ISPPORT = /dev /ttyUSB0 ISPSPEED = -b 19200 tsis yog koj tuaj yeem sau $ ua diecimila_isp mus hlawv fuses thiab bootloader. Test Tam sim no txuas koj tshiab arduino rau usb thiab hlawv blinky!
Kauj ruam 7: Troubleshooting
Avrdude tsis raug: avrdude: ser_open (): qhib tsis tau ntaus ntawv "/dev/ttyUSB0": Tsis muaj cov ntaub ntawv lossis cov npe Koj muaj qhov chaw nres nkoj tsis raug (-P) tau teev tseg lossis koj cov arduino tsis txuas nrog. kos qhov txuas txuas avrdude: Kos npe ntaus ntawv = 0x000000 avrdude: Yikes! Kos npe ntaus ntawv tsis raug Txheeb ob qhov kev sib txuas thiab sim dua, lossis siv -F txhawm rau hla daim tshev no. Qhov no yog yam yuam kev dav. Koj tus nti tsis tau lees paub. Txheeb xyuas qhov kev sib txuas ntawm lub rooj tsavxwm (GND/5V txuas nrog tus pin?) Koj yuav tau txais qhov yuam kev no thaum koj lub nti tau teeb tsa los siv tus oscillator sab nraud thiab nws tsis ua haujlwm (tsis muaj ib qho lossis nws tsis yog oscillating properl - 22pf lub kaus mom ploj lawm?)
Pom zoo:
YUAV UA LI CAS UA HAUJ LWM Arduino LINE FOLLOWER ROBOT (YUAV TSUM MUAJ KEV NYAB XEEB): 5 Kauj Ruam
YUAV UA LI CAS Ua Arduino LINE FOLLOWER ROBOT (YOOJ YIM YOOJ YIM): yog li hauv qhov kev qhia no kuv yuav qhia koj li cas dhau ib tus kab hauv qab cov neeg hlau nrog kho nrawm
YUAV UA LI CAS YUAV UA LI CAS YUAV TSUM ROBOT COOB SCARECROW: 16 Cov Kauj Ruam (nrog Duab)
YUAV UA LI CAS YUAV TSUM NYOB ROBOT COW SCARECROW: Kuv nyuam qhuav tsim Moo-Bot, tus neeg hlau nyuj scarecrow dhia hla lub hli, rau kev sib tw hauv zej zog scarecrow.Kuv kev tshoov siab yog los ntawm kuv tus tub hu nkauj "hey diddle diddle, miv thiab fiddle. .. " Txoj haujlwm zoo heev los ua haujlwm nrog kuv
YUAV UA LI CAS YUAV UA LI CAS NYOB ZOO TSHAJ PLAWS NROG IR IR LIGHT: 5 Kauj Ruam (nrog Duab)
YUAV UA LI CAS Ua Ib Lub Koob Yees Duab Tsis Muaj IR IR LIGHT: Kuv tau pom lub koob yees duab Infrared thiaj li siv nws hauv lub kaw lus kaw suab. Nrog nws koj tseem tuaj yeem tau txais cov duab txias no: cov khoom ci hauv lub zeem muag lub koob yees duab uas ib txwm muaj nyob hauv qhov tseeb. Koj tuaj yeem tau txais cov txiaj ntsig zoo nkauj rau tus nqi pheej yig Nws
Yuav Ua Li Cas RC Cua Nkoj! Nrog 3D Luam Qhov Chaw thiab Lwm Yam Khoom: 5 Kauj Ruam (nrog Duab)
Yuav Ua Li Cas RC Cua Nkoj! Nrog 3D Luam Qhov Chaw thiab Lwm Yam Khoom: Cov nkoj hauv nkoj yog qhov zoo vim tias lawv lom zem heev los caij thiab tseem ua haujlwm ntau yam ntawm cov nplaim dej, zoo li dej, daus, dej khov, asphalt lossis tsuas yog ib qho twg, yog lub tshuab muaj zog txaus. tsis nyuaj heev, thiab yog tias koj twb muaj lub tshuab hluav taws xob
Yuav Ua Li Cas Cuam Tshuam TV lossis Lwm Yam Nrog Arduino Irlib: 3 Kauj Ruam (nrog Duab)
Hnub no peb yuav kawm, raws li lub npe hais, kom ua raws lub TV nyob deb lossis qee yam zoo sib xws uas ua haujlwm nrog Infrared teeb liab siv Arduino (txhua tus qauv) .Qhov teeb meem yog: Kuv tuaj yeem xa cov lej mus rau