tttapa / MIDI_controller

This is a library for creating a MIDI controller using an Arduino or Teensy board.
GNU General Public License v3.0
402 stars 70 forks source link

Pot values not stable #44

Closed ghost closed 6 years ago

ghost commented 6 years ago

Good afternoon, I have a problem building my own version of the MIDI controller. I used a 4051 multiplexer to have 8 potentiometers connected to my Arduino Uno. I followed all the steps described in the wiki, but when I try to use the Midi device in a Daw it's like all the potentiometers are sending data (not always, but very often), even if I don't touch the pots. I've already controlled I have connected all the pins well. I don't know what to do and MIDI monitor and serial monitor confirm the problem. Here are the specs:

Hardware: 8 pots (10k) and a 4051 multiplexer Arduino board: Arduino UNO rev3

Software versions: MIDI Controller library: 3.0.1 Arduino IDE: 1.8.5 Operating System: Windows 10 MIDIUSB library: 1.0.3

Full code:

include // Include the library

AnalogMultiplex multiplexer(A0, { 2, 3, 4 } ); Analog potentiometers[] = { {multiplexer.pin(0), 24, 1}, {multiplexer.pin(1), 25,1}, {multiplexer.pin(2), 26,1}, {multiplexer.pin(3), 27,1}, {multiplexer.pin(4), 28,1}, {multiplexer.pin(5), 29,1}, {multiplexer.pin(6), 30,1}, {multiplexer.pin(7), 31,1} }; void setup() { }

void loop() { MIDI_Controller.refresh(); //controllo se le posizioni dei potenziometri sono cambiate

}

The goal of my project is to build a MIDI controller with 13 pots and 9 switches, but first of all I would like to solve this problem.

Here are the schematics and a shoot at the MIDI monitor.

untitled sketch 2_bb

B0 1E 57 Control Change Control 30 87 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1E 58 Control Change Control 30 88 Channel 1 B0 1E 57 Control Change Control 30 87 Channel 1 B0 1C 7E Control Change Control 28 126 Channel 1 B0 1E 58 Control Change Control 30 88 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1C 7E Control Change Control 28 126 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1C 7E Control Change Control 28 126 Channel 1 B0 1E 57 Control Change Control 30 87 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1C 7E Control Change Control 28 126 Channel 1 B0 1E 58 Control Change Control 30 88 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1C 7E Control Change Control 28 126 Channel 1 B0 1E 57 Control Change Control 30 87 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1E 58 Control Change Control 30 88 Channel 1 B0 1E 57 Control Change Control 30 87 Channel 1 B0 1E 58 Control Change Control 30 88 Channel 1 B0 1C 7E Control Change Control 28 126 Channel 1 B0 1E 57 Control Change Control 30 87 Channel 1 B0 1C 7F Control Change Control 28 127 Channel 1 B0 1E 58 Control Change Control 30 88 Channel 1 B0 1E 57 Control Change Control 30 87 Channel 1

tttapa commented 6 years ago

This is a known issue, the analog inputs are pretty noisy. The newest version of the library has improved filtering and hysteresis, which should eliminate most of your problems.

You can try using the master version instead of version 3.0.1. (On the homepage, use the green 'Clone or download' button.)

I don't have the time to make it an official release right now, but it should work. I only tested the master version on Teensy and Leonardo, but it seems to compile for UNO, so I don't expect too many problems.

ghost commented 6 years ago

Thanks for your answer. The newest version you are referring to is the 3.0.1 or a version that is stil in development?

tttapa commented 6 years ago

3.0.1 is the latest stable release, you need the newest master version, it is still in development, but it works.

ghost commented 6 years ago

Many thanks. Sorry for so much quesitons. How can I download and install this version you are saying about?

tttapa commented 6 years ago

On the homepage, using the green button in the top right, or using this link.

tttapa commented 6 years ago

The installation is the same, just use this zip instead of the other one. Make sure you delete the old library before trying to compile anything.

ghost commented 6 years ago

Many thanks! Now it is working properly!