I'm an uber-beginner, so please bear with me. I'm trying to convert MIDI to serial to control a set of four relays for a guitar amp switcher. The goal is to make the circuit as compact as possible, and eventually burning the bootloader onto a separate atmega chip, so I can use the Arduino (Uno rev3) for other projects.

Anyway, after a few days of getting my feet wet, checking out various peoples' projects, and ordering some parts, I've come to a brick wall.

Long story short, I'm using the MIDI glockenspiel as the main concept (sketch and MIDI input). Although I'm using a 6N138, instead of 6N139.http://www.thebox.myzen.co.uk/Hardware/Glockenspiel.html

This is the relay:http://www.sainsmart.com/4-channel-5v-relay-module-for-pic-arm-avr-dsp-arduino-msp430-ttl-logic.html

When power is applied, the relay is on at all times (using output any of pins 2-9 to input 1-4 on the relay), and no MIDI appears to be getting transferred. The wiring appears to be correct, after numerous checks, and I've tested the MIDI_Basic_IO and MIDI_Input sketches - both display MIDI activity on the TX led.

Any pieces of advice or changes to that glockenspiel sketch to get this going? Thanks.

My guess is that you need to start with just one relay at a time. Hook up your ins ground Vcc and in1 should be your midi output signal, to create that signal you will need your code to signal a message to turn on in1. Showing your code would definitely help. but usually in midi the basic is that an input trigger with a 10k resister to an analog input will send a message. but this is all very general info, you can also use the digital inputs it all depends on your code, also notice the the 3 outputs of each relay one is always closed and one is always open and closed only when activated. so post your code you should get more help and your schematic if you can, if you haven't found it already there's a free product called fritzing easily found on Google to help you build circuits using actual parts, and then creates a schematic for you, and will even allow you to pay them to make you a pcb board, which i here is pretty good quality, but its a nice program, if you don't have it, I believe its cross platform and its opensource. Hope I may have helped a little, and with some more info, im sure some one with more experience will help, good luck!

HARDWARE NOTE:The MIDI Socket is connected to arduino RX through an opto-isolator to invert the MIDI signal and seperate the circuits of individual instruments.Connect the 8 solenoids to pin2 to pin9 on your arduino and pin 13 to the drive enabling monostable.

void playNote(byte note, byte velocity, int down){ // if velocity = 0 on a 'Note ON' command, treat it as a note off if ((down == HIGH) && (velocity == 0)){ down = LOW; } //since we can't play all notes we only action notes between 36 & 49 if(note>=baseNote && note<(baseNote + 13)){ byte myPin=playArray[note-baseNote]; // to get a pin number between 2 and 9 if(myPin != 0) { digitalWrite(myPin, down); // play it if it is one of our notes if(down == HIGH) digitalWrite(strobe, HIGH); // strobe high to monostable for note on } }

}

It's a bit frustrating, because it seems as though there are a few people out there, who have been able to use that same sketch without changing anything.

Well looks like you got the hang of fritzing! it a good tool, Now im just making sure that you do relize that where you have the D2 pin on the output of the arduino, you will need to hook each Dpin up to a relay IN so you have 4 relays you will need 4 more relays 8 in total if your going to use all 8 solenoids and all 8 Digital outputs D2~D9, right now you only have 1 active solenoid (D2 to IN1). You may already know all this and just did a basic example on fritzing, but as you said you are new to this so you may not know? Ive been at it for about 6 months so im no guru but you will learn quickly. does that make sense to you so far you would use another wire to do from arduino D3 to IN2 on your relay board, and so on until you get to IN4 on your relay board, at witch point you will need more relays.

One other thing that makes me wonder is how much current the solenoids use, and if your powering them from a different power source, because you may be pushing the limits of a USB or even a 9 volt for that mater, depending on the power requirements of the solenoids.

Also if your just using one solenoid for now to try and get things running, looking at the code it says 2008, sometimes sketches work differently with different versions of the arduino IDE, if your using the newest version, V1.01 or even V1.0 I find V023 is a good stable version, and use it quite a bit, actually. you may even go back a little bit further and try V019 or so. If your using windows 7 some where around version 018~016 it stops working, I had some code I wanted to use, and it was based on V014 and would not load, so I downloaded every version up to about 017 I think b4 it would actually load up on windows 7 and the code was not compatible. I mention this because ive had programs compile with no errors, and not work in real life, then I would try it on a different version and it would work.

So their is some more ideas for you,and im sure others will chime in eventually with more help, I would look to see what version of the IDE the code is working on for others sometimes the mention it in their posts.

Hope this may have helped. If not maybe you learned something?Good luck

Glad you figured ut out!, I am learning some midi stuff myself, and the theory of relays is interesting, glad I could help even if just a little.Most important to me is that you got it figured out, and posted results. People forget that when you get your project fix, or figured out to post how you did it, just think of all the people your answer might help. To me nothing worse, then when Im reading a forum post, and i see all my similar issues, and the last post is, never mind i figured it out, no schematic like you posted, or any hint! It would be cool, if you ever end up putting it on you tube or anywhere to post a link, id be interested in your finished project. Or feel free to do an article or example on my site rduino.com I have been very slow at posting to it. mostly because I do not document man of my projects!HANKENSTIENrduino.com

Hi ben. Just a small question. I saw this post and check out the code. I am totally new at this. So what this code does is that it receives the midi signal for each of the 8 notes capable of being receive it triggers a particular solenoid. But what will happen if you for example want to use 27 solenoids??? can it be possible by just adding the totality of solenoids into the code or something else needs to be done?? sorry if it sounds stupid but I am very amateur