Synth Not Starting Up

Brevor

Joined Apr 9, 2011
297
Make sure you have 5 volts on pin 8 of the 6N138, also check the ground while you are at it. Make sure there are no shorts on the trace from the 6N138 to the ATMega.
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
It's a 3 ft cable, and at the end of the cable connected to the synth the waveform looks like it does on the other side of the MIDI connector... with the ground of the probe attached to pin 4 and probing pin 5, we get the following. Looks like the previous one except that at the top instead of a solid 5v we have an all over the place signal that varies by a half a volt around 0v. (timescale widened so you can see that)

(and actually, is it normal to wire in just these two pins, and not do anything with the ground pin?)

20150928_175859.jpg
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
@Brevor: solid 5v DC with no noise going into pin 8 of the octocoupler, and solid 0v on pin 5. I am currently inspecting that trace for shorts again.... multimeter and visual inspection says that trace is good. No shorts anywhere on it. No bad solder joints either... we have continuity all the way up to the pin itself. Could this be some sort of parasitic capacitance thing?
 
Last edited:

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
I have made one more addition: The sketch says that it will turn on Pin 13's LED every time there's an incoming MIDI note, but so far we didn't have an LED. So I hooked up the LED from my pushbutton to pin 13... and no lights yet. But at least we know that as far as the ATMEGA is concerned, it's not getting any notes.

I noticed that in the sketch it says the following:

Code:
// Create a SoftwareSerial object named "Soundgin"
SoftwareSerial soundgin = SoftwareSerial(rxPin, txPin);
But pin 3 (tx) isn't hooked up to anything in the schematic. Does it need to be for the software serial to work right?

Also, is it ok for the MIDI jack to be wired up with nothing going to ground like it is?
 

Alec_t

Joined Sep 17, 2013
14,312
is it normal to wire in just these two pins, and not do anything with the ground pin?
Also, is it ok for the MIDI jack to be wired up with nothing going to ground like it is?
Yes. That's the point of using an optocoupler... to avoid ground loops.
Here's a sim of what a 31.25kHz (MIDI frequency) signal should give you. The CNY17-3 used is about a quarter of the speed that your 6N138 should be.
MIDIsim.PNG
If you're not seeing an opto input similar to the blue trace then it looks like your MIDI sender has a fault.
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
@Alect_t: Ok, mine doesn't look like the blue trace, it looks like the yellow trace, so I guess we have a problem there... although that's weird, because if I program my UNO to think it's a MIDI controller, I have the same waveshape...

Last night I realized that the only Software serial object is running at 9600. Upping it to MIDI speeds made the chip start tibetan throat singing at me, and pressing a key would reset the sound.

I believe this means I need two serial connections, one to the keyboard at midi speeds, and the other to the soundgin at 9600. Does that sound right? Or is the midi library already taking care of being the other serial connection?
 
Last edited:

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
Ok, so midi does take care of its own serial, and uses the hardware serial port by default. That makes sense, since our soundgin serial port is physical pin 5 for tx (rx is not hooked up) and the midi rx is hooked up to physical pin 3.

Adding the last line of the following code, then should initialize the hardware serial port to the right speed:
Wire.begin();
soundgin.begin(9600); //Set Software Serial Baud Rate to 9600
Serial.begin(31250); //Set Hardware Serial Baud Rate to MIDI, or 31250
But, it has no effect.

Scratch that... if I add another resistor in parallel to the resistor on the output side of the optocoupler, the spikes on the MIDI signal reach closer to 5v, and all note on signals are sent to the synth! We have music coming out!

All note off signals are not sent through, though... I'm thinking this means I should just remove the 270 ohm resistor, or use another with a very, very tiny resistance... does that seem like the right thing to do to anybody?
 
Last edited:

kubeek

Joined Sep 20, 2005
5,795
From what you posted so far it seems that the problem lies between the synth and the optocoupler, rather than between opto and the microcontroller. You might try adjusting the resistors on the far side instead. I wouldn´t lower the resistor at the mcu side much lower, you might burn out the output of that optocoupler.
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
Ok, putting the 2nd 270 ohm resistor in parallel with the input side resistor instead of the other one had no effect on the signal... the 2x 270 ohm resistors in parallel on the output side (so 135 ohms total) seems to nearly do the trick... I'm thinking maybe a 100 ohm would probably do it, but want to make sure that I'm not gonna fry anything by doing so...
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
Ok, I am very close now... a friend's EE dad suggested I tie pin 7 to ground through a 10 k resistor, and up the 270 ohm resistor to 470. So I did, and most midi commands are getting through, though about half the time the note off commands are still being dropped.

Wave looks nicer now too.

20150929_212337.jpg
 
Last edited:

Brevor

Joined Apr 9, 2011
297
It may eventually fry the optocoupler, but there is something wrong in the circuit. Changing the resistor to 100 ohms is only putting a band-aid on the problem. One other thing you could try is remove the ATMega IC and scope pin 8 of the optocoupler again and see if the waveform improves,
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
Removed the ATMEGA and probed the resistor (on the pin 6 side, same as before) and get the exact same waveform. And the 100k resistor I decided against... that is now a 470, and pin 7 goes to ground through a 10k.
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,312
Can you show us the waveform of the voltage between pins 2 and 3 of the 6N138, expanded so that the individual bits within the 31.25kHz MIDI byte are clearly visible? Looks to me as though the opto's input LED isn't being driven properly.
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
Here's what the voltage between 2 and 3 looked like... I couldn't get it to show anything that looked like a real MIDI signal... it showed this weird wave that appears to be slightly AM'd by the MIDI signal. Sorry for the blurriness, taking this picture while also holding the probe onto 2 and 3 and also playing the keyboard requires like 5 hands and an elbow.

20150930_085032.jpg
 

kubeek

Joined Sep 20, 2005
5,795
Hmm, nice photo :D doesn´t your scope have a usb port so that you could get proper screenshots?
Anyway, is that timebase 5ms? That looks like loads of mains hum interfering with the data signal.
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
It does, but I've heard the software for these only exists for Windoze. On a macbook, don't have access to a windows computer at the moment, so I have to make do. :)

Yes, timebase was 5ms. Frequency was 59.52Hz, so yeah, mains hum all up in ya bizniss. I have one of those round flourescent magnifier lights on my desk, that probably has something to do with it. I will try again with the light off.
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
Oh... neato! I will do that then. Sorry, as I said in the original post, this is my first time messing with a scope, first anything I've built more complicated than hooking some shit up to an arduino and writing a bit of code for it.
 

kubeek

Joined Sep 20, 2005
5,795
Now back to the signal, is that midi cable shielded? Is the shield connected to anything on the side of your circuit (it shouldn´t be)? Is there anything else connected into the synth?
 

Thread Starter

IWorkInPixels

Joined Sep 25, 2015
55
20150930_090636.jpg

I haven't the foggiest clue whether it's shielded or not, I thought they all were... It's the el cheapo 3 ft cable from guitar center, so I'm gonna guess that it is not. Only pins 2 and 4 are connected to my circuit, per the schematic. There is nothing else connected to the synth except the screen, button, encoder, midi device, and the audio out goes to a little amplifier that is currently off.
 
Top