Arduino Forum

Using Arduino => Audio => Topic started by: ARIS009 on Dec 07, 2018, 04:29 pm

Title: Midi input with no rx pin
Post by: ARIS009 on Dec 07, 2018, 04:29 pm
Hi
 
I am doing a project that requires midi input which I have seen uses the rx pin on the arduino.My problem is that I have an 8 bit DAC(digital to analog converter) hooked up to the PORTD(the only one with 8 pins on the uno) so I cant use the rx pin.

Does any body know how can I use midi in with another pin or another arduino board with differnt port registers that will allow an 8 bit DAC without using the rx pin?

Thanks a lot for your time.
Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 07, 2018, 05:59 pm
1) Use software serial for your MIDI output
or
2) Use an Arduino Micro pro - this can connect to MIDI over USB and so does not need Pin 1
or
3) Use a Mega, that has other free ports with all pins available.
Title: Re: Midi input with no rx pin
Post by: ARIS009 on Dec 08, 2018, 12:55 pm
Thanks for answering so fast, but could you please explain your ideas a bit more especially the first two because I have no idea how to apply them.

Also I want to make clear that I want to use midi input with my arduino.

Again thanks a lot for your time.
Title: Re: Midi input with no rx pin
Post by: slipstick on Dec 08, 2018, 01:59 pm
Normally MIDI In/Out use hardware Serial commands which need pins 0 and 1. You can instead change the code to use SoftwareSerial which can be set up on any digital pins of your choice.

If you post the code and circuit that you are using you can probably get detailed instructions about what changes are needed but there's no point us trying to guess what you currently have.

Steve

Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 08, 2018, 10:10 pm
Option 2 says use a different sort of Arduino. The one I suggested can use the USBMIDI libiary that can connect direct to your PC or lap top and be recognised as a HID MIDI device. This leaves pins 0 & 1 free to use in your parallel interface.
Title: Re: Midi input with no rx pin
Post by: MarkT on Dec 09, 2018, 12:09 pm
Hi
 
I am doing a project that requires midi input which I have seen uses the rx pin on the arduino.My problem is that I have an 8 bit DAC(digital to analog converter) hooked up to the PORTD(the only one with 8 pins on the uno) so I cant use the rx pin.
You can split the 8 bit parallel output of the DAC between two ports, read both ports and combine the
values using shifts and ORs.  Sure its convenient to have all 8 bits on a single port, but its not a hard
requirement unless timing is really tight.

Thus instead of reading the 8 bits like this:
Code: [Select]

byte readDAC()
{
  return PIND ;
}

you might do something like:
Code: [Select]

byte readDAC()
{
  return (PIND & 0xF0) | (PINB & 0x0F) ;
}

Thus using Arduino pins 8,9,10,11,4,5,6,7 for bits 0 to 7 of the DAC's parallel output.
Title: Re: Midi input with no rx pin
Post by: ARIS009 on Dec 12, 2018, 04:21 pm
Thanks a lot for the great advice guys.

I am going to use Arduino leonardo pro micro that supports usb midi.Could anyone tell me the port registers for it and save me some trouble please? Cause I do not understand a word from the datasheet.

Thanks.

Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 12, 2018, 11:16 pm
It is all on the schematic.
Title: Re: Midi input with no rx pin
Post by: ARIS009 on Dec 14, 2018, 01:46 pm
Sorry for being a noob but could you just tell me were to hook up my 8 bit DAC and the command I need to use on my code? As I told you I do not understand the shcematics

Thanks
Title: Re: Midi input with no rx pin
Post by: MarkT on Dec 14, 2018, 07:25 pm
The loeonardo doesn't bring out an entire 8 bit port out on the Arduino pins.
Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 14, 2018, 09:49 pm
Quote
As I told you I do not understand the shcematics
No you didn't you said:-
Quote
Cause I do not understand a word from the datasheet.
A data sheet is not a schematic.

You have also not said what you want to do with this D/A. Do you know what you are trying to do? Would you mind sharing it with us?
Title: Re: Midi input with no rx pin
Post by: ARIS009 on Dec 15, 2018, 02:39 pm
I want be able to receive midi messages and translate them into a voltage so I can control an analog synthesizer with midi.Also sorry for inaccuracys on my posts but it the first serious project I do with arduino.
Anyway could you please answer my question?
could you just tell me were to hook up my 8 bit DAC and the command I need to use on my code?

Thank a lot for the time you hane invested in my problem.
Title: Re: Midi input with no rx pin
Post by: slipstick on Dec 15, 2018, 04:45 pm
If you mean MIDI to 1V/ octave CV you'd be amazed how many people have already done such projects with Arduinos. If you were to Google "Arduino MIDI to CV" you'd find all sorts of useful information.

BTW an 8 bit DAC isn't nearly good enough if you expect to get musical notes out of the synth. You might get away with 12 bits but really 16 bits is more like it.

Steve
Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 15, 2018, 05:52 pm
Yes agreed, and you would be much better off using an SPI interfaced D/A rather than trying to interface a parallel one.
Note that CV is not implemented in a very standard way, but one volt per octave is perhaps the most popular, so you normally need greater than 5V for this. For the different standards see https://en.m.wikipedia.org/wiki/CV/gate (https://en.m.wikipedia.org/wiki/CV/gate)
Title: Re: Midi input with no rx pin
Post by: ARIS009 on Dec 16, 2018, 01:06 pm
Guys, please I am not asking for another solution on my project.I simply want to know how can I wirw an 8 bit DAC on an arduino leonardo pro micro.

Does anyone know this???
Title: Re: Midi input with no rx pin
Post by: slipstick on Dec 16, 2018, 03:34 pm
There are many different DACs with all sorts of different connection schemes. Are you using any particular one?

Steve
Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 17, 2018, 11:22 am
This might help you with a parallel connection
https://create.arduino.cc/projecthub/ambhatt/8-bit-io-port-library-for-arduino-5c11a6 (https://create.arduino.cc/projecthub/ambhatt/8-bit-io-port-library-for-arduino-5c11a6)
Title: Re: Midi input with no rx pin
Post by: ARIS009 on Dec 17, 2018, 06:06 pm
Here is a pic that shows what I am going for.
The pic shows an arduino uno.I simply want to know the pins that would make this setup work with a leonardo pro micro.

*Sorry for the bad quality of the pic.
Title: Re: Midi input with no rx pin
Post by: Grumpy_Mike on Dec 17, 2018, 11:42 pm
Use the same pins and the library I posted.
That circuit is called an R2R ladder and for 8 bits you need better than 0.5% tolerance resistors for it to work properly.