Cov txheej txheem:

Retro Controller: 7 Kauj Ruam
Retro Controller: 7 Kauj Ruam

Video: Retro Controller: 7 Kauj Ruam

Video: Retro Controller: 7 Kauj Ruam
Video: 【先行初公開】新型キャンピングカーに待望のオートクルーズなど | 内外装紹介&一般道試乗レビュー | デメリット③メリット③【キャンパー鹿児島タビークス】 2024, Hlis ntuj nqeg
Anonim
Retro maub los
Retro maub los

Wij zijn eerste jaar studenten uit de opleiding Multimedia & Communicatietechnologie (Multec) aan de Erasmushogeschool Brussel.

Samen hebben peb een muziek maub los gemaakt dat muziek kan starten/stoppen, de pitch kan verhogen, kan terugspoelen en nog meer.

Ons idee kwam van van een cassette, ons doel was om een controller te maken dat lijkt op een cassette.

Kauj ruam 1: Wat Heb Je Nodig?

Wat Heb Je Nodig?
Wat Heb Je Nodig?

Cheebtsam

- 2 Khawm;

- 2 Potentio meters;

- 2 weerstanden (1K elk);

- Arduino uno/nano

- Draadjes (zie elektronisch schema)

- Soldeerplaat

- MDF plag tsev

Cov cuab yeej

- Lasercutter

- Ua tsaug

- Striptang

- Soldeerbout (ntsib tin)

Qhov programma

- Tus tsim/tsim tawm (Tekenprogramma)

- Tus Reaper

- Ua

-Ua Arduino

Kauj ruam 2: Txoj Cai Ua

Txoj Cai Ua
Txoj Cai Ua

/**

* Cov duab kos yooj yim kom tau txais cov lus xov xwm los ntawm Arduino * thiab txhais cov ntawd rau OSC-lus rau Reaper * * Koj yuav xav tau hloov tus USER PARAMETERS * thiab koj yuav tsum tau teeb tsa Lub Tsev Qiv Ntawv: oscP5 * * ua rau werkcollege AV & IT * los ntawm annoo bob eddi * oct 2017 * *////////////////////// USER PARAMETERS //////////////////// ////////

/ xyuas kom tseeb tias koj siv tus lej baud zoo ib yam hauv koj li Arduino kos duab zaum kawg int baudRate = 115200;

// Mus thiab nrhiav tus IP-chaw nyob hauv Reaper thaum siv OSC // Nov yog qhov chaw nyob Ua cov xa mus rau thiab Reaper mloog. // Muab txoj hlua no tso rau hauv remoteIP, ntawm no.

// kawg txoj hlua remoteIP = "192.168.1.43"; // np. "127.0.0.1";

Txoj hlua kawg remoteIP = "vul hier ip in gevonden in reaper";

// Nco tseg ntawm sendPort thiab sau qhov no hauv Reaper. // Nov yog qhov chaw nres nkoj Kev xa mus rau thiab Reaper mloog.

kawg int listenPort = 11000, sendPort = 12000;

// Lub mloog lus ntawm no yog txhawm rau txhawm rau debug.

// portNames nyob ntawm no los debug ib yam.

String portName kawg = "vul hier de portname hauv gevonden hauv Arduino";

// kawg String portName = "COM6"; // "/dev/ttyUSB0";

/////////////////////// END ntawm USER PARAMETERS /////////////////////////// ////

ntshuam ua.serial.*; ntshuam java.util.*;

ntshuam oscP5.*; ntshuam netP5.*

OscP5 oscP5; NetAddress myRemoteLocation;

Serial commsPort; // Lub serial chaw nres nkoj boolean messageArrived = tsis tseeb;

Txoj hlua tuaj = "", IncomingOSCMessage = "";

kawg char startChar = '*', endChar = '#'; kawg char contactCharacter = '|';

// Kom paub tseeb tias peb tsuas yog xa cov ntsuas (qhov tseem ceeb) uas hloov pauv // cov ntiaj teb no cov kev hloov pauv tau raug tshem tawm ntawm no tab sis yuav tsum // tsis tau pib ua ntej ntawm no! HashMap oldParams, newParams, toSendParams;

