BCD to Decimal decoder Connection

Hello everyone. I am new at this, I am working on Midi project, so i removed everything but keys and circuit of keyboard, it has 49 keys connected to TC4028BP on board, i want to know how to connect it in Arduino and make Midi controller. this is my first project, please help me if you can. Thanks in advance.

A tough one for the first time. I would start by getting the Arduino cookbook, and going through it. Then go on line and look at the many Arduino MIDI projects, many have code. You should also keep in mind you want to look at serial protocols and configurations. Try this link: The MIDI Physical Layer. At this point you will have many more questions but also an understanding of what you are trying to do. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

The TC4028BP is an IC that turns on one of 10 outputs based on 4 inputs. I suspect it is being used as the 'row selector' of a matrix keyboard. I can't tell if the keyboard matrix is 10x5 or 8x8 (using only 3 inputs and 8 outputs of the TC4028BP). You would use 3 or 4 OUTPUT pins on the Arduino to set a pattern on the inputs of the TC4028BP and then use 5 or 8 INPUT pins (with pull-down resistors) to sense the outputs from the keyboard matrix. Do that for the 8 or 10 patterns of the 3 or 4 output pins and you will get 50 or 64 bits of keyboard state.

Most MIDI Controllers use MIDI over USB, not serial MIDI.

Here's an overview of the MIDI over USB support of different Arduino boards: MIDI over USB

To use the BCD to Decimal decoder, connect the A, B, C and D inputs to four outputs of the Arduino. Connect the remaining lines of the keyboard matrix to input pins on the Arduino. You'll probably have to provide external pull-down resistors.

In your code, you can use the Control Surface library I'm working on, it provides a uniform layer on top of many different MIDI interfaces (MIDI over USB, MIDI over Serial, MIDI over Bluetooth). Here's an example that shows you how to send notes: Control Surface: Send-MIDI-Notes.ino

To scan the keyboard matrix, select one of the TC4028's 10 lines at a time, you can use something like this:

const uint8_t addressPins[] = {2, 3, 4, 5}; // pins A, B, C & D

void selectLine(uint8_t line) {
    uint8_t mask = 1;
    for (uint8_t addressPin : addressPins) {
        digitalWrite(addressPin, (line & mask) != 0);
        mask <<= 1;
    }
}

It's possible that the TC4028 is used in octal mode, if that's the case, just use 3 instead of 4 pins.

Then read all input pins of the matrix. There are many tutorials online on how to read keyboard matrices.

Pieter

guys thank you all, but i cant clearly get how to make it with this decimal decoder, i have arduino mega so can i connect that all 50 pins into arduino and make usb midi, sorry i am nerd at that code thing

My approach would be something along these lines (compiled, but untested):
https://tttapa.github.io/Control-Surface-doc/Doxygen/dc/d05/Keyboard-Matrix-BCD_8ino-example.html

/**
 * This examples shows how to use a button matrix to read many switches using
 * a BCD to decimal decoder.  
 * https://forum.arduino.cc/index.php?topic=651047
 * 
 * @boards  AVR, AVR USB, Due, Nano 33, Teensy 3.x, ESP32
 * 
 * Written by Pieter P, 2019-12-01  
 * https://github.com/tttapa/Control-Surface
 */

#include <Control_Surface.h>

#include <AH/STL/bitset>

// Pick one MIDI interface to use:
USBDebugMIDI_Interface midi(115200); // baud rate, use for easy debugging
// USBMIDI_Interface midi; // Use for final sketch with MIDI firmware
// HairlessMIDI_Interface midi; // Use for Hairless Serial <-> MIDI bridge

// Dimensions of the keyboard matrix
constexpr uint8_t rows = 10;
constexpr uint8_t columns = 8;

static_assert(rows <= 10, "Error: TC4028 only has 10 outputs");

// The note numbers corresponding to the buttons in the matrix
const AddressMatrix<rows, columns> notes = {{
  {1, 2, 3, 4, 5, 6, 7, 8},        //
  {9, 10, 11, 12, 13, 14, 15, 16}, //
  // 8 more rows ...
}};
// The MIDI channel to use
const Channel channel = CHANNEL_1;

// Address pins A, B, C & D of TC4028
const PinList<4> addressPins = {{2, 3, 4, 5}};
// The pins connected to the columns of the keyboard matrix (with external
// pull-down resistors)
const PinList<columns> columnPins = {{6, 7, 8, 9, 10, 11, 12, 13}};

// Make the given line [0, 9] of the TC4028 high, the nine others low
void selectLine(uint8_t line) {
  uint8_t mask = 1;
  for (pin_t addressPin : addressPins) {
    digitalWrite(addressPin, (line & mask) != 0);
    mask <<= 1;
  }
}

void setup() {
  for (pin_t addressPin : addressPins)
    pinMode(addressPin, OUTPUT);
  for (pin_t columnPin : columnPins)
    pinMode(columnPin, INPUT);

  midi.begin();
}

// Array of bits to remember previous switch states for state change detection.
std::bitset<rows * columns> previousStates;

void loop() {
  for (uint8_t row = 0; row < rows; ++row) {
    selectLine(row);
    for (uint8_t col = 0; col < columns; ++col) {
      bool newState = digitalRead(columnPins[col]);
      uint8_t index = row * columns + col; // index in the bit array
      // If the state of the switch changed
      if (newState != previousStates[index]) {
        // Send a MIDI note message
        // (note on message with zero velocity == note off)
        uint8_t velocity = newState * 0x7F;
        midi.sendNoteOn({notes[row][col], channel}, velocity);
        // Remember this new state
        previousStates[index] = newState;
        // TODO: add debouncing
      }
    }
  }
  midi.update(); // read and discard MIDI input
}

Make sure you change the dimensions and pin numbers to match your hardware.