Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MIDI and a 6n138

Status
Not open for further replies.

prock

New Member
Hi everyone,

First I'd like to thank you for reading my post. I generally do not like to post questions unless I'm absolutely stuck and this happens to be one of those cases. I do not have a lot of electronic circuit design experience nor do I have any formal education in electronics. Please forgive my ignorance in the subject.

What I am trying to do is to build a circuit to read and write MIDI signals using an AVR (more specifically an Arduino). Lucky for me the Arduino provides a serial interface. I have been successful sending valid MIDI signals but have been unable to receive midi signals. I designed my circuit based on the one posted here

I purchased several 6n138 Optoisolators from DigiKey. Here is the datasheet.

The odd thing is (following the circuit above) the 6n138 gets extremely hot when I connect pin 8 to +5V and pin 5 to GND. I was reading through the datasheet and the 6n138 should be able to handle a Vcc of +7V. I double checked to make sure my power supply was in fact providing +5V which it was. Am I misreading the datasheet?

I originally noticed the problem after I completed the circuit and turned the power on for the first time. I assumed that the 6n138 I was using was bad so I tried another one which had the same problem. Okay back to the drawing board. I then removed everything from my breadboard except the 6n138 and the wires going from pin 8 to +5V and from pin 5 to GND and it STILL overheated (Good thing I purchase a lot of these things).

The next thing I did was introduce a resistor between pin 8 and +5V. According to the datasheet the output current is about 60mA so I decided to use a 100ohm resistor I had lying around which dropped the voltage to about 3.9 and current to around 40mA which should be well within operating values. The 6n138 no longer overheats but it still seems odd to me that I needed to introduce the resistor because the above circuit doesn't use one.

Okay so now that the 6n138 is not overheating I re-connected the circuit but still without any luck. One thing that bothers me is the LED between pins 2 and 3 will be OFF when there is no MIDI data. The 6n138 is inverting (is that the correct term?) the signal meaning that PIN 6 will be HIGH when the LED is OFF. Is there a way to measure this? If I put a voltmeter between PIN 6 and GND I get about +3.9V. Does this make sense??


As you all can tell I'm royally confused right now. I know I want to use the 6n138 to isolate and protect my circuit from the other MIDI device. Is there another way (or better way) of doing this? Can anyone offer me any advice as to what I should do next?
 
What I am trying to do is to build a circuit to read and write MIDI signals using an AVR (more specifically an Arduino). Lucky for me the Arduino provides a serial interface. I have been successful sending valid MIDI signals but have been unable to receive midi signals. I designed my circuit based on the one posted here

You don't need the MAX232, but the rest should be fine - depending on the current capabilites of the AVR.

I purchased several 6n138 Optoisolators from DigiKey. Here is the datasheet.

The odd thing is (following the circuit above) the 6n138 gets extremely hot when I connect pin 8 to +5V and pin 5 to GND. I was reading through the datasheet and the 6n138 should be able to handle a Vcc of +7V. I double checked to make sure my power supply was in fact providing +5V which it was. Am I misreading the datasheet?

If it's getting hot then you've done something wrong, connected wrong way round perhaps? - it may be toast now.

I originally noticed the problem after I completed the circuit and turned the power on for the first time. I assumed that the 6n138 I was using was bad so I tried another one which had the same problem. Okay back to the drawing board. I then removed everything from my breadboard except the 6n138 and the wires going from pin 8 to +5V and from pin 5 to GND and it STILL overheated (Good thing I purchase a lot of these things).

I don't like breadboards (and never use them), it's far too easy to connect things wrongly.

The next thing I did was introduce a resistor between pin 8 and +5V. According to the datasheet the output current is about 60mA so I decided to use a 100ohm resistor I had lying around which dropped the voltage to about 3.9 and current to around 40mA which should be well within operating values. The 6n138 no longer overheats but it still seems odd to me that I needed to introduce the resistor because the above circuit doesn't use one.

Okay so now that the 6n138 is not overheating I re-connected the circuit but still without any luck. One thing that bothers me is the LED between pins 2 and 3 will be OFF when there is no MIDI data. The 6n138 is inverting (is that the correct term?) the signal meaning that PIN 6 will be HIGH when the LED is OFF. Is there a way to measure this? If I put a voltmeter between PIN 6 and GND I get about +3.9V. Does this make sense??

Do you have a pullup resistor on pin 6?.

As you all can tell I'm royally confused right now. I know I want to use the 6n138 to isolate and protect my circuit from the other MIDI device. Is there another way (or better way) of doing this? Can anyone offer me any advice as to what I should do next?

MIDI inputs are isolated, and required to be - MIDI outputs aren't.

The 6N138 should be fine, and if I remember correctly is the one I used in my MIDI interface for the Amiga many years ago, which got published in two magazines.
 
The odd thing is (following the circuit above) the 6n138 gets extremely hot when I connect pin 8 to +5V and pin 5 to GND.

Whoever design the original circuit have just copied the manufacturer test circuit without much thinking.

For the performance of the device to appear better, the manufacturer is testing the device without a load resistor but place restriction on the frequency and duty cycle of the input test signal instead. That's why the manufacturer can use the device without a load resistor. It does not mean one can use them in this manner.

In your case, to prevent overheating, you have to use a resistor instead. See the image from a Toshiba 6N138 datasheet and it indeed has a resistor Rcc. I think 2K2 is suitable in your application.
 

Attachments

  • 6n138x.gif
    6n138x.gif
    11.3 KB · Views: 2,966
Hi guys,

Thanks for the response. I was able to determine my problem. It was truly a rookie mistake on my part. I had +5V going to GND and GND going to Vcc on the 6n138. Apparently that's not a good thing to do. In any case it's working 100% now. :)

Nigel, you are definitely right about breadboards. It is very easy to hook things up incorrectly.
 
Agilent's datasheet says to connect pin 6 and pin 8 together and a load from them to a positive supply voltage. Then they become an ordinary photo-darlington.
 
????

sorry if i repeat the question as iam new in that feild
i design eeg circuit and i get shocked
i dont know how to isolate the source of power to protect me
thanks
 
sorry if i repeat the question as iam new in that feild
i design eeg circuit and i get shocked
i dont know how to isolate the source of power to protect me
thanks
Please start a separate thread. Don't hijack someone elses.
 
Status
Not open for further replies.

Latest threads

Back
Top