I would go with the resistor array and analog mux idea.
will probably come down to what is cost effective ? even if it means a little more work .
Analogous to Occam’s Razor ( simpler theories are preferable to more complex ones because they are more testable ) I’d go for the simplest solution because it is easier to debug in case of trouble.
I’m using an io expander in my project I haven’t touched in weeks for rotary encoders. Also, I believe it would be a digital mux.
Okai, so analog inputs then
Can I do it like this or will I get a problem with all the rotary switches drawing from the same voltage divider? I think it should work, because only one of them will be connected to the ADC in the Arduino at the same time through the 74HC4051… Should I add capacitors somewhere?
(This is only a few of the switches drawn, there will be 8 and then another 8, so 16 in total)
That should not be a problem. The switches themselves don’t draw current. But it is wise to keep the wires to the switches as short as possible, especially if you are adding more switches. They could pick up all kinds of noise. Although given that the step size between the voltages is high (5 V / 8 in this schematic) that won’t be a problem. Do not however forget to connect the inputs of the mux you do not use to some fixed value (Gnd or +5V), so that their values are defined (i.e. a standard rule when using cmos). If you do not use connections 9 to 12 of the switches the same applies for them. Give them a fixed value so that the inputs they are connected to always are defined.
That Drill method that sam did for twisting wire has saved me so much time and making stuff overall cleaner.
Hello, this is my first post here and i came across a web search of the command: CCIncrementDecrementButtons
I am very new with arduino and coding and i just bought a TTGO T display esp32 board, it includes 2 small buttons on the GPIO 0 and 35 as seen on my attachment.
I am trying to set them as CC incrementers but i havent been succesfull.
I want to send the codes via bluethoot ( serial port) and in conjunction with a small app called hailress midi for windows, i and to receive such messages on a DAW (Gig performer)
I am sure something else is missing n my code so i wonder if you can advice or help
Thank you
Code:
#include <Arduino.h>
#include <BLEMidi.h>
#include <Control_Surface.h>
CCIncrementDecrementButtons buttons {
{0, 35}, // Button pins: 0 increments, 35 decrements
23, // Increment/Decrement CC address
1, // Multiplier
24, // Reset note address
};
void setup() {
Control_Surface.begin(); // Initialize Control Surface
}
void loop() {
Control_Surface.loop(); // Update the control surface
}
#include “BluetoothSerial.h”
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run make menuconfig
to and enable it
#endif
BluetoothSerial SerialBT;
void midi(unsigned char command, unsigned char note,unsigned char vel)
{
SerialBT.write(command);
SerialBT.write(note);
SerialBT.write(vel);
I haven’t officially started developing on esp32s, but I would start simple and use the debug midi interface to make sure everything works. You’d see all the midi messages in the serial console.
Also I noticed that you are using other Bluetooth libs. I would check the control surfac docs for their implementation since that’s what is being updated in the loops.
I’m pretty sure the reference to building a bt config is part of the esp 32 setup. Kinda like how you set it up for wifi and things.
Well, i would kindly ask more details about:
1.-what or where is the Debud midi intarface?
2.- how can i troubleshoot? i dont have any error when i compile
I am attaching a new “unralated” code that i got from another youtuber.
He was sending some mide notes (not MIDI CC but notes) and i was able to replicate that behavior (check my youtube video: test - YouTube)
My understanding about BT is the next one:
There are 2 versions (if i can say that) Clasic and BLE, the last one is the one that is “fully” compatible with MIDI the one one my video is classic BT as i can check it with an android app called “serial Bluetooth terminal” . What the code on the video does, is to create a serial port, hence i need hariless app to " translate " the data to midi, and i can see the notes generated wih my esp32 on Gig performer an also on hairless app. once that i use “CCIncrementDecrementButtons” nothing is displayed on the debugger i use. wondering if it is because of the BT version, or because i am not really “printing” the messages to the serial comunication thing.
I want to add that there are no many resources related to “CCIncrementDecrementButtons” in google, so any help from you would be highly (really) apreciated
the code on the video goes as follows:
#include <Arduino.h>
#include <BLEMidi.h>
const int nBotones = 2; //este es el número de botones
const int calibracion=130; //este valor funciona como una especie delay (es el numero de loops minimo de espera que debe haber entre cada repetición de nota)
boolean notaioff[nBotones];
int contador[nBotones];
//el array notas debe tener un mismo número de elementos
//que el número de botones, pues cada nota corresponde a un botón
byte notas = {22,23}; //estás son las notas que se dispararán los botones
byte botones = {0,35}; //aqui se ponen los GPIO de cada boton, el numero de elementos debe ser nBotones
bool hayip=false;
#include “BluetoothSerial.h”
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run make menuconfig
to and enable it
#endif
BluetoothSerial SerialBT;
void setup() {
Serial.begin(115200);
SerialBT.begin(“MIDI-blue”); //Bluetooth device name
Serial.println(“The device started, now you can pair it with bluetooth!”);
for (int i=0;i<nBotones;i++)
{
pinMode(botones[i], INPUT_PULLUP);
}
analogReadResolution(10);
}
void midi(unsigned char command, unsigned char note,unsigned char vel)
{
SerialBT.write(command);
SerialBT.write(note);
SerialBT.write(vel);
}
void loop() {
for (int i=0; i<nBotones; i++) //la variable i recorre los números del 2 al 6
{
if (digitalRead(botones[i]) == LOW) //botón presionado
{
if (contador[i]==0)//cuenta regresiva terminada ?
{
if (notaioff[i]== 1) //¿la nota esta apagada?
{
contador[i]=calibracion; //valor de cuenta regresiva
midi(144,notas[i],100); //se envía la nota
notaioff[i] = 0; //la nota no esta apagada (esta encendida)
}
}
}
else //botón sin presionar (posible envio de Note Off)
{
if (contador[i]==0) //cuenta regresiva terminada ?
{
if (notaioff[i] ==0) //¿La nota esta esta activada?
{
contador[i]=calibracion; //valor de cuenta regresiva
midi(144,notas[i],0); //envio de note off
notaioff[i] = 1; //la nota ya no está encendida
}
}
}
}
for (int i=0; i<nBotones;i++)
{
if (contador[i]>0) contador[i]–;
}
delay(1); //para estabilidad
}
Could you please anything related to the buttons and the MIDI data on the first code i attached on my previous messages?
A BIG thak you in advance
Cheers
Hi. Now I have taken a different path. Actually, what i have explained on my previous post is now trash.
I was taking the approach of using the Serial connection (UART) over USB (see link ArduinoBLE - Arduino Reference) now i am using Bluetooth BLE and instead of Hairless app, i am using MIDI berry for windows. I took another code i saw from github (Problem with HairlessMIDI_Interface - seems to freeze on Control_Surface.begin() · Issue #134 · tttapa/Control-Surface · GitHub) but still i have the same issue, no midi transfer. I would say it should work similarly to hairless app, i mean, for MIDI debugging tasks, i can not see anything in midi berry when pressing buttons. I can connect my board via BLE to my windows laptop. I can see the device on MIDI berry and i can “select” the destination of the data trafic, but still, the mentioned GPIO/pins are not sending any data.
Now, because (in my opinion, there are not many CCIncrementDecrementButtons samples onthe web, can anyone give me a real example woring either on MIDI Usb or bluethooth? I think i might need to add a MIDI CC number on the secttion with the red line on my attachment:
Thanks
ok just to clarify, should the “CCIncrementDecrementButtons” generate a MIDI signal? i can try with “CCButton button” or something else that generates any MIDI data if i get an example but i need a written example just to make sure i am following the right path
Today the first of several showcases by ‘Nerd Musician’ was live on youtube where people showed midi controllers they designed. The discussion might be of interest to you:
120 knobs and switches controller for the Arturia CS80v with a ribbon controller. The limit on CC is around 120 controls as some are reservered for special messages. Using NRPN or sysex gets around the CC limits, but Arturia products don’t support anything but CC.
What brand / type of sliders were used in this controller?
I really don’t know, I bought 150 of them for £1 each as a job lot, I think I have 1 left. Never seen them since and also asked the seller and he has none left. That’s the only marking on them.
Do you use any kind of denoising when reading the slider values?
Yeah, I use an average check and a tolerance before I say a movement has happened.