Cov txheej txheem:
- Kauj Ruam 1: Arduino Code - Chaw Nres Nkoj Nrog Keypad
- Kauj Ruam 2: Arduino Code - TFT Zaub
- Kauj ruam 3: Turnout Controller
Video: Qauv tsheb ciav hlau - DCC Chaw Hais Kom Siv Chaw Siv Arduino :: 3 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:28
Hloov Kho Lub Yim Hli 2018-Saib Cov Lus Qhia Tshiab:
Hloov kho 28 Lub Plaub Hlis 2016: Tam sim no 16 qhov kev tawm / cov ntsiab lus tswj lub peev xwm rau Chaw Nres Nkoj. Kev tawm mus T1 - T8 muaj nyob ntawm 'B' qhov tseem ceeb qhov kev tawm mus T9 - T16 muaj nyob ntawm 'C' qhov tseem ceeb
Hloov kho lub Peb Hlis 10, 2016:
Tam sim no ntxiv 8 qhov kev tawm mus / cov ntsiab lus tswj lub peev xwm rau Chaw Nres Nkoj. Tus lej Arduino tau hloov kho raws li siv NMRA tus qauv txheej txheem rau kev tawm mus (tseem raws li kev tshawb fawb ntawm Lenz / Atlas Compact cov ntaub ntawv pob rau kev tswj hwm kev tawm mus).
Kev tawm mus T1 - T8 muaj nyob ntawm 'B' qhov tseem ceeb
Saib cov lus qhia ntawm cov ntaub ntawv pob ntawv tau txais Circuit siv thiab Arduino code xav tau.
Hloov kho 18 Lub Ib Hlis 2016:
Kuv tau ntxiv qhov kev nkag siab tam sim no resistor (1k5 ohm) thiab capacitor (10 uf) rau hauv Circuit Court thiab hloov kho Arduino code kom txiav lub zog thaum lub ncov tam sim no ntawm> 3200 mAmps raug kuaj pom. H-choj tshwj xeeb hais txog qhov kev nkag siab tam sim no ntawm 377 uA rau 1 Amp hauv kev thauj khoom.
1.5 k ohm resistor yuav xa 0.565 volts rau Amp ntawm tus pin analog 6. Nrog 1023 cov kauj ruam ntawm cov lus sib piv, qhov no muab 0.565 * 1023 /5 = 116 rau Amp load.
A = 100 * (analogRead (AN_CURRENT)) / 116; A = A * 10; (muab cov txiaj ntsig hauv milliamps)
Cov load tam sim no hauv milliamps tau tshwm rau ntawm TFT
Tag nrho 4x4 cov keyboard suav nrog F1 rau F8 ua haujlwm thiab lwm 10 thaj chaw (1-19) los ntawm qhov '#' qhov tseem ceeb (ntxiv 10 rau tus lej zauv pib los ntawm loco 10).
Tus lej arduino suav nrog NMRA tus qauv rau kev qhia bytes.
Saib qhov txuas
www.nmra.org/sites/default/files/s-9.2.1_20…
(nplooj 6 yog qhov tseem ceeb tshwj xeeb)
Cov pob ntawv tau teeb tsa raws li tus lej ntawm cov kauj ruam nrawm, ntev / luv qhov chaw nyob thiab Kev Ua Haujlwm Pab Pawg cov lus qhia.
Txhua qhov kev qhia bytes tau ua ntej los ntawm kev hais ua ntej ntawm '1' khoom 11111111 (lossis pob ntawv tsis ua haujlwm) tom qab ntawd;
xws li 4 chaw nyob byte 0 00000011 0 00111111 0 10000011 0 10111111
sib npaug rau loco 3, 128 cov kauj ruam nrawm, mus rau tom ntej thiab nrawm 3 (qhov kawg byte yog qhov yuam kev tshawb xyuas XOR)
eg A 3 byte chaw nyob 0 00000011 0 10010000 0 10110011
sib npaug rau loco 3, ua haujlwm pab pawg 1, FL teeb ntawm ntxiv rau XOR byte (a '0' ntsis cais txhua byte)
Saib cov vis dis aus nthuav tawm rau thaj tsam 12.
Cov haujlwm F1 - F8 muaj nyob ntawm 'A' qhov tseem ceeb, DIR ('*' qhov tseem ceeb = kev qhia) FL ('0' qhov tseem ceeb = teeb) thiab qhov tseem ceeb '#' muab thaj tsam 10 txog 19 ntawm tus lej lej. Tam sim no tus 'D' tus yuam sij siv rau 'NTSHUAB NTSHAV'.
Ua tsaug rau ntau tus muab kev pabcuam hauv lub vev xaib rau cov peev txheej ntawm DCC cov ntaub ntawv thiab Arduino code.
Tshwj xeeb, txoj haujlwm no tau tshoov siab los ntawm Michael Blank thiab nws 'Yooj Yim DCC - lub chaw hais kom ua'
www.oscale.net/en/simpledcc
4x4 Matrix Array 16 Key Membrane Hloov Keypad (ebay) £ 1.75
2.2 nti 240x320 Serial SPI TFT LCD Zaub Module (ebay) £ 7.19
UNIVERSAL 12V 5A 60W POWER SUPPLY AC ADAPTER (ebay) £ 6.49
Nano V3.0 Rau Arduino nrog CH340G 5V 16M sib xws ATmega328P (ebay) 2 x £ 3.30 = £ 6.60
Tsav Tsheb Tsav Tsheb LMD18200T rau Arduino R3 (ebay) £ 6.99
Cov txuas, xaim, vero board, lub zog ntsuas kwv yees £ 3.50
Tag nrho £ 32.52
Qhov chaw hais kom ua yooj yim tsis muaj tft screen thiab 1 x nano yuav yog.0 22.03
[Nco tseg: Nws muaj peev xwm ntxiv daim npav nco rau TFT zaub thiab hloov kho cov duab kom pom cov duab ntawm cov tshuab uas tau xaiv, txawm hais tias lub tsev qiv ntawv cov lej yuav tsum tau kho dua kom tsim kev nco ntau ntxiv rau daim duab. Kev kos duab tam sim no yog qhov siab tshaj plaws rau TFT Arduino Nano]
Thawj tus lej Arduino los ntawm Michael Blank yog rau ib lub cav, rau pem hauv ntej / thim rov qab nkaus xwb uas tsis muaj kev tswj hwm kev ua haujlwm, tsis muaj cov keyboard thiab tsis muaj zaub.
Kuv tau hloov kho cov cai kom suav nrog 1 - 19 lub cav, lub vijtsam tso saib, qhia, teeb, 8 lub zog, nres thaum muaj xwm ceev thiab pib txwv tam sim no.
LMD18200T tus choj tuaj yeem nqa txog 3 amps uas ua rau nws haum rau txhua qhov suav nrog G-scale (tsheb ciav hlau vaj). Lub hwj chim tseem ceeb thiab cov khoom siv hluav taws xob tsim nyog rau siv sab hauv tsev tsuas yog koj tsis tuaj yeem ua txhua yam huab cua pov thawj. Kuv muaj lub chaw nres tsheb hais kom ua nyob hauv tsev lub caij ntuj sov nrog kev tsheb nqaj hlau txuas xov hlau hla ntawm phab ntsa mus rau txoj kev taug.
Kauj Ruam 1: Arduino Code - Chaw Nres Nkoj Nrog Keypad
Kuv ua tsaug rau tvantenna2759 rau kev taw qhia tawm 2 qhov ua yuam kev hauv daim duab qhia chaw uas Arduino code tsis sib haum rau cov xov hlau, tam sim no hloov kho tshiab (21 Oct 2017).
Tam sim no ntxiv 16 qhov kev tawm mus rau Chaw Nres Nkoj. Saib cov lus qhia ntawm cov phiaj xwm phiaj xwm phiaj xwm phiaj xwm phiaj xwm siv Arduino Mini Pro module.
Cov cai hloov pauv suav nrog kev tswj hwm kev tawm mus yog txuas hauv qab no.
Basic Accessory decoder packet is: 0 10AAAAAA 0 1AAACDDD 0 EEEEEEEE 1 Los ntawm kev txheeb xyuas pob ntawv siv los ntawm Lenz (Compact / Atlas) rau kev tswj cov ntsiab lus, Kuv tau siv cov ntawv hauv qab no binary format rau bytes 1 thiab 2: tunAddr = 1 Turnout 1a: 1000 0001 1111 1000 / Tawm 1b: 1000 0001 1111 1001 Tawm 2a: 1000 0001 1111 1010 / Tawm 2b: 1000 0001 1111 1011 Tawm 3a: 1000 0001 1111 1100 / Tawm 3b: 1000 0001 1111 1101 Tawm 4a: 1000 0001 1111 1110 / Tawm 4b: 1000 0001 1111 1111 tunAddr = 2 ----------------------------------------- ----------------------------------------------------------------------- ----------------- Tawm 5a: 1000 0010 1111 1000 / Tawm 5b: 1000 0010 1111 1001 Tawm 6a: 1000 0010 1111 1010 / Tawm 6b: 1000 0010 1111 1011 Tawm 7a: 1000 0010 1111 1100 / Tawm 7b: 1000 0010 1111 1101 Tawm 8a: 1000 0010 1111 1110 / Tawm 8b: 1000 0010 1111 1111 ----------------------- ----------------------------------------------------------------------- ----------------------- kev Tawm Tawm 9a: 1000 0011 1111 1000 / Tawm 9b: 1000 0011 1111 1001 thiab lwm yam ………
Muab rho tawm los ntawm cov cai hloov pauv: Ntxiv 2 ntau qhov 'teeb tsa' cov lus hloov tshiab tsis muaj qhov hloov pauv _tun1 (teeb tsa Xov & x) {x.data [0] = 0x81; // accessory decoder 0x80 & chaw nyob 1 x.data [1] = 0; }
tsis muaj dab tsi hloov_tun2 (struct Message & x) {x.data [0] = 0x82; // accessory decoder 0x80 & chaw nyob 2 x.data [1] = 0; }
Ntxiv qhov khoob tshiab rau kev tawm: boolean read_turnout () {ncua (20);
boolean change_t = tsis tseeb; tau_key ();
yog (key_val> = 101 && key_val <= 404 && tig == 1) {
cov ntaub ntawv = 0xf8; // = binary 1111 1000
hloov_tun1 (msg [1]);
}
yog (key_val> = 505 && key_val <= 808 && tig == 1) {
cov ntaub ntawv = 0xf8; // = binary 1111 1000
hloov_tun2 (msg [1]);
}
yog (key_val == 101 && tig == 1) {
yog (tun1 == 1) {
cov ntaub ntawv | = 0; // t1 ua
hloov_t = tseeb;}
yog (tun1 == 0) {
cov ntaub ntawv | = 0x01; // t1 ib
hloov_t = tseeb;}
}
yog (key_val == 202 && tig == 1) {
yog (tun2 == 1) {
cov ntaub ntawv | = 0x02; // t2 ua
hloov_t = tseeb;
}
yog (tun2 == 0) {
cov ntaub ntawv | = 0x03; // t2 ib
hloov_t = tseeb; }
}
yog (key_val == 303 && tig == 1) {
yog (tun3 == 1) {
cov ntaub ntawv | = 0x04; // t3 ua
hloov_t = tseeb;
}
yog (tun3 == 0) {
cov ntaub ntawv | = 0x05; // t3 ib
hloov_t = tseeb;}
}
yog (key_val == 404 && tig == 1) {
yog (tun4 == 1) {
cov ntaub ntawv | = 0x06; // t4 ua
hloov_t = tseeb;
}
yog (tun4 == 0) {
cov ntaub ntawv | = 0x07; // f4 ib
hloov_t = tseeb;}
}
yog (key_val == 505 && tig == 1) {
yog (tun5 == 1) {
cov ntaub ntawv | = 0; // t5 ua
hloov_t = tseeb;
}
yog (tun5 == 0) {
cov ntaub ntawv | = 0x01; // t5 ib
hloov_t = tseeb;}
}
lwm yam ………………….
Kauj Ruam 2: Arduino Code - TFT Zaub
Cov duab hluav taws xob tseem zoo ib yam nrog cov cai hloov pauv los qhia qhov xwm txheej ntawm 16 qhov kev tawm. Nco tseg: Lub tsev qiv ntawv cov lej yuav luag tag nrho cov duab kos cim xeeb tawm hauv chav me me rau cov yam ntxwv tshiab. Yog tias leej twg muaj cov ntaub ntawv qiv ntawv zoo dua qub rau TFT siv ntawm no, thov qhia rau kuv paub.
Kauj ruam 3: Turnout Controller
Saib cov lus qhia yuav ua li cas thiaj li ua rau Turnout / Points maub los.
Kev ua tiav Circuit tswj 16 cov ntsiab lus thiab 15 qhov khoom siv ntxiv xws li teeb, suab, tig tau, thiab lwm yam.
Pom zoo:
Qauv Tsheb ciav hlau Tsis Siv Neeg Qhov Teeb: 5 Kauj Ruam
Qauv Tsheb ciav hlau Tsis Siv Neeg Qhov Teeb: Nov yog qhov kuv nyiam tshaj plaws hauv pawg thawj coj saib. Kuv tus qauv kev tsheb ciav hlau (tseem tab tom ua haujlwm) muaj ntau qhov av thiab thaum tej zaum tsis yog qhov tsim tawm, Kuv xav kom muaj lub teeb qhov uas tau qhib thaum lub tsheb ciav hlau mus txog qhov av. Kuv thawj qhov kev xav yog b
Ntoo Bluetooth Chaw Taws Teeb rau Lego Duplo Tsheb ciav hlau: 3 Kauj Ruam (nrog Duab)
Ntoo Bluetooth Chaw Taws Teeb rau Lego Duplo Tsheb ciav hlau: Kuv cov menyuam nyiam qhov me me Lego Duplo tsheb ciav hlau tshwj xeeb tshaj yog kuv tus yau tshaj uas tawm tsam sib tham nws tus kheej nrog cov lus yog li kuv xav tsim nws qee yam uas yuav pab nws ua si nrog lub tsheb ciav hlau ntawm tus neeg laus lossis xov tooj/ntsiav tshuaj. Ib yam dab tsi uas
Automated Tsheb ciav hlau Rov Qab Siv Arduino: 10 Kauj Ruam (nrog Duab)
Automated Tsheb ciav hlau Rov Qab Siv Arduino: Ua rov qab loops tuaj yeem pab ua qauv qhia kev tsheb ciav hlau los hloov cov kev taw qhia ntawm cov tsheb ciav hlau, uas tsis tuaj yeem ua tiav nrog turntables. Hauv txoj kev no, koj tuaj yeem tsim cov kab ib leeg-kab uas muaj lub voj rov qab ntawm txhua qhov kawg kom khiav cov tsheb ciav hlau yam tsis muaj ncua lossis cuam tshuam
Yuav Ua Li Cas Teeb Lub Tsheb ciav hlau Hi-rail Tsheb ntawm Txoj Kev: 10 Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Teeb Txoj Kev Tsheb Ciav Hlau Hi-rail rau ntawm Txoj Kev: Ceev faj Txog Kev Nyab Xeeb: Tus neeg teeb tsa lub tsheb ciav hlau hi-rail ntawm txoj kev tsheb nqaj hlau thiab tus neeg pab yuav tsum hnav khaub ncaws kom pom kev zoo (ex. Tsho khuam, tsho loj, tsho loj) thiaj li pom los ntawm kev tuaj yeem tuaj yeem khiav tsheb. Lub hardhat thiab hnab looj tes yuav tsum tau hnav rau
Ib txoj hauv kev yooj yim dua los Siv Cov Hlau Hlau Hlau Hlau rau SMD LEDs: 5 Kauj Ruam
Ib txoj hauv kev yooj yim dua los Siv Cov Hlau Hlau Hlau Hlau rau SMD LEDs: Cov lus qhia no piav qhia txoj hauv kev yooj yim dua ntawm kev txuas cov hlau nplaum hlau zoo rau saum npoo LEDs. Nws yog nyob rau hauv cov lus teb rau lub Rag ntawm Fireflies qhia uas qhia pom siv "pab txhais tes" clip los ua txoj haujlwm no. Kuv xav tias kuv txoj kev yooj yim dua