Cov txheej txheem:

Jammarduino DUE - DIY PC rau Jamma Interface rau Arcade Txee: 6 Kauj Ruam
Jammarduino DUE - DIY PC rau Jamma Interface rau Arcade Txee: 6 Kauj Ruam

Video: Jammarduino DUE - DIY PC rau Jamma Interface rau Arcade Txee: 6 Kauj Ruam

Video: Jammarduino DUE - DIY PC rau Jamma Interface rau Arcade Txee: 6 Kauj Ruam
Video: REAL RACING 3 LEAD FOOT EDITION 2024, Hlis ntuj nqeg
Anonim
Jammarduino DUE - DIY PC rau Jamma Interface rau Arcade Txee
Jammarduino DUE - DIY PC rau Jamma Interface rau Arcade Txee

Cov lus qhia no yuav qhia koj yuav ua li cas thiaj tsim daim thaiv npog yooj yim rau Arduino DUE los cuam tshuam nrog lub tshuab arcade tiag nrog kev daws teeb meem qis CRT thiab jamma txuas rau koj lub PC.

Cov ntaub thaiv npog tseem ceeb tshaj plaws yog:

- txhawm rau ua kom lub teeb liab video tawm los ntawm daim npav video (qis heev hauv qhov hluav taws xob rau qhov tseeb Arcade CRT saib)

- los tiv thaiv koj qhov kev daws teeb meem qis CRT saib los ntawm ntau zaus ntau dua kab rov tav ua ke cov cim

- kom "txhais" khawm nias ntawm lub vaj huam sib luag tswj vaj huam sib luag rau qee yam uas PC tuaj yeem ua tau

Kuv yuav qhia koj yuav ua li cas txuas ntxiv kev siv los tswj Arcade Racing log thiab cov kiv cua.

Daim ntawv ceeb toom: daim ntaub thaiv TSIS TXHOB yuam kom cov vis dis aus sib txuas lub suab qis qis: koj xav tau qee qhov software tshwj xeeb rau qhov ntawd. Kuv qhia koj kom siv CRT emudrivers lossis Soft15KHz.

Kauj ruam 1: Kho vajtse

Kuv yuav xav tias koj muaj lub chaw muag khoom soldering thiab qee cov tin los ntawm txhais tes thiab koj paub siv lawv li cas. Ua qhov vis dis aus yog SMD nrog 0.65 mm suab, Kuv qhia koj kom yuav qee qhov siv hluav taws xob los txhawm rau txhawm rau txhawm rau txhawm rau microbe. Kuv siv tus pheej yig "tsis-huv" Rosing Mildly Activated (RMA) cwj mem nrog cov txiaj ntsig zoo.

Lub interface yog tsim los ntawm:

- 1x Arduino DUE microcontroller board

- 1x THS7374 video amplifier

- 1x TSSOP14 rau DIP14 adapter

- 1x lub suab nrov nrov

- 1x jamma ntiv tes taw

- 1x 5x7 cm tsab ntawv pov thawj lub rooj tsavxwm, ob sab

1 x 1N4148 diode

- 7x 1Kohm resistors

- 1x 820 ohm resistor

3 x 220 ohm resistor

- 1x kab kab, 2.54 hli sib nrug

- 1 x VGA cable

- 1x audio cable

Kauj ruam 2: Schematics

Schematics
Schematics

Nov yog cov xim txheej txheem ntawm tag nrho txoj haujlwm. Tsis yog li kev ntseeg, tab sis yooj yim ua raws, hauv kuv qhov kev cia siab.

Wirings yog ib qho yooj yim raws li lawv saib:

- kab xim tuaj ntawm PC VGA txuas mus rau lub tshuab tso suab video; 1Kohm resistor rau hauv av txo qhov tam sim no rau cov vis dis aus lub suab tso tawm. Ntawm qhov tso tawm ib ntu kev tiv thaiv qis dua qhov tam sim no rau arcade CRT.

- cov kab sib txuas yog qee qhov ntau dua "nyuaj": cais sib cais los ntawm VGA tau tsim ua ke, ua ntej, tom qab ntawd qis dua los ntawm kev faib hluav taws xob kom hwm Arduino DUE qhov tshwj xeeb (3.3V logic). Qhov faib hluav taws xob tau suav ua piv txwv tias yog 5V lub teeb liab sib txuas.

- video amplifier (THS7374) tuaj yeem siv tau ntawm 3.3V lossis 5V; yog qhov ua kom muaj zog ntawm 5V tso cai rau ntau qhov dav ntawm cov khoom siv hluav taws xob/cov cim thiab yog tias THS7374 tuaj yeem tswj tau los ntawm 3.3V txawm tias yog kua txiv ntawm 5V, kuv tau mus rau 5V txoj kev.

- av video, arduino DUE av, THS7374 av thiab jamma txuas hauv av yog luv luv ncig.

- Arduino DUE 5V thiab Jamma 5V kab yuav tsum tsis txhob luv luv.

- TSIS TXHOB kua txiv lub suab amp los ntawm USB cable: koj xav tau cov khoom siv sab nraud rau qhov ntawd vim tias txwv tam sim no (piv txwv li PC ATX PSU). Ua li ntawd koj yuav ua rau koj puas USB chaw nres nkoj lossis txawm tias koj lub PC.

VGA txuas: lo lus ceeb toom

Kuv nyuam qhuav muaj sijhawm los hloov kho lub PC siv nrog kuv jammarduino DUE. Txawm hais tias kuv tau sim nws nrog ob lub PC sib txawv ua ntej, lawv ob leeg siv daim npav ATI ntawm tib tsev neeg (ATI 9250 thiab 9550). Lub khoos phis tawj tshiab tau nruab nrog HD5750 nrog ib qho DVI analog tso tawm (tsis muaj VGA). Qhov no yuam kuv kom siv (passive) DVI rau VGA adapter. Zoo, tom qab qee qhov nyuaj kuv pom tias VGA cable txuas nrog lub adapter YUAV TSUM muaj tsuas yog hauv av txuas nrog tus pin 5 ntawm VGA txuas mus ua haujlwm, tsis yog tus pin los ntawm 6 txog 10 zoo li tshaj tawm hauv feem ntau cov lus qhia hauv lub vev xaib. Nco ntsoov qhov no hauv qhov xwm txheej koj tsis tuaj yeem pom ib qho teeb meem sib txuas tawm ntawm koj daim npav video.

Kauj ruam 3: Sketch/Code

Kos duab/Code
Kos duab/Code

Koj yuav tsum nruab Arduino IDE ua ntej; koj yuav tsum teeb tsa SAM Cortex M3 Core ib yam (tsis yog tam sim no los ntawm lub neej ntawd). Qhov kawg tab sis tsis tsawg, nruab Arduino DUE cov tsav tsheb. Xa mus rau tus nom "Pib Nrog Arduino Due" qhia rau feem ntau cov ntaub ntawv tshiab.

Cov duab kos uas koj xav tau xa mus rau koj Arduino DUE nyob ntawm no txuas nrog. Unzip thiab thauj khoom "jammarduinoDUE.ino" rau koj Arduino IDE, tom qab ntawd rub mus rau arduino DUE ntawm "chaw nres nkoj" chaw nres nkoj. Tom qab kos duab tau ua tiav ua tiav, tshem lub USB cable los ntawm qhov "program" chaw nres nkoj thiab txuas Arduino DUE ntawm "Native USB" chaw nres nkoj, lossis cov khoom siv ntawm cov cai yuav tsis ua haujlwm.

Yeej, Arduino DUE ntsuas qhov sib xyaw ua ke thiab xiam lub vis dis aus lub suab thaum sib txuas ua ke siab dhau rau tus nqi qis CRT. Arduino DUE ua haujlwm cov tswv yim los ntawm cov tswj vaj huam sib luag ib yam nkaus, xa lub hauv paus MAME yuam sij ntawm cov khawm tshwj xeeb nias. Kev ua haujlwm hloov pauv (qhib los ntawm kev ua kom P1 START khawm nias) kuj suav nrog, zoo li cuam tshuam kev lag luam.

Nyob rau hauv lub rooj lub default keymap. Koj tuaj yeem hloov daim ntawv qhia qhov tseem ceeb lossis ntxiv cov nyees khawm ntawm koj lub siab ncaj qha rau ntawm daim duab yooj yim.

Piv txwv li, yog tias koj xav muab lub ntim tswj lub ntim rau koj tus emulator, koj yuav tsum txhais cov yuam sij no (cia hais tias cov keyboard "+" rau ntim thiab cov keyboard "-" rau ntim cia) hauv koj cov ntawv qhia zaub mov emu, ua ntej; tom qab ntawd ntxiv qhov hloov pauv qhov tseem ceeb rau cov nyees khawm uas koj xav tau ntim ntxiv lossis txo qis kom raug xa mus rau. Cia hais tias kuv xav nce ntim los ntawm nias lub pob ua haujlwm thiab Player 1 khawm 3. Kuv yuav hloov kho kab

{26, HIGH, 0, 180, 180}, // space - P1 B3

rau

{26, HIGH, 0, 180, 223}, // qhov chaw - P1 B3 (+)

Ntawd "223" yog ASCII tus lej cim rau cov keyboard "+".

Kuv yuav qhia koj paub yuav ua li cas muab tus "-" (lossis yam koj xav tau) rau "ntim cia" ua haujlwm raws li kev tawm dag zog (Hint: ASCII code 222):)

Thov nco ntsoov tias hauv MAME koj tuaj yeem tsuas yog muab cov kev pabcuam hom ntim, tsis yog qhov ntim dav dav qhov no txhais tau tias yog tias pawg thawj coj ua tsis tso cai rau tswj lub ntim software, lub ntim yuav tsis cuam tshuam.

Kauj Ruam 4: Ua Li Cas Txog Kev Lag Luam Lag Luam?

Kuv tau ua qee qhov kev ntsuam xyuas kom pom ntau npaum li cas cov cai tuaj yeem qhia; zoo, los ntawm kev xa 3 cov nyees khawm nias tib lub sijhawm ua tiav lub voj yuav siv txog 4 ms kom ua tiav, kom deb li tsawg dua 33 ms tus ncej kav ntev ntawm 30 FPS.

Kauj Ruam 5: Ua Li Cas Txog Jamma Cov Khoom Sib Tw?

Dab tsi txog Jamma Sib Tw Cov Khoom?
Dab tsi txog Jamma Sib Tw Cov Khoom?

Potentiometer Log

Yog tias koj lub txee yog lub txee sib tw, nws zoo li lub log yog lub zog loj (koj tuaj yeem pom 5Kohm potentiometer nyob rau sab tom qab ntawm lub vaj huam sib luag tswj).

Thawj qhov ua ntej, rub tawm thiab teeb tsa lub tsev qiv ntawv Joystick (nyob rau hnub no tsuas yog version 1 ntawm lub tsev qiv ntawv tau hais kom sib haum nrog arduino DUE, tab sis nws tseem yog lub tsev qiv ntawv zoo heev).

Tom qab ntawd, ntxiv ob peb kab uas ua raws hauv daim duab hauv Kauj Ruam 4 txhawm rau tuav lub log yooj yim (qhov twg tso cov kab tso rau koj raws li kev tawm dag zog …)

#suav nrog

int deadZone = 0;

void teeb tsa () {

Joystick.begin ();}

void voj () {

int readPot = analogRead (A3);

int wheelPos = daim ntawv qhia (readPot, 0, 1023, -127, 127);

yog (wheelPos> deadZone || wheelPos <-deadZone) {Joystick.setXAxis (wheelPos);}

lwm tus {Joystick.setXAxis (0);}

}

Raws li koj pom, koj tuaj yeem teeb tsa lub deadzone yog tias tsim nyog (hauv kev ua haujlwm zoo arcade log nws yog qhov zoo tshaj plaws los teeb nws rau xoom).

Kev xaim lub tshuab hluav taws xob mus rau Arduino DUE yog qhov ncaj: sab pins ntawm lub hwj chim mus rau +3.3V thiab GND, tus pin wiper mus rau arduino DUE analog chaw nres nkoj (saib daim duab rau siv). Kuv tau piav ntawm no tus lej sib piv 3 (A3) raws li cov tswv yim rau lub wiper ntawm lub log potentiometer, tab sis koj tuaj yeem teeb tus pin analog uas zoo tshaj rau koj cov kev xav tau.

PS: koj puas paub tias cov pedals hauv cov khoom sib tw feem ntau tswj los ntawm lub zog, ntau dua li cov log tsheb thiab cov ko taw yog cov cuab yeej zoo ib yam? Qhov no txhais tau tias cov cai ntawm no tuaj yeem siv los tswj hwm cov tsheb kauj vab tiag tiag;)

Log Qhov Muag

Yog tias koj lub log yog kho qhov muag, nws tuaj yeem ua haujlwm tau yooj yim ib yam, ib zaug ntxiv, nrog kev hloov kho me me rau qhov pib kos duab.

Ib qho yooj yim heev pinout rau kho qhov muag Arcade encoders (Taito spinners, Atari log encoders thiab ntxiv rau) yog:

1. OptoA OUT

2. +5V

3. NCO

4. OptoB OUT

Txuas 2. thiab 3. rau Arduino DUE 5V thiab GND, thiab 1. thiab 4. rau ib tus lej digital koj nyiam them nyiaj tias qhov faib hluav taws xob yog qhov tsim nyog kom txo qis 5V tso tawm los ntawm kho qhov muag nkag mus rau 3.3V arduino DUE tuaj yeem lis. Tsis txhob xa OptoA thiab/lossis OptoB 5V tso ncaj qha rau koj cov arduino DUE cov tswv yim nkag lossis koj yuav zoo li kib cov tswv yim no lossis txawm tias tag nrho pawg thawj coj. Koj tau ceeb toom.

Hauv qhov piv txwv kos duab ntawm no kuv yuav siv tus lej digital 2 thiab tus lej digital 3 raws li kho qhov muag tawm A thiab kho qhov muag tawm B.

#suav nrog

boolean optA_state = HIGH;

int xAxisMov = 2;

void teeb tsa () {

pinMode (2, INPUT_PULLUP); // OptA ua

pinMode (3, INPUT_PULLUP); // OptB

Nas.begin ();

}

void voj () {

yog (optA_state == HIGH && digitalRead (2) == LOW) {

optA_state =! optA_state;

if (digitalRead (3) == HIGH) {Mouse.move (xAxisMov, 0, 0);} else {Mouse.move (-xAxisMov, 0, 0);}}} // loop kawg

Nov yog qhov kev daws teeb meem qis 1X suav qhov kho qhov muag nkag. Nws ntau dua li txaus rau Arcade daim ntawv thov, tab sis koj tuaj yeem nce qhov kev daws teeb meem yooj yim los ntawm kev ntxiv qee kab ntawm cov cai.

PS: koj puas paub tias cov khoos phis tawj arcade log thiab cov kiv cua arcade yog cov cuab yeej zoo ib yam nrog cov duab sib txawv? Koj puas paub tias trackballs yog thev naus laus zis 2 axis spinner? Qhov no txhais tau tias cov cai ntawm no tuaj yeem siv los tswj cov kiv cua arcade tiag tiag thiab, nrog ob peb, kev hloov pauv yooj yim trackballs ib yam;)

Kauj Ruam 6: Qee Duab, lossis Nws Tsis Ua Li Cas

Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!
Qee Duab, lossis Nws Tsis Ua Li Cas!

Nov yog qee cov duab ntawm daim ntaub thaiv kuv tau ua. Nws tsis yog qib ua haujlwm siab (twv nws, Kuv tsis yog tus tshaj lij), tab sis nws yog 100% co hauv kuv lub jamma Arcade Txee!

Pom zoo: