Cov txheej txheem:

Arduino Guitar Jack Key Holder With Jack Recognition & OLED: 7 Kauj Ruam
Arduino Guitar Jack Key Holder With Jack Recognition & OLED: 7 Kauj Ruam

Video: Arduino Guitar Jack Key Holder With Jack Recognition & OLED: 7 Kauj Ruam

Video: Arduino Guitar Jack Key Holder With Jack Recognition & OLED: 7 Kauj Ruam
Video: How to Check your mirrors at airbnb 2024, Hlis ntuj nqeg
Anonim
Image
Image
Arduino Guitar Jack Key Holder Nrog Jack Paub & OLED
Arduino Guitar Jack Key Holder Nrog Jack Paub & OLED

Qhia:

Cov lus qhia no yuav piav qhia qhov tsim ntawm kuv Arduino raws li Guitar Jack plugin tus tuav tuav

Nov yog thawj qhov kuv tau qhia yog li thov ua siab ntev nrog kuv vim kuv tuaj yeem hloov pauv / hloov kho tshiab

Kauj ruam 1: Qhov & Cov Cuab Yeej

Qhov & Cov Cuab Yeej
Qhov & Cov Cuab Yeej
Qhov & Cov Cuab Yeej
Qhov & Cov Cuab Yeej
Qhov & Cov Cuab Yeej
Qhov & Cov Cuab Yeej

Feem ntau ntawm cov khoom kuv tau yuav los ntawm Amazon.co.uk lossis eBay, qee qhov kuv tau ncaws ib ncig lawm - Nov yog cov npe ntawm yam koj yuav xav tau.

Amazon txuas yog txhua qhov kev sib koom ua ke, koj tuaj yeem tuaj yeem nrhiav qhov pheej yig dua lwm qhov - Kuv siv Amazon Prime ntau, yog li Amazon tsuas yog tshwm sim los ua kuv mus -rau.

Kuv xav khaws qhov kev tsim no kom haum tus nqi qis thiab siv nyiaj txiag zoo. Koj tuaj yeem siv lub vijtsam TFT loj dua yog koj xav tau, nrog rau Arduino sib txawv. Tsis txhob siv NANO, vim nws yuav tsoo vim siv lub cim xeeb siab. Txoj cai siv txog 72% ntawm Pro Micro's RAM thiab ruaj khov, tab sis los ntawm kev sim, NANO yuav tsoo thiab khov.

(Xav paub ntau ntxiv hauv Txoj Cai Kauj Ruam.)

XEEM

1x Arduino Pro Micro -

1x 0.96 "OLED nrog Daj & Xiav Zaub -

4x WS2812 'Pixels' -

1x DS3231 RTC -

4x 1/4 Mono Jack (Los yog ntau npaum li koj xav tau) - Amazon (Kub) lossis Amazon (Nyiaj) lossis eBay.co.uk

1x Mixed Resistor Pack -

4x 1/4 Guitar Jacks -

1x Micro USB Cable Extension Cable -

4x M3 Ntsia Hlau

TOOLS & KHOOM

