Guitar amp foot switch MIDI IN / MIDI OUT with relays

I want to convert a 3 button guitar amp foot-switch into a MIDI IN / OUT controller with 3 relays to also control the amp's channels and effects.

My effects device is a Line6 M13. The M13 sends MIDI messages when a "scene" is chosen (I'll be choosing scenes manually on the M13... no MIDI control for this). The foot switch will receive these messages to determine which scene is currently active. When a footswitch button is pressed, the footswitch will send a MIDI message OUT to the M13 to turn on/off any number of effects that make up a given scene. (The three buttons will send differ messages depending on the active scene). This will allow me to have 4 scene configurations with only pressing 1 of 3 buttons ]:D

If anyone is up to it, please take a look at the attached diagram detailing the proposed circuit. Please let me know if I have the right parts chosen for the task and if I've made any general errors along the way. I didn't add the power source or the footswitch buttons themselves to keep it from being too "busy".. Naturally I'll connect them between digi ins and ground with the internal pull-up resistors active. Also, the relays aren't the actual one's I'd probably use (they are just ones that were in the Fritzing library). I plan to use 5V relays like they have at Sparkfun.com

Thanks!!!

Hi, you need MIDI speaking guys for this.

But Q5 is non inverting and has no purpose as I see it...

Also R6 and R7 seem high.. 1K or 2.7K might be better...

and Q1, Q2, Q3 might need some resistor like 47K from base to emitter(ground) to make sure they don't float up before Arduino code sets them as Outputs (They are Inputs at Reset time)..

Breadboard it first, not too complex...

You could 'cheat' by using premade relay boards like some of the ones shown here: http://arduino-info.wikispaces.com/ArduinoPower

Thanks for the reply. I actually meant for R6 and R7 to be 10k... oops. The "design" of this circuit (if you can call it that) is really just a combo of circuits I scoured from the internet.

The MIDI OUT portion is from : http://www.neufeld.newton.ks.us/electronics/?p=250

The MIDI IN is from: http://midibox.org/forums/topic/7136-pc-900-vs-6n138/ I figured I'd try the PC900 version since I have one of those.

The relay circuit is from: http://www.arduino.cc/playground/uploads/Learning/relays.pdf

I don't quite understand the suggestion of the 47k resistor between collector and emitter, could you maybe elaborate?

Updated drawing (sorry I couldn't get the image tag to work):

http://www.flickr.com/photos/33938419@N05/6182967223/

The MIDI OUT portion is from

That shows a hex inverter then a transistor. Your transistor Q5 is wired up as an emitter follower and so will not be an inverter. Therefore the MIDI out signal will be up side down.

See this:- http://www.thebox.myzen.co.uk/Hardware/MIDI_Shield.html

I don't quite understand the suggestion of the 47k resistor between collector and emitter, could you maybe elaborate?

The connections to the base of those transistors goes to an Arduino output pin. When Arduino is powered up or reset all I/Os are set as inputs which are 'floating' ie. very high impedance. So basically at that time the transistor bases are "unconnected" to anything. Probably not a problem with some power transistor etc. But with a signal circuit like yours it "might be".

Just conservative design practice.

OMG, Me Conservative :~

Thanks Terry and Mike! I'll incorporate those ideas!

Dumb question about the relay bit: Why are the transistors needed? Is it just because the Arduino I/O pins can't source enough current to turn on the relays (well THESE relays, anyway)? How much current would it usually take considering these are 5V relays and the loads will only be 4.6 - 5.7VDC?

Thanks!

Is it just because the Arduino I/O pins can't source enough current to turn on the relays

Yes, virtually any relay is too much for an arduino pin.

How much current would it usually take considering these are 5V relays and the loads will only be 4.6 - 5.7VDC

The load on the relay has absolutely nothing to do with the current it takes to turn it on. The current a relay takes is down to the design of the relay coil.

Hi, the typical relays used are 5volts with a coil of about 70 ohms, so, um, I=E/R I=5/70= .072 so 72 ma. Arduino pin's absolute maximum (not recommended) is 40ma. So a intermediate driver transistor is needed.

The relay boards I use a lot (like these- see schematic - http://arduino-direct.com/sunshop/index.php?l=product_detail&p=155) have a 1000 ohm resistor from a PNP transistor to Arduino output so the current is 5.0-.6=4.4V approximately across 1000 ohms so only about 4 ma from the arduino. No problem, and 5 or so relays COULD be driven from the same Arduino pin if there was some need to switch multiple power sources, AC and DC or etc.

Terry: that relay module you linked to looks great! Do you happen to have the dimensions? I'm hoping it will fit into my housing.

Thanks!

Hi,

It's 3-1/16" (7.8cm) by 2-1/8" (5.5cm) and a little under 1" (2.5 cm) high, counting solder on the bottom of the board.

Terry:

That looks like a great board, however, due to size constraints, I have to build my own to spread out the parts within the foot-switch housing.

Parts list I ordered:

1k 1/4W resistors for R3, R4, and R5
51k 1/4W resistors between collector and emitter
Fairchild PN2222A NPN’s to switch the relays
5V relays from sparkfun
1N4004 for the “snubber” diodes (I what that was recently… though I don’t 100% understand what’s really going on there)

Are there any freeware circuit simulator s/w packages (preferably for Mac) that you guys know about? I found this website: Circuit Simulator Applet
It’s OK, I supposed, but not entirely user friendly (or “save-able”).

I bought some transistors AND a hex inverter to try with the MIDI out circuit… I should be able to get something to work.

I’ll update when I get somewhere with this.