// Peb yuav tsum faib cov lus ntawm txhua qhov tsis muaj dab tsi comma processIncoming () {String resVec = incoming.split (","); // peb tau txais lub npe+tus nqi khub // yog li rau txhua lub npe (+2)… sim {rau (int i = 0; kuv <resVec.length; kuv+= 2) {ntab tus nqi = Float.parseFloat (resVec [kuv+ 1]); // muab lawv tso rau hauv Hashtable newParams.put tshiab (resVec , tus nqi); }} // Yog tias muaj qhov yuam kev tshwm sim, cia peb ntes nws tso tawm thiab tawm mus. catch (Exception ex) {println ("Xov Xwm Zam:" + ex); printArray (resVec); tawm (); }}

// Txhawm rau lim peb cov lus/ * Peb paub tseeb tias tsuas muaj OSC-tawm lus thaum * cov lus nkag (Serial) hloov pauv * Ntawd yog: yog peb tig/thawb lub pob thiab nws hloov tus nqi. * Yog li peb lim tawm cov txiaj ntsig tuaj uas hloov pauv tiag tiag * ceeb toom: peb yuav tsis zam kev dhia qhov tseem ceeb * raws li los ntawm piv txwv li kev ntsuas nrawm lossis ntsuas qhov deb * koj yuav tsum tau ua kom zoo rau koj tus kheej hauv Arduino */ khoob khoob filterParams () {toSendParams = tshiab HashMap (); rau (Txoj hlua tseem ceeb: newParams.keySet ()) {// yog tias tus yuam sij twb muaj tam sim no yog (oldParams.containsKey (tus yuam sij)) {{qhov tseem ceeb tam sim no thiab tus nqi tsis zoo ib yam, tom qab ntawd hloov tshiab yog (! oldParams.get (tus yuam sij).equals (newParams.get (qhov tseem ceeb))) {toSendParams.put (qhov tseem ceeb, newParams.get (qhov tseem ceeb))); }} lwm qhov {// qhov tseem ceeb tsis muaj nyob hauv cov params qub, yog li muab tso rau! toSendParams.put (qhov tseem ceeb, newParams.get (qhov tseem ceeb)); } oldParams.put (qhov tseem ceeb, newParams.get (qhov tseem ceeb)); }}

void makeOSC () {rau (Txoj hlua tseem ceeb: toSendParams.keySet ()) {OscMessage myMessage = tshiab OscMessage ("/"+ qhov tseem ceeb); myMessage.add (toSendParams.get (qhov tseem ceeb)); / * xa xov */ oscP5.send (myMessage, myRemoteLocation); }}

tsis muaj dab tsi translateMessage () {processIncoming (); filterParams (); cov makeOSC (); } // Thaum peb xav luam tawm rau lub qhov rai tsis muaj dab tsi ShowIncoming () {// kom pom cov lus xa tuaj, raws li teev hauv HashMap ntawv ("Tuaj los ntawm Arduino", 20, 20); int y = 20; rau (Txoj hlua tseem ceeb: newParams.keySet ()) {y = y+20; ntawv (qhov tseem ceeb, 20, y); ntawv (newParams.get (qhov tseem ceeb), 300, y); }}

tsis muaj dabtsis showOsc () {text (IncomingOSCMessage, 300, 200); IncomingOSCMessage = ""; }

teeb tsa tsis muaj dab tsi () {qhov loj me (1000, 800); // Theem loj sau (255); keeb kwm yav dhau (0); oldParams = tshiab HashMap (); newParams = tshiab HashMap (); // printArray (Serial.list ()); commsPort = Serial tshiab (qhov no, portName, baudRate);

/ * pib oscP5, mloog cov lus nkag */ oscP5 = tshiab OscP5 (qhov no, mloog qhov chaw);

/* myRemoteLocation yog NetAddress. NetAddress siv 2 qhov ntsuas, * tus IP chaw nyob thiab tus lej chaw nres nkoj. myRemoteLocation tau siv ua qhov ntsuas hauv * oscP5.send () thaum xa osc pob ntawv mus rau lwm lub computer, ntaus ntawv, * daim ntawv thov. siv saib hauv qab no. rau kev ntsuam xyuas lub hom phiaj mloog chaw nres nkoj * thiab chaw nres nkoj ntawm qhov chaw nyob deb yog qhov zoo ib yam, yog li koj yuav * xa xov rov qab mus rau qhov kos duab no. */ myRemoteLocation = NetAddress tshiab (remoteIP, sendPort); }