- Soldering Iron (Qhov no yog qhov kuv yuav - TS100 - raws li nws tuaj nrog cov lus qhia ntxiv

- Tub Rog

- Hot Glue Gun (https://amzn.to/2UTd9PN)

- Hlau (https://amzn.to/2VK2ILU)

- Cov tshuab txiav hlau/txua ntoo (https://amzn.to/2KzqUzp)

- 3D Tshuab Luam Ntawv lossis 3D Printing kev pabcuam

YOOJ YIM - Cov khoom no yog nyob ntawm yeem, nyob ntawm seb koj xaiv txuas txhua yam li cas

- Veroboard/Stripboard (https://amzn.to/2KzMFPE)

- Ntsia Hlau Terminal Connectors (2 Ncej | 3 Ncej | 4 Ncej)

- PCB Headers (https://amzn.to/2X7RjWf)

Kauj Ruam 2: 3D Luam Ntawv Case

3D Luam Ntawv Case
3D Luam Ntawv Case
3D Luam Ntawv Case
3D Luam Ntawv Case
3D Luam Ntawv Case
3D Luam Ntawv Case
3D Luam Ntawv Case
3D Luam Ntawv Case

Kuv luam kuv li ntawm kuv Creality CR-10S, siv Dub PLA+ (https://amzn.to/2X2SDtE)

Kuv luam tawm ntawm 0.2 txheej qhov siab, nrog 25% ntxiv.

Kauj Ruam 3: Muab Nws Ua Ke + Schematic

Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic
Tso Nws Txhua Qhov Ua Ke + Schematic

Koj xaiv txuas koj li Arduino li cas rau koj - Kuv tus kheej tau xaiv ua kuv tus kheej li "ntaub thaiv npog" thiaj li hais tau. Txhawm rau ua daim ntaub thaiv, Kuv tau siv cov poj niam lub taub hau rau veroboard kom haum rau Pro Micro, tom qab ntawd kuv tau ntxiv txoj kev tsheb nqaj hlau ntawm +5v thiab GND, ntawm qhov tsis sib xws. Kuv tau siv jumper hlau txuas rau +5v rau kuv tam sim no 5v 'tsheb nqaj hlau', thiab ua tib yam rau GND. Tom qab ntawd kuv ntxiv kuv 4x 100k resistors, ib kawg txuas rau +5v rau txhua tus ntawm lawv, thiab tom qab ntawd lwm sab txuas rau A0, A1, A2 & A3 feem. Tom qab ntawd kuv tau ntxiv cov ntsia hlau txuas rau analog pins A0, A1, A2 & A3 thiab tseem Pins 2 (SDA), 3 (SCL) & 4

Ntsuas koj cov xov hlau thiab txiav kom haum qhov ntev. Kuv pib nrog WS2812 Pixel LEDs ua ntej - thawj WS2812 LED txuas rau +5v los ntawm Arduino, GND los ntawm Arduino, thiab DIN txuas rau Pin 4. Tom qab no, seem 3 tau txuas ua ke, txuas tag nrho 5v> 5v, GND> GND pins thiab DOUT los ntawm ib lub Pixel, txuas rau DIN ntawm qhov tom ntej. Thaum soldered, Nias cov no maj mam mus rau hauv lub qhov square nyob rau sab saum toj, thiab cov kua nplaum kub nyob rau hauv qhov chaw thiab tseem tiv thaiv lub nraub qaum los ntawm kev sib tsoo lossis luv.

Tom qab cov LEDs, Kuv mam li ntswj rau hauv Guitar Jack Sockets. Ib tus pin ntawm txhua qhov txuas rau GND, thiab tom qab ntawd tus pin thib ob ntawm txhua qhov txuas rau A0, A1, A2 & A3 raws li. Yog li ntawd lub qhov (socket) 1, rau A0, Qhov 2 rau A1, Qhov 3 rau A2, thiab Qhov Ntsuas 4 rau A3.

Tom ntej no kuv tau siv 4 lub xov hlau txuas rau OLED sib txuas, thiab txiav tawm ib qho laug ntau npaum li ntau tau. Koj xav kom txuas koj cov xov hlau los ntawm sab nraum qab ntawm lub vijtsam, yog li koj tau xau rau sab xub ntiag ntawm lub vijtsam.

Ua tib zoo mloog cov pins! Qee OLEDs muaj GND nyob sab nraud, tom qab ntawd VCC, qee qhov muaj VCC nyob sab nraud, thiab tom qab ntawd GND

Thaum soldered thiab koj tau txiav lossis flatted hauv qhov txuas txuas kom ntau li ntau tau, maj mam nias lub vijtsam rau hauv nws qhov chaw. Nws yog qhov nruj me ntsis los ntawm kev tsim, tab sis yuav tsum paub tias kev sib txawv luam ntawv zam tuaj yeem cuam tshuam qhov no thiab yog li koj yuav tsum tau ua qee qhov kev ua haujlwm me me tom qab ua kom nws haum. Thaum nyob hauv qhov chaw, tso qee cov kua nplaum kub hla txhua ntawm 4 lub ces kaum los tuav nws hauv qhov chaw.

Txuas txhua yam kom haum rau Schematic thiab cov duab, thiab ib zaug zoo siab, koj tuaj yeem tom qab kub kua nplaum Pro Micro thiab RTC Moos nyob rau hauv qhov chaw ib yam, thiab tom qab ntawd txuas USB txuas mus rau Pro Micro.

Kuv siv micro USB txuas ntxiv kom a) USB tuaj yeem siv los muab lub zog, tab sis ntau dua, b) yog li nws tuaj yeem rov ua dua Pro Micro yog tias xav tau yam tsis rub txhua yam sib nrug

Thaum zoo siab, ntsaws rooj plaub ua ke siv 4 tus ntsia hlau

Kauj ruam 4: Plugs

Cov Plugs!
Cov Plugs!
Cov Plugs!
Cov Plugs!
Cov Plugs!
Cov Plugs!

Txoj hauv kev no ua haujlwm, yog qhov, rau txhua qhov kev xav thiab lub hom phiaj, ib feem ntawm kev tsim qauv ua "ohmmeter". Lub ohmmeter yog lub ntsuas ntsuas hluav taws xob tsis kam. Feem ntau Multimeters muaj txoj haujlwm no uas koj tuaj yeem ntsuas qhov ntsuas thiab tom qab ntawd ntsuas tus tiv thaiv kom pom nws tus nqi. Tus thawj xibfwb ua haujlwm yog tias koj txuas KNOWN resistor rau +ve, uas yog tom qab txuas nrog rau UNKNOWN resistor, uas txuas rau -ve. Kev sib koom ua ke ntawm 2 tus tiv thaiv txuas rau Arduino analog pin kom nws tuaj yeem nyeem qhov hluav taws xob thiab suav qhov tsis kam.

Nws ua haujlwm zoo li qhov faib hluav taws xob thiab suav qhov tsis kam ntawm qhov tsis paub meej resistor.

Raws li qhov faib hluav taws xob faib hluav taws xob network ntawm resistors R1 thiab R2, Vout = Vin * R2 / (R1 + R2) - Peb siv 100k rau peb paub (R1) resistor. Qhov no ua rau peb "poob qis"

Los ntawm qhov no, tam sim no peb tuaj yeem ua haujlwm tawm tsam qhov tsis paub (R2) resistor, R2 = Vout * R1 / (Vin - Vout) - qhov twg R1 yog peb 100k (100, 000 ohm) resistor

Los ntawm kev siv tus tiv thaiv sib txawv hauv txhua lub ntsaws ntsaws koj xav siv, tom qab ntawd koj tuaj yeem kho qhov chaws raws li nyob ntawm lub jack siv.

Kuv siv 4 jack plugs. Kuv xaiv siv:

Paub Resistor (x4) - 100k

Jack Plug 1 - 5.6k

Jack Plug 2 - 10k

Jack Plug 3 - 22k

Jack Plug 4 - 39k

Koj tuaj yeem tuaj yeem nthuav qhov no, thiab ua lej ntau npaum li koj xav tau.

Kauj ruam 5: Txoj Cai

Txoj Cai
Txoj Cai

Ua ntej, koj yuav xav tau Arduino IDE, muaj los ntawm no:

Koj tseem yuav tsum tau ua kom ntseeg tau tias koj muaj ob peb lub tsev qiv ntawv Arduino ib yam nkaus:

Adafruit NeoPixel:

u8g2:

Adafruit RTCLib:

Adafruit SleepyDog (Tsis teb los tau):

Cov ntawv ceeb toom txog kev xaiv lub rooj "Arduino" raug. Keeb xeeb kuv pib txoj haujlwm no nrog Arduino Nano, vim tias lawv pheej yig heev ntawm kwv yees li-3- £ 4 hauv tebchaws Askiv, lossis tsawg li £ 1.50 yog tias koj yuav los ntawm AliExpress (tab sis tsis txhob mloog 30-50 hnub tos). Qhov teeb meem nrog Nano yog tias nws yog SRAM yog 2 KB (2048 bytes). Cov duab no siv 1728 bytes ntawm lub cim xeeb hloov pauv nrog Ntiaj Teb Variables. Qhov ntawd yog 84% ntawm SRAM, tawm tsuas yog 320 bytes pub dawb rau qhov sib txawv hauv zos. Qhov no tsis txaus thiab yuav ua rau Nano kaw thiab khov.

Pro Micro (Leonardo) muaj 2.5K SRAM (2560 bytes), uas txhais tau tias muaj 694 bytes pub dawb rau qhov sib txawv hauv zos (Cov duab kos siv 72% ntawm Pro Micro's SRAM). Txog tam sim no qhov no tau ua pov thawj txaus txaus thiab ruaj khov rau kuv siv. Yog tias koj npaj siab siv ntau lub ntsaws ntsaws, tom qab ntawd koj yuav xav txiav txim siab siv qee yam nrog ntau SRAM.

Raws li Flash cia muaj kev txhawj xeeb, daim duab no siv 88% (25252 bytes) ntawm 30k (Lub ATMega328p [Nano] thiab ATMega32u4 [Pro Micro] ob leeg muaj 32k, tab sis 2k tshwj tseg rau lub bootloader)

Kuv tau sau ntau pua daim duab Arduino ntau xyoo, tab sis kuv yog tus nyiam ua haujlwm - yog li nco ntsoov qee qhov ntawm cov cai yuav tsis muaj txiaj ntsig lossis tej zaum yuav muaj "txoj hauv kev zoo dua los ua qhov no" cov xwm txheej. Uas tau hais tias, nws ua haujlwm zoo kawg nkaus rau kuv thiab kuv zoo siab nrog nws. Kuv siv cov tsev qiv ntawv uas YUAV TSUM ua haujlwm ntawm cov laug cam feem ntau, txawm tias nws yog AVR (feem ntau yooj yim Arduino's) lossis SAMD21 (Kuv muaj me ntsis ntawm Cortex M0 cov cuab yeej)

Kuv xav ua kom pom cov duab sib txawv raws li lub jack siv ib yam. Yog tias koj xav ua koj tus kheej, qhov no yog cov lus qhia yooj yim tshaj plaws ntawm yuav tsim C Array rau cov duab kom siv nrog cov zaub no li cas:

sandhansblog.wordpress.com/2017/04/16/interfacing-displaying-a-custom-graphic-on-an-0-96-i2c-oled/

Nco ntsoov siv PROGMEM rau koj cov duab. Piv txwv:

zoo li qub tsis tau kos npe YOUR_IMAGE_NAME PROGMEM = {}

Los ntawm kev tsim, lub vijtsam yuav "sijhawm" tom qab 5 vib nas this thiab rov qab los tso saib lub sijhawm.

Feem ntau ntawm Cov Chaw tuaj yeem pom nyob hauv Settings.h, tshwj xeeb, lub npe ntawm cov kab txuas txuas txuas tau teev tseg ntawm no:

#define PLUG1 "KEYS"

#define PLUG2 "P2" #define PLUG3 "P3" #define PLUG4 "P4" #define GENERIC "NA"

Kuj tseem muaj qee qhov tseem ceeb ntawm cov cai hauv Variables.h

ntab R1 = 96700.0;

ntab R2 = 96300.0; ntab R3 = 96500.0; ntab R4 = 96300.0;

Cov no yog KNOWN qhov tseem ceeb tiv thaiv, hauv ohms, ntawm txhua ntawm 4 tus tiv thaiv.

R1 txuas nrog A0, R2 rau A1, R3 rau A2, thiab R4 rau A3.

Nws raug nquahu kom ntsuas koj li 100k resistors siv lub multimeter thiab siv tus nqi tseeb ntawm tus tiv thaiv. Siv qhov ntsuas ntawm tus tiv thaiv thaum txhua yam txuas nrog. (Tab sis tsis siv rau).

Thaum xaiv tus tiv thaiv rau koj lub ntsaws ntsaws, xyuas kom muaj qhov sib txawv ohm zoo nruab nrab ntawm lawv, thiab thaum ntsuas lawv, muab koj tus kheej kom zoo ntau yam qis dua thiab siab dua koj xaiv tus tiv thaiv. Nov yog qhov kuv tau siv hauv kuv tus lej:

float P1_MIN = 4000.0, P1_MAX = 7000.0; // 5.6K ib

float P2_MIN = 8000.0, P2_MAX = 12000.0; // 10K float P3_MIN = 20000.0, P3_MAX = 24000.0; // 22K float P4_MIN = 36000.0, P4_MAX = 42000.0; // 39K ib

Qhov laj thawj rau qhov no yog txhawm rau txheeb xyuas qhov sib piv nyeem thiab qhov hloov pauv me me ntawm qhov hluav taws xob thiab lwm yam

Yog li dab tsi tshwm sim yog, yog tias qhov ntsuas tsis kam nyob nruab nrab ntawm 4000 ohms thiab 7000 ohms, peb tab tom xav tias koj tau siv 5.6k resistor thiab yog li cov cai yuav pom qhov no li Jack Plug 1. Yog ntsuas tau ntsuas yog nruab nrab ntawm 8000 ohms thiab 12000 ohms, qhov kev xav yog tias nws yog 10k resistor thiab yog Jack Plug 2 thiab ntxiv rau.

Yog tias koj yuav tsum tau ua qee qhov kev debugging (Tsis txhob tso qhov tsis txaus ntseeg hauv 'kev tsim khoom' txij li cov kev debugging siv cov cuab yeej zoo) yooj yim tsis pom cov kab koj xav tau nyob rau sab saum toj ntawm Settings.h

//#txhais SERIAL_DEBUG

//#txhais WAIT_FOR_SERIAL

Txhawm rau tsis pom zoo, tshem tawm qhov yooj yim //…. los tawm tswv yim kab rov qab tawm, rov ntxiv // rau sab xub ntiag ntawm kab.

SERIAL_DEBUG ua rau kom debugging cov lej thiab siv qee yam xws li (piv txwv)

Serial.println (F ("nyob zoo lub ntiaj teb"));

WAIT_FOR_SERIAL yog ib qib ntxiv, uas txhais tau tias, kom txog thaum koj qhib Serial Monitor, cov cai yuav tsis txuas ntxiv. Qhov no pab xyuas kom koj tsis nco cov lus tseem ceeb. - Tsis txhob tso daim ntawv no tseg

Yog tias koj tso WAIT_FOR_SERIAL qhib, koj yuav tsis tuaj yeem siv koj tus tuav tuav hauv ib qho "ntiaj teb tiag" ib puag ncig vim nws yuav raug nyam tos rau Arduino IDE Serial saib ua ntej nws tuaj yeem txuas mus rau hauv lub voj loj ntawm daim duab. Thaum koj tau ua tiav koj qhov kev debugging, xyuas kom tseeb tias koj tsis pom zoo rau kab no dua, thiab rov xa koj daim duab kos rau kev tsim khoom/ua tiav.

Thaum siv qhov kev xaiv SERIAL_DEBUG, kuv cov cai muaj cov hauv qab no:

#ifdef SERIAL_DEBUG

Serial.print (F ("ACTIVE JACK =")); Serial.println (ACTIVE_JACK); int len = sizeof (SOCKET_1234_HAS_PLUGTYPE_X)/sizeof (SOCKET_1234_HAS_PLUGTYPE_X [0]); rau (int i = 0; i <len; i ++) {Serial.print (F ("SOCKET_1234_HAS_PLUGTYPE_X [")); Serial.print (kuv); Serial.print (F ("] =")); Serial.println (SOCKET_1234_HAS_PLUGTYPE_X ); } Serial.println (); yog (INSERTED [lub qhov (socket)) {Serial.print (F ("Plug rau lub qhov (socket))); Serial.print (qhov (socket)+1); Serial.print (F ("muaj qhov tsis txaus siab ntawm:")); Serial.println (tsis kam); } #endif

Qhov kawg Serial.print kab yuav qhia koj tias kev tiv thaiv yog dab tsi, hauv ohms, ntawm qhov kawg tso rau hauv. Yog li koj kuj tseem tuaj yeem siv daim duab no ua ohmmeter ntawm kev txheeb xyuas qhov tsis kam ntawm lub ntsaws ntsaws.

Kauj ruam 6: Sau ntawv

Kuv xav tias kuv tau them txhua yam, tab sis thov tawm tswv yim thiab kuv yuav ua qhov zoo tshaj plaws los nyeem thiab teb thaum kuv tuaj yeem:)

Thov txim rau qee qhov yeeb yaj kiab tsis zoo - Kuv tsis muaj lub koob yees duab, teeb tsa rov qab lossis thaj chaw ua haujlwm kom raug thiaj li hais tau qhov no tau ua yeeb yaj kiab (tsis zoo) tuav lub xov tooj hauv ib txhais tes thiab sim ua kom nws nrog lwm tus.

Ua tsaug rau kev nyeem ntawv.

Pom zoo: