Cov txheej txheem:
- Kauj Ruam 1: Cov Khoom Siv
- Kauj Ruam 2: YUAV (Network Cheeb Tsam Network)
- Kauj Ruam 3: CAN - Cov yam ntxwv
- Kauj Ruam 4: Siv Circuit
- Kauj Ruam 5: Cov Kab Xa Kab Voltages (Kev Tshawb Fawb Sib Txawv)
- Kauj Ruam 6: CAN Cov Qauv thiab Cov Qauv Txheej Txheem
- Kauj Ruam 7: CAN Cov Qauv thiab Cov Qauv Txheej Txheem
- Kauj Ruam 8: CAN Cov Qauv thiab Cov Qauv Txheej Txheem
- Kauj Ruam 9: Plaub Hom Ntoo (thav duab)
- Kauj Ruam 10: Circuit - Cov ntsiab lus ntawm Kev Sib Txuas
- Kauj Ruam 11: Circuit -Capture Data
- Kauj Ruam 12: Circuit -Capture Data
- Kauj Ruam 13: Circuit -Capture Data
- Kauj Ruam 14: Arduino Library - CAN
- Kauj ruam 15: Github
- Kauj Ruam 16: Tus Kws Tshaj Lij Tshaj Tawm
- Kauj Ruam 17: Cov Cai Code: Loop (), Xa Tus Qauv CAN 2.0 Pob
- Kauj Ruam 18: Cov Cai Code: Loop (), Xa Cov Ncua Ntev CAN 2.0 Pob
- Kauj Ruam 19: Tus Neeg Tau Txais Cov Cai
- Kauj Ruam 20: Cov Cai Code: Loop (), Tau Txais Pob thiab Txheeb Xyuas Hom Ntawv
- Kauj Ruam 21: Qhov Chaw: Loop (), Tshawb xyuas seb nws puas yog pob khoom nyob deb
- Kauj Ruam 22: Cov Cai Tau Txais: Loop (), Cov Ntaub Ntawv Ntev Thov lossis Tau Txais
- Kauj Ruam 23: Cov Cai Tau Txais: Loop (), Yog Cov Ntaub Ntawv Tau Txais, Nws Tom Qab Luam Ntawv
- Kauj Ruam 24: Rub Cov Ntaub Ntawv
Video: CAN raws tu qauv - Yog, Peb Ua Tau!: 24 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Lwm qhov kev qhia tsis ntev los no tau qhia los ntawm kuv tus YouTube channel cov thwjtim yog CAN (Tus Saib Xyuas Cheeb Tsam Network) raws tu qauv, uas yog yam peb yuav tsom mus rau niaj hnub no. Nws yog ib qho tseem ceeb los piav qhia tias CAN yog cov txheej txheem kev sib txuas lus ib txhij. Qhov no txhais tau tias kev sib koom ua ke ntawm cov qauv txuas nrog lub network tau ua tiav hauv kev sib piv rau qhov pib ntawm txhua cov lus xa mus rau lub npav. Peb yuav pib los ntawm kev qhia cov ntsiab lus yooj yim ntawm CAN raws tu qauv thiab ua qhov kev sib dhos yooj yim nrog ob ESP32s.
Hauv peb qhov kev sib tham, ESPs tuaj yeem ua tus tswv thiab tus qhev. Koj tuaj yeem muaj ntau lub microcontrollers xa ib txhij, vim tias CAN cuam tshuam nrog kev sib tsoo ntawm txhua yam cia li. Qhov chaws ntawm txoj haujlwm no yooj yim heev. Txheeb nws tawm!
Kauj Ruam 1: Cov Khoom Siv
- Ob qhov qauv ntawm ESP WROOM 32 NodeMcu
- Ob CAN transceivers los ntawm WaveShare
- Jumpers rau kev sib txuas
- Logical analyzer rau kev ntes
- Peb USB cables rau ESPs thiab tshuaj ntsuam xyuas
- 10 meters ntawm txoj hlua sib tw los ua tsheb npav
Kauj Ruam 2: YUAV (Network Cheeb Tsam Network)
- Nws tau tsim los ntawm Robert Bosch GmbH hauv xyoo 1980 los pab rau kev lag luam tsheb.
- Nws tau dhau los ntau xyoo nyob rau xyoo vim nws muaj zog thiab yooj ntawm kev siv. Nws tau siv nrog cov cuab yeej siv tub rog, tshuab ua liaj ua teb, kev tsim khoom thiab kev tsim kho tshuab, neeg hlau, thiab khoom siv kho mob.
Kauj Ruam 3: CAN - Cov yam ntxwv
- Ob-xaim xov tooj sib txuas lus
- Qhov siab tshaj ntawm 8 bytes ntawm cov ntaub ntawv muaj txiaj ntsig ntawm ib tus ncej, nrog kev faib ua tau
- Chaw nyob qhia rau cov lus thiab tsis yog rau ntawm
- Muab lub luag haujlwm tseem ceeb rau cov lus thiab xa tawm ntawm "tuav" cov lus
- Muaj peev xwm siv tau los txheeb xyuas thiab teeb liab tsis raug
- Muaj peev xwm ua tau ntau tus tswv (txhua lub hauv paus tuaj yeem thov nkag npav)
- Muaj peev xwm ua tau ntau yam (ib nqe lus rau ntau tus neeg tau txais tib lub sijhawm)
- Hloov tus nqi nce txog 1Mbit / s ntawm lub npav 40-meter (txo tus nqi nrog nce ntawm qhov ntev busbar)
- Kev hloov pauv yooj yim ntawm kev teeb tsa thiab qhia txog cov nodes tshiab (txog 120 nodes ntawm ib lub npav)
- Cov cuab yeej txheem, tus nqi qis, thiab muaj khoom zoo
- Cov txheej txheem tswj hwm: ISO 11898
Kauj Ruam 4: Siv Circuit
Ntawm no, Kuv muaj Transceivers. Muaj ib qho ntawm txhua sab, thiab lawv tau txuas nrog ob kab xov hlau. Ib tus yog lub luag haujlwm xa thiab lwm tus tau txais cov ntaub ntawv.
Kauj Ruam 5: Cov Kab Xa Kab Voltages (Kev Tshawb Fawb Sib Txawv)
Hauv CAN, qhov tseem ceeb yog Zero.
Kev Tshawb Nrhiav Kab Sib Txawv Ua Ntej Ua Ntej Tsis hnov suab (EFI)
Kauj Ruam 6: CAN Cov Qauv thiab Cov Qauv Txheej Txheem
Cov qauv txheem nrog 11-ntsis tus cim
Kauj Ruam 7: CAN Cov Qauv thiab Cov Qauv Txheej Txheem
Cov ntawv txuas ntxiv nrog tus lej 29-ntsis
Kauj Ruam 8: CAN Cov Qauv thiab Cov Qauv Txheej Txheem
Nws yog ib qho tseem ceeb kom nco ntsoov tias cov txheej txheem twb tau laij tawm CRC thiab xa ACK thiab EOF cov cim, uas yog yam uas twb tau ua tiav los ntawm CAN raws tu qauv. Qhov no lav paub tias cov lus xa mus yuav tsis tuaj txog qhov tsis raug. Qhov no vim tias yog nws muab teeb meem hauv CRC (Redundant Cyclic Check lossis Redundancy Check), uas yog tib yam li cov ntaub ntawv tshawb xyuas tus lej, nws yuav raug txheeb xyuas los ntawm CRC.
Kauj Ruam 9: Plaub Hom Ntoo (thav duab)
Nws yog ib qho tseem ceeb kom nco ntsoov tias cov txheej txheem twb tau laij tawm CRC thiab xa ACK thiab EOF cov cim, uas yog yam uas twb tau ua tiav los ntawm CAN raws tu qauv. Qhov no lav paub tias cov lus xa mus yuav tsis tuaj txog qhov tsis raug. Qhov no vim tias yog nws muab teeb meem hauv CRC (Redundant Cyclic Check lossis Redundancy Check), uas yog tib yam li cov ntaub ntawv tshawb xyuas tus lej, nws yuav raug txheeb xyuas los ntawm CRC.
Plaub hom thav duab (thav duab)
Kev xa thiab txais cov ntaub ntawv hauv CAN yog ua raws plaub hom kev thav duab. Cov hom kab yuav raug txheeb xyuas los ntawm kev hloov pauv hauv cov khoom tswj lossis txawm tias hloov pauv los ntawm cov txheej txheem sau kab lus rau txhua kis.
- Cov Ntaub Ntawv: Muaj cov ntaub ntawv xa mus rau tus txais (s)
- Cov Chaw Taws Teeb: Qhov no yog thov rau cov ntaub ntawv los ntawm ib qho ntawm cov nodes
- Kev Ua Yuam Kev Tsis Zoo: Nws yog kab ntawv xa los ntawm ib qho ntawm cov nodes thaum txheeb xyuas qhov ua yuam kev hauv lub tsheb npav thiab tuaj yeem kuaj pom los ntawm txhua lub hauv paus
- Overload Frame: Ua haujlwm kom qeeb tsheb ntawm lub npav vim cov ntaub ntawv hla dhau lossis ncua ntawm ib lossis ntau qhov ntawm.
Kauj Ruam 10: Circuit - Cov ntsiab lus ntawm Kev Sib Txuas
Kauj Ruam 11: Circuit -Capture Data
Wavelengths tau txais rau tus qauv CAN nrog 11-ntsis ID
Kauj Ruam 12: Circuit -Capture Data
Wavelengths tau txais rau ncua CAN nrog 29-ntsis ID
Kauj Ruam 13: Circuit -Capture Data
Cov ntaub ntawv tau los ntawm tus kws tshuaj xyuas cov laj thawj
Kauj Ruam 14: Arduino Library - CAN
Kuv qhia ntawm no ob qhov kev xaiv uas koj tuaj yeem nruab CAN Driver Library
Arduino IDE Tus Thawj Saib Xyuas Tsev Qiv Ntawv
Kauj ruam 15: Github
github.com/sandeepmistry/arduino-CAN
Kauj Ruam 16: Tus Kws Tshaj Lij Tshaj Tawm
Source Code: suav nrog thiab teeb tsa ()
Peb yuav suav nrog CAN lub tsev qiv ntawv, pib ua ntu zus rau kev debugging, thiab pib CAN npav ntawm 500 kbps.
#include // Inclui a biblioteca CAN void setup () {Serial.begin (9600); // inicia serial para debug thaum (! Serial); Serial.println ("Transmissor CAN"); // Inicia o barramento CAN a 500 kbps if (! CAN.begin (500E3)) {Serial.println ("Falha ao iniciar o controlador CAN"); // caso não seja possível iniciar o controlador thaum (1); }}
Kauj Ruam 17: Cov Cai Code: Loop (), Xa Tus Qauv CAN 2.0 Pob
Siv tus qauv CAN 2.0, peb xa pob khoom. Tus lej 11-ntsis qhia tus lej. Cov ntaub ntawv thaiv yuav tsum muaj txog 8 bytes. Nws pib pob nrog ID 18 hauv hexadecimal. Nws ntim 5 bytes thiab kaw qhov haujlwm.
void loop () {// Usando o CAN 2.0 padrão // Envia um pacote: o id tem 11 bits e identifica a mensagem (prioridade, evento) // o bloco de dados deve possuir até 8 bytes Serial.println ("Enviando pacote … "); CAN.beginPacket (0x12); // id 18 em hexadecimal CAN.write ('h'); // 1º byte CAN.write ('e'); // 2º byte CAN.write ('l'); // 3º byte CAN.write ('l'); // 4º byte CAN.write ('o'); // 5º byte CAN.endPacket (); // encerra o pacote para envio Serial.println ("Enviado."); ncua (1000);
Kauj Ruam 18: Cov Cai Code: Loop (), Xa Cov Ncua Ntev CAN 2.0 Pob
Hauv qib no, tus lej ID muaj 29 qhov. Nws pib xa 24 ntsis ntawm tus lej ID thiab, ib zaug ntxiv, ntim 5 bytes thiab txiav tawm.
// Usando CAN 2.0 Estendido // Envia um pacote: o id tem 29 bits e identifica a mensagem (prioridade, evento) // o bloco de dados deve possuir até 8 bytes Serial.println ("Enviando pacote estendido …"); CAN.beginExtendedPacket (0xabcdef); // id 11259375 decimal (abcdef em hexa) = 24 khoom preenchidos até aqui CAN.write ('w'); // 1º byte CAN.write ('o'); // 2º byte CAN.write ('r'); // 3º byte CAN.write ('l'); // 4º byte CAN.write ('d'); // 5º byte CAN.endPacket (); // encerra o pacote para envio Serial.println ("Enviado."); ncua (1000); }
Kauj Ruam 19: Tus Neeg Tau Txais Cov Cai
Source Code: suav nrog thiab teeb tsa ()
Ib zaug ntxiv, peb yuav suav nrog CAN lub tsev qiv ntawv, pib ua ntu zus kom debug, thiab pib CAN npav ntawm 500 kbps. Yog tias muaj qhov ua yuam kev, qhov yuam kev no yuav luam tawm.
#include // Inclui a biblioteca CAN void setup () {Serial.begin (9600); // inicia a serial para debug thaum (! Serial); Serial.println ("Txais CAN"); // Inicia o barramento CAN a 500 kbps if (! CAN.begin (500E3)) {Serial.println ("Falha ao iniciar o controlador CAN"); // caso não seja possível iniciar o controlador thaum (1); }}
Kauj Ruam 20: Cov Cai Code: Loop (), Tau Txais Pob thiab Txheeb Xyuas Hom Ntawv
Peb tau sim tshuaj xyuas qhov loj ntawm pob ntawv tau txais. CAN.parsePacket () txoj hauv kev qhia kuv qhov loj me ntawm pob ntawv no. Yog li yog tias peb muaj pob, peb yuav tshuaj xyuas seb nws puas txuas ntxiv lossis tsis yog.
void loop () {// Tenta verificar o tamanho do acote recebido int packetSize = CAN.parsePacket (); yog (packetSize) {// Se temos um pacote Serial.println ("Recebido pacote."); yog (CAN.packetExtended ()) {// verifica se o pacote é estendido Serial.println ("Estendido"); }
Kauj Ruam 21: Qhov Chaw: Loop (), Tshawb xyuas seb nws puas yog pob khoom nyob deb
Ntawm no, peb tshawb xyuas yog tias pob ntawv tau txais yog cov ntaub ntawv thov. Hauv qhov no, tsis muaj cov ntaub ntawv.
yog (CAN.packetRtr ()) {// Verifica se o pacote é um pacote remoto (Requisição de dados), neste caso não há dados Serial.print ("RTR"); }
Kauj Ruam 22: Cov Cai Tau Txais: Loop (), Cov Ntaub Ntawv Ntev Thov lossis Tau Txais
Yog tias pob ntawv tau txais yog qhov kev thov, peb qhia qhov thov ntev. Tom qab ntawd peb tau txais Cov Ntaub Ntawv Ntev Code (DLC), uas qhia txog qhov ntev ntawm cov ntaub ntawv. Thaum kawg, peb qhia qhov ntev tau txais.
Serial.print ("Pacote com tus lej 0x"); Serial.print (CAN.packetId (), HEX); yog (CAN.packetRtr ()) {// se o pacote recebido é de requisição, indicamos o constimento solicitado Serial.print ("e requsitou o comprimento"); Serial.println (CAN.packetDlc ()); // obtem o DLC (Cov Ntaub Ntawv Ntev Code, que indica o constimento dos dados)} lwm {Serial.print ("e constimento"); // aqui somente indica o comprimento recebido Serial.println (packetSize);
Kauj Ruam 23: Cov Cai Tau Txais: Loop (), Yog Cov Ntaub Ntawv Tau Txais, Nws Tom Qab Luam Ntawv
Peb luam tawm (ntawm tus saib hauv xov tooj) cov ntaub ntawv, tab sis tsuas yog tias lub pob ntawv tau txais tsis yog qhov kev thov.
// Imprime os dados somente se o pacote recebido não foi de requisição thaum (CAN.available ()) {Serial.print ((char) CAN.read ()); } Serial.println (); } Serial.println (); }}
Kauj Ruam 24: Rub Cov Ntaub Ntawv
INO
Pom zoo:
Qauv Cov Qauv Txheej Txheem Nrog Sab Saum: 13 Kauj Ruam (nrog Duab)
Qauv Cov Qauv Txheej Txheem Nrog Sab Saum Automated: Ua qauv qauv tsheb ciav hlau yog qhov haujlwm zoo, siv lub tshuab nws yuav ua rau nws zoo dua! Cia peb saib qee qhov zoo ntawm nws qhov kev siv tshuab: Tus nqi qis: tag nrho cov txheej txheem yog tswj los ntawm Arduino microcontroller, siv L298N mo
Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm: 5 Kauj Ruam
Cov Qauv, Cov Qauv, thiab Lub Hom Phiaj Kawm: Cov lus qhia no yuav taug kev tus tub ntxhais kawm los ntawm kev tsim lub chaw nres tsheb uas siv lub arduino. Tshwj xeeb kuv yuav muaj lub ntsuas pa ultrasonic tas li pov npav rau qhov deb, thiab nrog rau tus lej me me uas siv qhov deb no thiab tso nws hla
Qauv Cov Qauv Txheej Txheem Nrog Kev Soj Ntsuam Ntawm Sab Saum (V2.0): 13 Kauj Ruam (nrog Duab)
Qauv Cov Qauv Txheej Txheem Nrog Kev Siv Hla Dhau Sab (V2.0): Txoj haujlwm no yog hloov kho ntawm ib qho ntawm cov qauv kev tsheb ciav hlau yav dhau los kev ua haujlwm, Tus Qauv Kev Teeb Kev Teeb nrog Automated Siding. Cov ntawv no ntxiv qhov tshwj xeeb ntawm kev sib txuas thiab txiav tawm ntawm lub tsheb ciav hlau nrog cov khoom txav. Kev ua haujlwm ntawm
Rov qab tau Quadcopter (raws li Hubsan Qauv): 8 Kauj Ruam
Rov qab tau Quadcopter (raws li Tus Qauv Hubsan): Qhov tseeb yog, quadcopters tau poob txhua lub sijhawm. Tib neeg xa lawv mus deb dhau los lossis cua tuaj ntes lawv lossis tus kws tsav dav hlau tsis nkag siab thiab tus tub ceev xwm mus qhov twg koj tsis tuaj yeem pom nws ntxiv lawm. Tsis muaj cov yuam sij zais cia tau qhia nyob rau hauv Cov Lus Qhia no, tsis muaj teeb tsa
Peb Axis SMD Cheeb Tsam Peb Tes: 9 Kauj Ruam
Peb Axis SMD Cheeb Tsam Thib Peb: Kuv, zoo li ntau lwm tus, tau muaj teeb meem tuav cov ntu ntu ntu thaum kuv muab lawv tso rau. Txij li qhov tsim nyog tsim tsiaj tsim khoom Kuv tau tshoov siab los tsim kuv tus kheej lub chaw haujlwm ua haujlwm uas yuav daws kuv cov teeb meem. Nov yog qhov yooj yim heev los tsim, pheej yig thiab h