More, More, More!!
Over the last couple of tutorials we have been building up a MIDI Controller using a trusty Arduino UNO board. So far, we've learned how to connect buttons and potentiometers to the controller and generally had a lot of fun.
"But Dave!! I want to build a custom controller with a zillion pots and buttons! The UNO only has six measily analog inputs and a handful of digital ports! What can I do????"
Never fear! We can add lots of controls to our project with the help of Multiplexers.
Watch This!
What is a Mux?
A Multiplexer is a chip with multiple inputs that can be individually connected to a single output. By sending different combinations of signals to some control pins, each button or pot connected can be read by a single pin on the Arduino. The video explains this in detail.
We will be looking at two popular multiplexers in this lesson. The first is the 74HC4051 which has 8 inputs. The second is the 74HC4067 which has a impressive 16 inputs.
The Software
The Midi Controller program we have used in previous lessons can handle either type of multiplexer with some simple configuration. The video will show you how. Download the software HERE if you don't have it yet.
Stuff you need (With Amazon links)
Here are the parts you will need to do the experiment:
Arduino UNO or Arduino UNO (Official Adafruit Version)
2 x 10K Potentiometers (Linear taper) - Inexpensive
or model used in video
2 x Push Button Switch
74HC4051 Multiplexer (8 Input)
74HC4067 Multiplexer (16 Input)
Breadboard (63 pin width)
MIDI Jack
2 x 220 Ohm Resistors
Jumper Wires
MIDI Cable
Hi!
ReplyDeleteHow to install leds for the buttons, if i want that when I push the button the led is lightning?
Thanks You! :)
I also have this question!
Deletesame
DeleteButtons are when active connected to GND, so you need to add a small inverter parallel to the button. Search for 'transistor inverter with led'
DeleteThis comment has been removed by the author.
ReplyDeletecircuit?
ReplyDeleteHow do I put 2 74hc4067? They are connected in series or parallel?
ReplyDeleteI can not use more buttons in ... Y2... Y7 imputs. I need to change something to use only buttons?
ReplyDeleteI used buttons Yo, Y1, Y2, Y3 but not get in the other Imputs.
ReplyDeleteCan I use Analog and Digital at the same time with this Program?
ReplyDeleteHi. Many Tks for this blog and this prog.
ReplyDeleteMay I share my experiment.
Yes you can use analog and digital at the same time but it has to be one DEMUX board for each.
I have manage to use up to 3 full DEMUX board but the arduino won't cope a fourth full used board due to lack of memory.
My project is a 30 fader midi interface for a lighting program.
RGDS.
FYI modified Controller.cpp for the MEGA on pin 22-25:
ReplyDelete#if defined(__AVR_ATmega2560__)
void Button::muxUpdate()
{
// set S pins on MUX in correct value to read value : eg read Y2: S2-S1-S0 = B010
// pins used on MEGA: 22 (PA0), 23 (PA1), 24 (PA2), (25 (PA3))
// set MUX S-pins LOW
if (_numMuxPins > 8) PORTA = PORTA & B11110000;
else PORTA = PORTA & B11111000;
// add value of temp to PORTA (= add value of the required channel, so set the correct pins)
PORTA = PORTA | _muxpin;
}
#elif defined(__AVR_ATmega328P__)
void Button::muxUpdate()
{
byte temp = _muxpin;
temp = temp << 2;
if (_numMuxPins > 8) PORTD = PORTD & B11000011;
else PORTD = PORTD & B11100011;
PORTD = PORTD | temp;
}
#endif
How can i use it?
DeleteI guess by replacing (in Controller.cpp):
Deletevoid Button::muxUpdate()
{
byte temp = _muxpin;
temp = temp << 2;
if (_numMuxPins > 8) PORTD = PORTD & B11000011;
else PORTD = PORTD & B11100011;
PORTD = PORTD | temp;
}
WITH:
#if defined(__AVR_ATmega2560__)
void Button::muxUpdate()
{
// set S pins on MUX in correct value to read value : eg read Y2: S2-S1-S0 = B010
// pins used on MEGA: 22 (PA0), 23 (PA1), 24 (PA2), (25 (PA3))
// set MUX S-pins LOW
if (_numMuxPins > 8) PORTA = PORTA & B11110000;
else PORTA = PORTA & B11111000;
// add value of temp to PORTA (= add value of the required channel, so set the correct pins)
PORTA = PORTA | _muxpin;
}
#elif defined(__AVR_ATmega328P__)
void Button::muxUpdate()
{
byte temp = _muxpin;
temp = temp << 2;
if (_numMuxPins > 8) PORTD = PORTD & B11000011;
else PORTD = PORTD & B11100011;
PORTD = PORTD | temp;
}
#endif
And then placing the mux S0 to S3 on pin: 22, 23 , 24 , 25
DeleteI'll let you know for sure after I get my mega in the mail :P
hey know how to change the controller.cpp for 32u4 micro much appreciated ?
DeleteI used it but the multiplexers don't work correctly. I think that I nedd more changes in the code, isn'it?. Have you the code for mega?. I need this for a 9 multiplexers with 79 buttons and 24 pots! 4 works properly in the Arduino UNO, but I need more memory for more.
DeleteDave, your multiplexer tutorial it's fantastic! I used it for a couple of projects!
Deleteyou need changes in controller.cpp :
Delete//from this
Mux::Mux(byte outpin_, byte numPins_, bool analog_)
{
outpin = outpin_;
//enablepin = enablepin_;
numPins = numPins_;
analog = analog_;
if (analog == false) pinMode(outpin, INPUT_PULLUP);
//pinMode(enablepin, OUTPUT);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
if (numPins > 8) pinMode(5, OUTPUT);
}
//to this
Mux::Mux(byte outpin_, byte numPins_, bool analog_)
{
outpin = outpin_;
//enablepin = enablepin_;
numPins = numPins_;
analog = analog_;
if (analog == false) pinMode(outpin, INPUT_PULLUP);
//pinMode(enablepin, OUTPUT);
pinMode(22, OUTPUT);
pinMode(23, OUTPUT);
pinMode(24, OUTPUT);
if (numPins > 8) pinMode(25, OUTPUT);
}
fantastic thanks
DeleteI don't understand why these changes are needed. Can someone explain it ?
DeleteDiffrent kind of arduino...the base project is uno but lack of memory then many others try with mega as they has more i/o pin and flash memory...just express my thought...please correct me if im wrong
DeleteThis comment has been removed by the author.
ReplyDeleteThanks for this well-explained video tutorial! I don't know enough about C to figure out whether your controller library can be modified to allow "coarse" (7-bit) NPRN parameters to be assigned to pots / buttons on this shield project.
ReplyDeleteHowever, it seems if an NRPN flag is added to the "command" variable, and if the "note number" / "byte command" variables can hold a 14-bit value for the number of the NRPN parameter to change, then a routine could be added to issue the 9 bytes that make up the NPRN parameter change command (CC / #99 / MSB of NPRN parameter / CC/ #98 / LSB of NPRN parameter / CC/ #6 / 7-bit parameter value to send).
Is this possible?
Thanks notesandvolts for this tutorial! and thanks again!
ReplyDeletehi, i dont understand why but i can't manage to get more pots on multiplexer going right. I use Arduino atmega2560 i did everything as in the tutorial and when i connect more than one pot to it, change program, and suddently it does not work. The first one what was working like a charm when was single on multiplexer after connecting second one start giving random CC number and channel too, the second one does not react at all.
ReplyDeleteHi Neytal Dub,
DeleteKind of have the same problem with the Arduino Uno. The Mux seems to send a lot of noisy data. Did you manage to solve that issue ? Dave, have you ever encountered such situation ?
Thank you for the great tutorials btw !
Hi,
DeleteI have the same issue with the signal out of the multplexer. I don't know how to correct it. I tryed resistors IN or OUT, nothing works.
I have 2 midi signals, one when I push and one when I released the button. I don't understand that too.
If you have informations, I take !
Thanks a lot for the tutorials Dave
me pasa lo mismo con y sin el multiplexor ayuda !!
DeleteThis has been the tutorial I have dreamed of for midi on arduino. The only issue I'm having is it doesn't appear the arduino is storing the sketch. I can upload the sketch and it functions correctly. Once I disconnect the USB cable and reconnect, the sketch does not boot. Google says I have a bad bootloader, however any arduino example sketch uploads and stores like normal. The program doesn't appear to be too big. What am I missing? Thanks in advance and love the channel!
ReplyDeleteFácil de solucionar ese problema, tienes que convertir tu Arduino en un dispositivo HID, BUSCALO EN GOOGLE 'HIDuino' , a mí me funciona excelente.
DeleteHi, i wonder if there is a way how increase read of difference between old and new value on pots. So the pot will not react on small changes. the thing is that i have used cca 30 pots on mixconsole but some of them keep sending messages with very small change. I would like to make all of knobs bit less sensitive so when i want to learn midi knob in software it would not get milions of noise signals. I belive that has to do something with sheet controller.cpp but i am not sure witch part is it. Thank you for any idea
ReplyDeletehi dave,
ReplyDeletei'm using 27 potentiomete and 16 buttons to arduino uno
but how can connect 27 pots via two 4067 mux and 16 buttons via 4067 mux
i'm making to control vdj 8.2
aaa
ReplyDeleteHi Dave, I would like to know if it is possible to connect several multiplexers at the same time, and what modifications would have to be made apart from the array ... I would like to connect as many as possible because I would like to make a midi mixing console
ReplyDeleteDalek DIY Arduino MIDI floor keyboard
ReplyDeleteTotally based on Notes and Volts awesome work:
http://www.notesandvolts.com/…/midi-and-arduino-circuit-ana…
http://www.notesandvolts.com/…/midi-for-arduino-build-midi-…
http://www.notesandvolts.com/…/arduino-midi-controller-pote…
http://www.notesandvolts.com/…/arduino-midi-controller-butt…
http://www.notesandvolts.com/…/arduino-midi-controller-mult…
Features:
- Chromatic footswitches (12 notes)
- Latching retro illuminated sustain footswitch sends MIDI CC 64 and lights when active
- Latching retro illuminated modulation "wheel" footswitch sends MIDI CC 1 and lights when active
- External footswitch jack can receive 1 or 2 external non latching button pedals tip to gnd and ring to gnd (mode selectable via internal switch) programmable via Arduino sketch to send any MIDI message
- External expression pedal jack programmable via Arduino sketch to send any MIDI message
- Power ON footswitch
- Power ON LED
- TX activity LED lights when MIDI messages are sent
- DuPont jumper cables to Arduino pins and 2.1 DC plug from ON switch to Arduino DC jack allow to extract the board for easy reprogramming.
Recipe: https://drive.google.com/drive/u/1/folders/148cmGwMxRVZijUVTqGz-qSvRcxxbOWm9?usp=drive_open
hi. im new in arduino and i want to make midi control. i gave arduino mega and i want to make full digital and full analog midi control. can i make full 54 button and 16 fader from arduino mega without multiplexer?
ReplyDeletecan i use your sketch for it?
thankyou and i really hope you replay as son as posible.
i have te same question and how to write the code then?
DeleteIt is not possible without using multiplexer.
DeleteWe use multiplexer to extend the analog and digital inputs to arduino
but its only use the available digitial and analog pin of arduino mega, not more.
Deletehoe gebruik ik de arduino mega met 3 analoge multiplexers met faders en 4 digitale multiplexers met knoppen met deze code als dat kan met deze code
ReplyDeleteen bedankt voor de mooie tutorials
Hello Excellent !!!!
ReplyDeleteBut could I send PC midi messages with buttons (multiplexed or not) ?
Is the code compatable with HIDUINO??
ReplyDeleteHey , I have a question , if I want to use this with an arduino MEGA2560 would I need to change something else other than the pots , buttons or mux inputs on the code?? is there a separate config for other arduino boards other than the UNO??? thanks
ReplyDeleteExcellent piece of code thanks. Have used it on an UNO and later on a Mega because my project required 14 pots and thirty something buttons so did not need to use multiplexers.
ReplyDeleteMy project kinda grew and now I need to use three multiplexers for buttons so the burning question is..
How do we tweak this code to use more multiplexers?
Hi Dave,fantastic code.I have managed to modify it to work Buttons with ARDUINO MICRO but can't figure out how to get MULTIPLEXER to work with ARDUINO MICRO.I have spent countless hours on this, and have learnt a lot,but have now reached the end of the line. Please help.
ReplyDeleteThanks
multiplexers only will work with UNO
Deleteproblema con el Arduino Uno. El Mux parece enviar una gran cantidad de datos ruidosos. ¿Se las arregló para resolver ese problema? Dave, ¿alguna vez te has encontrado con tal situación?
ReplyDeletehas anybody had any luck converting the controller cpp so this will work with a pro micro 32u4 ? any help much appreciated
ReplyDeleteHas anyone managed to tweak the code to work with a Teensy 2.0? Any help greatly appreciated.
ReplyDelete10*12 matrix circuit and code in program change
ReplyDeleteI found the AS6408 65 channel multiplexer board that can integrate with a minatureised "CORE" duino.
ReplyDeleteThis gives incredibly easy hardware build to access 64 analoglines. used this guide and some others to build an analog input desk for QLCplus lighting controller.
Hi. I have built using the 74HC4051N multiplexer from Philips. I am trying to attach 6 buttons but i can only get signal from pins Y4 and Y0.
ReplyDeleteI want to use it in Arduino pro micro and use it with midi over usb. Is there any chance with the program?
ReplyDeleteI built a Midicontroler with 4051 multiplexers, switches and buttons.
ReplyDeleteWorks very well.
Now I want to add a potentiometer that sends expression on 8 channels simultaneously.
Can I define a button or potentiometer more than once?
I'm interested in using this set up to detect electrochemical DNA changes. Can the inputs be used to pick up small changes in electrical potential?
ReplyDeleteHello there,
ReplyDeletePlease can you help me. Yes I read, it's only for UNO. I built a project with 6 16 port mux. but the memory isn't enough and I also need another 8 channel pot mus to configure.
It will load on a mega but the multiplexers dosn't function.
My project is building an Pianolorollplayer over MIDI.
What can I do?
GRTZ KOOS
This comment has been removed by the author.
Deletehttps://www.youtube.com/watch?v=je3EDVs8Fno No need so many multiplexer for buttons, the correct way is a MATRIZ " look the video.
ReplyDeleteDelete
can i use a multiplexer 74ls151?
ReplyDeletehi thanks for the tutorial. i'm working on a controller with mega2560 6button 31pot, but when i connect 16channel mux the controller doesnt recieve any message from the pot. can you help me ?
ReplyDeleteIs it possible to change the sketch in order to make it work via USB?
ReplyDeleteWhen I add too many buttons I get the message
ReplyDelete"Low memory available, stability problems may occur."
I need 376 buttons for a microtonal controller. Will adding too many buttons create latency? Can I store variables in other places?
¿Cual es el codigo para el arduino mega?
ReplyDeleteWhat is the code for the arduino mega?
is it possible to use 3 multiplexer in a single Arduino board 1 mux for digital output and 2 mux for analog input ?? if yes, how can i use them ??
ReplyDeletethank you
Hi, the tutorial is very good and detailed, but I can't compile it. The download code here is different from that in the video. I don't know how to modify it
ReplyDeleteHi, the tutorial is very good and detailed, but I can't compile it. The downloaded code is different from that in the video. I don't know how to modify it. Do you have the same code in your video?
ReplyDeleteHello, I am using an Arduino Nano and 4051 mux but only 1 input button is triggered at a time. Do anyone knows what is the reason?
ReplyDeletesaludos! ¿Cómo incluir 2 encoder ky-040 al programa?
ReplyDelete
ReplyDeletehello! How to include 2 encoder ky-040 to the program?
The next time I read a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my choice to read, but I actually thought you have something interesting to say. All I hear is a bunch of whining about something that you could fix if you werent too busy looking for attention.
ReplyDeleteHabotao.com
Information
Click Here
Visit Web
Excellent post. I enjoy reading and also appreciate your work. This concept is a good way to enhance knowledge about bottle cap torque tester suppliers. Keep sharing this kind of article. Thank you.
ReplyDeleteI regularly frequented your website. This article makes several thought-provoking historical points, albeit I'm not sure I understand them completely. There is some truth to it, but I'll reserve judgment till I do more research. Thank you for the good article; we need more!
ReplyDeleteCan we have the sketch shown in the video
ReplyDeleteThe Manhattan district attorney’s office questioned the city’s buildings chief as 점보카지노 part of of} an investigation into illegal playing. The Commission added that the inclusion of casinos on the EU-wide AML/CFT framework has had a “mitigating effect” on the chance of cash laundering at these venues. At Algamus, we imagine that a playing dysfunction must be handled with the identical urgency and seriousness as a chronic bodily health concern. If you imagine that you just or a liked one is fighting a playing dysfunction, please reach out to our playing counselors, and we may help you identify the next best steps to take.
ReplyDeletei hope you will add Program Change on command
ReplyDeletethank you notes and volts very educational
Muğla
ReplyDeleteSamsun
Eskişehir
Sakarya
Kars
UM0Z
Balıkesir
ReplyDeleteBursa
Mersin
Konya
Van
HTF1ZY
Antalya
ReplyDeleteÇorum
Uşak
Kayseri
Van
SB5
sakarya
ReplyDeletekars
gümüşhane
elazığ
manisa
CR6
https://titandijital.com.tr/
ReplyDeleteçanakkale parça eşya taşıma
kırıkkale parça eşya taşıma
erzurum parça eşya taşıma
burdur parça eşya taşıma
WWTPG3
is it possible to write a simple code whith changes to use for arduino mega? i tried this code on a mega whith the same build of muxs and pots but the code does not work, the same build on uno works fine. could not find na answer in the internet
ReplyDeleteankara parça eşya taşıma
ReplyDeletetakipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
F72FE
E4FC6
ReplyDeleteBursa Lojistik
Edirne Parça Eşya Taşıma
Ankara Lojistik
Manisa Lojistik
Kilis Evden Eve Nakliyat
6A8A1
ReplyDeleteBolu Parça Eşya Taşıma
Balıkesir Parça Eşya Taşıma
Ardahan Evden Eve Nakliyat
Adana Evden Eve Nakliyat
Niğde Parça Eşya Taşıma
C3E26
ReplyDeleteParibu Güvenilir mi
Bilecik Şehir İçi Nakliyat
Bee Coin Hangi Borsada
Yalova Lojistik
Edirne Evden Eve Nakliyat
Çerkezköy Buzdolabı Tamircisi
Karapürçek Boya Ustası
Kars Şehirler Arası Nakliyat
Kırklareli Lojistik
67281
ReplyDeletebinance komisyon indirimi %20
031BB
ReplyDeletebayburt sohbet siteleri
rastgele görüntülü sohbet
gümüşhane yabancı canlı sohbet
diyarbakır mobil sohbet et
ankara sesli sohbet mobil
aydın rastgele görüntülü sohbet uygulaması
nevşehir rastgele görüntülü sohbet ücretsiz
edirne canli sohbet bedava
sakarya en iyi sesli sohbet uygulamaları
4B6DA
ReplyDeleteAfyon Bedava Sohbet Chat Odaları
canlı sohbet odası
osmaniye görüntülü sohbet uygulama
Amasya Görüntülü Sohbet Odaları
parasız sohbet siteleri
Kayseri Sohbet Muhabbet
karabük bedava görüntülü sohbet
trabzon sohbet odaları
izmir rastgele görüntülü sohbet uygulamaları
548F9
ReplyDeletePepecoin Coin Hangi Borsada
Binance Borsası Güvenilir mi
Görüntülü Sohbet
Telegram Görüntüleme Hilesi
Pinterest Takipçi Hilesi
Shibanomi Coin Hangi Borsada
Arbitrum Coin Hangi Borsada
Raca Coin Hangi Borsada
Kripto Para Kazma
37246
ReplyDeletebitget
bingx
bybit
2024 Calendar
binance referans kodu
April 2024 Calendar
4g mobil
canlı sohbet odaları
kripto para nasıl alınır
F3B93
ReplyDeleteNetflix Dizi Önerileri
Netflix Film Önerileri
fuar standı
fuar standı
dedicated server
Google Reklam Ajansı
seo nedir
Tiktok Beğeni
Oyun Forumu
2CFBC
ReplyDeleteSEO Hizmeti
Kurumsal Hosting
Tarayıcı Oyunları
Facebook Reklam Verme
ehliyet sınav soruları
jeneratör fiyatları
Boştaki Domainler
Fiziksel Sunucu Kiralama
Sosyal Medya Danışmanlığı
81E03
ReplyDeletenetflix film önerileri
Bitcoin Son Dakika Haberleri
Youtube İzlenme Satın Al
offshore hosting
logo tasarım
Yapay Zeka Video Oluşturma
silkroad pvp serverler
Google Harita & İşletme Kaydı
iş ilanları
143D6
ReplyDeleteYoutube Reklam Verme
Hosting Firmaları
Facebook Grup Satın Al
bitcoin forum
Twitter SEO
izlenme satin al
Silkroad Pvp Serverler
Residential Proxy Satın Al
Facebook Reklam Verme
F541B
ReplyDeletefreelance iş ilanları
Telegram Grup Üye Satın Al
Metin2 Pvp Serverler
bitcoin forum
Site Satışı
Bitcoin Son Dakika Haberleri
Domain Firmaları
Twitter Hesap Satın Al
seo danışmanı
ABC98
ReplyDelete4G Mobil Proxy Satın Al
Telegram Abone Satın Al
airdrop coin kazanma
offshore hosting
google 5 yıldız satın al
Wordpress SEO
Youtube Kanal Satın Al
adwords kupon satışı
Eticaret Paketleri
702F6
ReplyDeleteYoutube Abone Satın Al
metin2 sunucu kiralama
Eticaret Paketleri
Instagram Takipçi Satın Al
Logo Tasarım
Facebook Grup Satın Al
Script Satışı
Etsy SEO
Freelance İş İlanları
AF2DE
ReplyDeletesanal ücretli show
2C296
ReplyDeletewhatsapp görüntülü show
2AA3F1798B
ReplyDeletesohbet hatti
sanal seks
sanal sex
cam şov
görüntülü şov
seks hattı
sex hattı
görüntülü sex
cam show