kos tsis muaj dabtsis () {yog (messageArrived) {keeb kwm yav dhau (0); Txhais lus (); ShowIncoming (); messageArrived = tsis tseeb; } showOsc (); }

void serialEvent (Serial commsPort) {// nyeem ib byte los ntawm qhov chaw nres nkoj txuas: char inChar = commsPort.readChar (); hloov (inChar) {case contactCharacter: commsPort.write (contactCharacter); // nug kom tau ntau println ("pib …"); tawg; rooj plaub startChar: tuaj = ""; tawg; rooj plaub endChar: messageArrived = muaj tseeb; // println ("kawg ntawm msg"); tawg; default: khoom += inChar; tawg; }}

/* cov lus osc xa tuaj raug xa mus rau cov txheej txheem oscEvent. */ void oscEvent (OscMessage theOscMessage) {tus nqi ntab = theOscMessage.get (0).floatValue (); // tau txais 1st osc kev sib cav

IncomingOSCMessage + = "\ n" + String.format ("### tau txais cov lus osc:" + "addrpattern:" + theOscMessage.addrPattern () + ": %f", tus nqi); println (IncomingOSCMessage); }

Kauj ruam 3: Code Arduino

Txoj Cai Arduino
Txoj Cai Arduino

/* Cov cai no yog cov duab kos yooj yim los tham nrog Kev Ua Haujlwm dhau los.

Nws yog daim phiaj xwm uas koj tuaj yeem tso koj tus lej cim tshwj xeeb rau koj tus kheej cov nyees khawm, lub zog loj lossis lub ntsuas pa.

Nws muaj kev tuav tes kom paub tseeb tias peb muaj kev sib cuag thiab hom uas peb tab tom sib tham tau txiav txim siab

Nws yog ib qho tseem ceeb los tsim cov lus no ib yam nkaus, yog li Kev Ua Haujlwm paub yuav tsim kho nws li cas thiab xa cov lus OSC raug rau peb DAW

ua rau werkcollege AV&IT lub kaum hli ntuj 2017

code smooothing tsim 22 Plaub Hlis 2007 los ntawm David A. Mellis hloov kho 9 Plaub Hlis 2012 los ntawm Tom Igoe

*/

/ baud tus nqi const ntev baudRate = 115200;

// sijhawm tos hauv ms ntawm kev xaiv tsa mus rau tus pin const int loopPauseTime = 200; // milli vib nas this

// pib thiab xaus qhov tseem ceeb rau cov lus xa hauv Serial const String startString = "*", endString = "#";

const char contactCharacter = '|';

// pin id's const int buttonPin1 = 2; const int buttonPin2 = 5; const int numReadings = 5; // tus nqi van du

int pitchReading = A1; int speedReading = A2; int infraReading = A3;

// lwm yam kev hloov pauv thoob ntiaj teb int buttonState1 = 0; int buttonState2 = 0; // sib txawv rau kev nyeem ntawv lub laub khawm xwm txheej ntab sensorValue1 = 0; ntab sensorValue2 = 0; ntab sensorValue3 = 0;

// smoothing int nyeem [numReadings]; // kev nyeem los ntawm cov lus qhia analog int readIndex3 = 0; // qhov ntsuas ntawm kev nyeem tam sim no int total3 = 0; // qhov khiav tag nrho ntab nruab nrab3 = 0; // qhov nruab nrab

// Peb xav tau txoj haujlwm no txhawm rau tsim kev sib cuag nrog Kev kos duab kos // Khaws cia ntawm no tsis muaj dabtsis tsim kev sib cuag () {thaum (Serial.available () <= 0) {Serial.print (contactCharacter); // xa tus lej thiab tos rau lo lus teb… ncua (loopPauseTime); } Serial.read (); }

teeb tsa tsis muaj dab tsi () {// teeb tsa pinModes rau txhua tus pin pinMode (buttonPin1, INPUT); pinMode (buttonPin2, INPUT); pinMode (pitchReading, INPUT); pinMode (speedReading, INPUT); pinMode (infraReading, INPUT);

// initialize Serial comms Serial.begin (baudRate); thaum (! Serial); // smoothing rau (int thisReading = 0; thisReading <numReadings; thisReading ++) {nyeem [thisReading] = 0; }

// tos rau kev tuav tes tsimContact (); }

lub voj void () {// pov npav tag nrho cov pins thiab daim ntawv qhia kev nyeem ntawv rau qhov tsim nyog ntau yam buttonState1 = digitalRead (buttonPin1); buttonState2 = digitalRead (buttonPin2); sensorValue1 = analogRead (pitchReading); sensorValue2 = analogRead (speedReading); sensorValue3 = analogRead (infraReading);

// daim ntawv qhia tus nqi nkag mus rau qhov tsim nyog qhov tseem ceeb sensorValue1 = daim ntawv qhia (sensorValue1, 0, 1023, 0, 100.0)/-100.0; sensorValue2 = daim ntawv qhia (sensorValue2, 0, 1023, 0.0, 100) /100.0; sensorValue3 = daim ntawv qhia (sensorValue3, 0, 700, 50, 100);

// smoothing sensor: total3 = total3 - nyeem [readIndex3]; // nyeem los ntawm lub sensor: nyeem [readIndex3] = sensorValue3; // ntxiv qhov nyeem rau tag nrho: total3 = total3 + nyeem [readIndex3]; // ua ntej mus rau txoj haujlwm tom ntej hauv kab lus: readIndex3 = readIndex3 + 1;

// yog tias peb nyob ntawm qhov kawg ntawm kab lus… yog (readIndex3> = numReadings) {//… qhwv ncig mus rau qhov pib: readIndex3 = 0; } // xam qhov nruab nrab: nruab nrab 3 = (total3 / numReadings); // smoothing sensor

Serial.print (startString); // pib cov lus sib txuas // wirte txhua lub npe, tus lej muaj nuj nqis, sib cais los ntawm commas Serial.print ("potentio1"); Serial.print (","); Serial.print (sensorValue1); Serial.print (",");

Serial.print ("potentio2"); Serial.print (","); Serial.print (sensorValue2); Serial.print (",");

Serial.print ("infra-sensor"); Serial.print (","); Serial.print (nruab nrab 3/100); Serial.print (",");

Serial.print ("pob 1 hauv 2 wit"); Serial.print (","); Serial.print (buttonState1); Serial.print (","); Serial.print ("knop2 in5 geel"); Serial.print (","); Serial.print (buttonState2);

// sau qhov kawg ntawm cov lus Serial.print (endString);

// tos ib pliag..

ncua (loopPauseTime); }

Kauj ruam 4: Reaper

Reaper
Reaper

Kauj ruam 1: Xaiv cov kev xaiv> Prefrences

Stap 2: Ga in prefrences naar Control/OSC/web en druk op Ntxiv

Kauj Ruam 3: Kies bij Tswj lub ntsej muag hom voor OSC (Qhib Suab Tswj)

Kauj Ruam 4: Vul je ntaus lub npe hauv, vink Tau txais ntawm chaw nres nkoj aan en vul hauv wat er hauv kev ua bij Sendport staat

Kauj Ruam 5: Kopieer de Host IP tuag je hier ziet en vul deze hauv Kev Ua

Stap 6: Druk op ok en de controller yog nu verbonden ntsib Reaper

Kauj ruam 5: Behuizing

Behuizing
Behuizing

Qhov siab: 170 mm

Loj: 90mm

Hoogte 30 mm

Knoppen: 16 hli (txoj kab uas hla

Potentio meters: 3 hli (txoj kab uas hla)

Qhov siab sensor: Breedte 2.9 hli

Ntev 0.8 hli

Khoom siv: MDF (3mm)

Kauj Ruam 6: Elektronica

Kauj ruam 1:

Cov lus qhia hauv av en 5 volt van Arduino ntsib het breadboard

Kauj ruam 2:

Verbind tus pin A0 ntsib nrog lub zog 1

Verbind tus pin A1 ntsib nrog lub zog 2

Verbind tus pin A3 ntsib infrarood sensor.

Verbind pin A2 ntsib de niet nplaum khawm.

Verbind tus pin A5 tau ntsib de nplaum khawm.

Kauj Ruam 7: Medewerkers

Medewerkers
Medewerkers

- Mayes El Baba

- Arno Gorissen

- Michiel De Wandelaer

Pom zoo: