DIYstompboxes.com

DIY Stompboxes => Building your own stompbox => Topic started by: craigmillard on March 18, 2018, 08:31:45 AM

Title: Midi help before i go mad!!
Post by: craigmillard on March 18, 2018, 08:31:45 AM
Hi Guys,

Im struggling to get the most basic circuit working here and for some reason cant figure it out!

So i am interfacing a Midi out to a arduino so need a midi in circuit. I have used the standard approach using an opto chip 6n138 and breadboarded it as the following schematic:

(http://2.bp.blogspot.com/-sQ8Uw7x-Vs0/VOatHJCRTGI/AAAAAAAAA9E/yD_TdRw_QKo/s1600/MIDI_Input_Schematic.png)

So the issue is i am not getting anything out of the opto if i use my usb-midi cable, its always 5v:(

I have verified the circuit on the board and it does work if i connect the midi in to 5v and gnd on the in side causing the opto to go low..

I have also confirmed the midi out is sending signal as have removed the opto from the circuit and put a led in its place and can see it flashing when data is sent!!

Any hints to where i should be looking, for such a simple circuit its driving me mad!

Im using one of these to send the midi for testing..https://www.amazon.co.uk/Zacro-Interface-Adapter-Musical-Keyboard/dp/B01GY5JDQQ/ref=sr_1_1_sspa?ie=UTF8&qid=1521376344&sr=8-1-spons&keywords=usb+midi&psc=1
Title: Re: Midi help before i go mad!!
Post by: ElectricDruid on March 18, 2018, 08:42:10 AM
I need a bit more information, I think; You say you're using a USB-MIDI cable? That circuit is for the "traditional" 180-degree 5-pin DIN MIDI plug. USB MIDI uses a different format and isn't directly compatible - it's not just "MIDI down a USB cable".

Connect a standard MIDI lead from your keyboard to the circuit, and see what happens.

HTH,
Tom
Title: Re: Midi help before i go mad!!
Post by: craigmillard on March 18, 2018, 08:46:16 AM
Wow fast response:0 thanks!

The cable im using should output standard midi, it just allows a pc to output midi or receive it. It also has standard 5 pin Din Midi plugs. I have verified the output of this cable puts out enough current to flash a 3mm led when sending data??
Title: Re: Midi help before i go mad!!
Post by: craigmillard on March 18, 2018, 08:53:52 AM
Also I don't have a KB near me to test with another device:(

Sent from my Plus E using Tapatalk

Title: Re: Midi help before i go mad!!
Post by: diffeq on March 18, 2018, 09:57:05 AM
Given that cable can flash a seperate LED, check 1) 1N914 polarity 2) opto resistor, maybe replace 220R with, say, 120R.
Title: Re: Midi help before i go mad!!
Post by: anotherjim on March 18, 2018, 10:18:15 AM
Unless the insides of the coupler chip have more to them than the diagram shows, that wiring looks like a way to burn it out to me - connection right thru from 5v when the 1st transistor conducts via the second transistor base-emitter to ground. What limits the current to a safe level?
And doesn't this more straightforward connection work? Only difference I see is pin7 not used.
(http://tigoe.com/pcomp/img/midi-schem.jpg)

If you are a MIDI newbie, the cable to connect to your Arduino midi in, is the adapters midi out. Some do think it goes "in to in" and "out to out".


Title: Re: Midi help before i go mad!!
Post by: craigmillard on March 18, 2018, 10:24:20 AM
I have verified the 1n914 polarity and confirmed by removing the midi in and feeding 5v directly, I dont think its the opto as if I put an led on the output of the opto instead of the RX pin the led responds to my manual 5v feed..

The schematic above is based of the midi standard, pin 7 sharpens the edges of the wave form allowing for more precision/less missed notes in the midi data. Going to try dropping the input resistor now..

Sent from my Plus E using Tapatalk

Title: Re: Midi help before i go mad!!
Post by: craigmillard on March 18, 2018, 10:42:15 AM
I think I cracked it! It might have been my code:( I was setting the led on the arduino to turn off when data received but think its so fast I could see it flick off then back on! I set this the other way round and now I can see it responding to the data!:)

I did change the resistor to 120 too so might switch back and see if it still works!

I now need to get it working with the midi library:)

Thanks for the quick responses all I was pulling my hair out thinking I had done something basic and couldn't see it!!

Sent from my Plus E using Tapatalk

Title: Re: Midi help before i go mad!!
Post by: ElectricDruid on March 18, 2018, 08:19:36 PM
Glad to hear you got it sorted. Welcome to MIDI coding world!

T.